# NixOps with state stored on target machine?

**URL:** https://discourse.nixos.org/t/nixops-with-state-stored-on-target-machine/4112
**Category:** Help
**Created:** [September 20, 2019, 8:14pm UTC](https://discourse.nixos.org/t/nixops-with-state-stored-on-target-machine/4112 "2019-09-20T20:14:08Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![generic-specialty](https://discourse.nixos.org/user_avatar/discourse.nixos.org/generic-specialty/32/1526_2.png) [@generic-specialty](https://discourse.nixos.org/u/generic-specialty)
#### Post date: [September 20, 2019, 8:14pm UTC](https://discourse.nixos.org/t/nixops-with-state-stored-on-target-machine/4112/1 "2019-09-20T20:14:08Z")

</div>

I’m using a small VPS to hosts a website and a SQL database for that website, both on the same machine.

How can I migrate this machine to NixOps so that the database is not overwritten every time I deploy new code for the website?

If it means anything, I’m using DigitalOcean, but j cannot currently afford to use their external/managed database service.

Thanks!

---

<div class="post-metadata">

### Author: ![aanderse](https://discourse.nixos.org/user_avatar/discourse.nixos.org/aanderse/32/1420_2.png) [@aanderse](https://discourse.nixos.org/u/aanderse)
#### Post date: [September 20, 2019, 8:24pm UTC](https://discourse.nixos.org/t/nixops-with-state-stored-on-target-machine/4112/2 "2019-09-20T20:24:33Z")

</div>

The database won’t be overwritten. What made you think it will be?

---

<div class="post-metadata">

### Author: ![generic-specialty](https://discourse.nixos.org/user_avatar/discourse.nixos.org/generic-specialty/32/1526_2.png) [@generic-specialty](https://discourse.nixos.org/u/generic-specialty)
#### Post date: [September 20, 2019, 8:26pm UTC](https://discourse.nixos.org/t/nixops-with-state-stored-on-target-machine/4112/3 "2019-09-20T20:26:22Z")

</div>

Oh, the disk isn’t overwritten? Oh, awesome!  
For some reason, I thought the entire disk was wiped.

---

<div class="post-metadata">

### Author: ![aanderse](https://discourse.nixos.org/user_avatar/discourse.nixos.org/aanderse/32/1420_2.png) [@aanderse](https://discourse.nixos.org/u/aanderse)
#### Post date: [September 20, 2019, 8:29pm UTC](https://discourse.nixos.org/t/nixops-with-state-stored-on-target-machine/4112/4 "2019-09-20T20:29:03Z")

</div>

So migrating to nixops may or may not require you to wipe the disk depending how you choose to install, but nixops deploy will not.
