# SQLite file in Volume lost data on deploy

**URL:** <https://community.fly.io/t/sqlite-file-in-volume-lost-data-on-deploy/6126>\
**Category:** General\
**Created:** [July 23, 2022, 4:10pm UTC](https://community.fly.io/t/sqlite-file-in-volume-lost-data-on-deploy/6126 "2022-07-23T16:10:53Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![justin678](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/justin678/32/4490_2.png) [@justin678](https://community.fly.io/u/justin678)\
**Post date:** [July 23, 2022, 4:10pm UTC](https://community.fly.io/t/sqlite-file-in-volume-lost-data-on-deploy/6126/1 "2022-07-23T16:10:53Z")

</div>

Hello,

I’m brand new to [fly.io](http://fly.io).

I tried it because I heard you guys were trying to embrace SQLite.

I had a deployment with a SQLite file in a volume.

I just attempted to to run `fly deploy` to update this app. The deploy failed, and the SQLite file seemed to revert to its initial state when I first deployed. I had added about 200 rows to the database since deploying it, and those all disappeared.

Is there any way to get this data back? This isn’t catastrophic but I’d like the data back …

Thanks

---

<div class="post-metadata">

**Author:** ![justin678](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/justin678/32/4490_2.png) [@justin678](https://community.fly.io/u/justin678)\
**Post date:** [July 23, 2022, 4:26pm UTC](https://community.fly.io/t/sqlite-file-in-volume-lost-data-on-deploy/6126/2 "2022-07-23T16:26:14Z")

</div>

I just noticed there are snapshots.

Any idea how I can download one? This would prevent me from losing my work …

---

<div class="post-metadata">

**Author:** ![justin678](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/justin678/32/4490_2.png) [@justin678](https://community.fly.io/u/justin678)\
**Post date:** [July 23, 2022, 7:37pm UTC](https://community.fly.io/t/sqlite-file-in-volume-lost-data-on-deploy/6126/3 "2022-07-23T19:37:24Z")

</div>

I think that the sqlite file may have been actually in my app directory and not on the volume. And it just got blown away by the deploy 😕

---

<div class="post-metadata">

**Author:** ![greg](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/greg/32/2119_2.png) [@greg](https://community.fly.io/u/greg)\
**Post date:** [July 23, 2022, 10:43pm UTC](https://community.fly.io/t/sqlite-file-in-volume-lost-data-on-deploy/6126/4 "2022-07-23T22:43:18Z")

</div>

Ah. If so, that would explain it. The volume is independent of the app and that would persist across deploys.

As you’ve seen, Fly also take snapshots of volumes and they can manually restore them (see thread below). But if your database was not _on_ that volume, I guess that won’t be much help here ☹

> [@Volume sometimes resets on deploy](https://community.fly.io/t/volume-sometimes-resets-on-deploy/4244/4):
>
> Ok, I looked at your app and one of the volumes you previously deleted it still hanging out. So what’s happening is that your app is booting on two different volumes. Does the volume it’s running on have the data you need? Or is it the other one? We can restore that other one pretty easily. There’s no automated way to restore snapshots yet (I don’t think!). It’s built but not shipped.

---

<div class="post-metadata">

**Author:** ![justin678](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/justin678/32/4490_2.png) [@justin678](https://community.fly.io/u/justin678)\
**Post date:** [July 28, 2022, 8:19am UTC](https://community.fly.io/t/sqlite-file-in-volume-lost-data-on-deploy/6126/5 "2022-07-28T08:19:45Z")

</div>

How can I manually restore snapshots? That thread doesn’t say how. And I can’t find any documentation about restoring snapshots anywhere …

---

<div class="post-metadata">

**Author:** ![greg](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/greg/32/2119_2.png) [@greg](https://community.fly.io/u/greg)\
**Post date:** [July 28, 2022, 12:59pm UTC](https://community.fly.io/t/sqlite-file-in-volume-lost-data-on-deploy/6126/7 "2022-07-28T12:59:29Z")

</div>

@justin678 As far as I know you can’t, yet. The key part from Kurt’s post above is the “We can restore that …”. So it needs someone from Fly. If you have a paid plan that would include access to their support to ask for assistance, else it will be a case of someone from Fly seeing your post. They do regularly check and update this forum.

---

<div class="post-metadata">

**Author:** ![justin678](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/justin678/32/4490_2.png) [@justin678](https://community.fly.io/u/justin678)\
**Post date:** [July 30, 2022, 12:40pm UTC](https://community.fly.io/t/sqlite-file-in-volume-lost-data-on-deploy/6126/8 "2022-07-30T12:40:27Z")

</div>

Ahh. Well the relevant snapshots have been deleted now so we’ll never know if that was actually the problem 😕

---

<div class="post-metadata">

**Author:** ![jphenow](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/jphenow/32/16385_2.png) [@jphenow](https://community.fly.io/u/jphenow)\
**Post date:** [July 30, 2022, 6:34pm UTC](https://community.fly.io/t/sqlite-file-in-volume-lost-data-on-deploy/6126/9 "2022-07-30T18:34:16Z")

</div>

As of flyctl version `0.0.363` (released yesterday) you can specify a `snapshot-id` when creating a new volume. One caveat is that cross-org restores are not currently allowed.

---

<div class="post-metadata">

**Author:** ![michele](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/michele/32/43044_2.png) [@michele](https://community.fly.io/u/michele)\
**Post date:** [July 30, 2022, 8:54pm UTC](https://community.fly.io/t/sqlite-file-in-volume-lost-data-on-deploy/6126/10 "2022-07-30T20:54:46Z")

</div>

Hi @justin678 – We really let you down on this and I’m sorry. It doesn’t make up for the data, but I’ve put some credit on your account to try to make up for it.

As @jphenow noted, we’ve updated flyctl so that you can create a new volume using an existing snapshot. As long as you are working in the same organization, this will help if this comes up again.

---

<div class="post-metadata">

**Author:** ![justin678](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/justin678/32/4490_2.png) [@justin678](https://community.fly.io/u/justin678)\
**Post date:** [July 31, 2022, 11:02am UTC](https://community.fly.io/t/sqlite-file-in-volume-lost-data-on-deploy/6126/11 "2022-07-31T11:02:05Z")

</div>

Thanks @michele and @jphenow. Look forward to future SQLite improvements!
