# Moving database directory to a new partition, Ubuntu20.04

**URL:** <https://community.stardog.com/t/moving-database-directory-to-a-new-partition-ubuntu20-04/3782>\
**Category:** Support\
**Created:** [May 27, 2022, 3:44pm UTC](https://community.stardog.com/t/moving-database-directory-to-a-new-partition-ubuntu20-04/3782 "2022-05-27T15:44:48Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![bkm](https://avatars.discourse-cdn.com/v4/letter/b/ecccb3/32.png) [@bkm](https://community.stardog.com/u/bkm)\
**Post date:** [May 27, 2022, 3:44pm UTC](https://community.stardog.com/t/moving-database-directory-to-a-new-partition-ubuntu20-04/3782/1 "2022-05-27T15:44:48Z")

</div>

Hi,  
I am running Stardog7.6.4 on a Ubuntu 20.04 machine. The binaries are located in /opt/stardog/bin and STARDOG\_HOME is set to /var/opt/stardog.  
I am out of space on that partition, so I want to move my databases to another partition, but keep the binaries where they are. Am I correct that this would be the way to proceed?

1. export all databases
2. shut down the server
3. Create a directory on the other partition /data/stardog
4. Copy the license key to /data/stardog
5. Change /etc/stardog.env.sh to contain  
export STARDOG\_HOME=/data.stardog
6. Restart the server
7. import the databases

Do I need any other steps?  
And if something goes wrong, can I simply back out by changing STARDOG\_HOME back to /var/opt/stardog? If I don't change anything in that folder, I assume the server would be able to access the original databases?

Thanks. I really need to move to the new partition but I don't want to lose my databases!

---

<div class="post-metadata">

**Author:** ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)\
**Post date:** [May 27, 2022, 4:15pm UTC](https://community.stardog.com/t/moving-database-directory-to-a-new-partition-ubuntu20-04/3782/2 "2022-05-27T16:15:57Z")

</div>

It looks good just a couple of suggestions. You can do a `server backup` / `server restore` rather than an export to make sure you capture everything. You can also simply copy the directory contents to the new location and update STARDOG\_HOME, but would still recommend a backup.

You might want to verify the new location with `Stardog-admin server status`. I can see getting things pointing to somewhere other than where you though they were and then if you write to the wrong place things start getting complicated.

---

<div class="post-metadata">

**Author:** ![bkm](https://avatars.discourse-cdn.com/v4/letter/b/ecccb3/32.png) [@bkm](https://community.stardog.com/u/bkm)\
**Post date:** [May 27, 2022, 8:07pm UTC](https://community.stardog.com/t/moving-database-directory-to-a-new-partition-ubuntu20-04/3782/3 "2022-05-27T20:07:37Z")

</div>

Thanks. I didn't think it was possible to simply copy the databases over - I had tried to do something like that once and got error messages. I certainly will do the backups in any case.

---

<div class="post-metadata">

**Author:** ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)\
**Post date:** [May 27, 2022, 8:31pm UTC](https://community.stardog.com/t/moving-database-directory-to-a-new-partition-ubuntu20-04/3782/4 "2022-05-27T20:31:19Z")

</div>

It should be ok as long as you shutdown the server first and take care to preserve the permissions like using the `-p` flag if using `cp`. Someone also suggested that you can use `rsync` as well.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [June 5, 2022, 12:52pm UTC](https://community.stardog.com/t/moving-database-directory-to-a-new-partition-ubuntu20-04/3782/5 "2022-06-05T12:52:47Z")

</div>



---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [June 14, 2022, 11:36pm UTC](https://community.stardog.com/t/moving-database-directory-to-a-new-partition-ubuntu20-04/3782/6 "2022-06-14T23:36:11Z")

</div>



---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [June 25, 2022, 11:07am UTC](https://community.stardog.com/t/moving-database-directory-to-a-new-partition-ubuntu20-04/3782/7 "2022-06-25T11:07:26Z")

</div>



---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [July 6, 2022, 4:24pm UTC](https://community.stardog.com/t/moving-database-directory-to-a-new-partition-ubuntu20-04/3782/8 "2022-07-06T16:24:16Z")

</div>



---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [July 18, 2022, 4:02am UTC](https://community.stardog.com/t/moving-database-directory-to-a-new-partition-ubuntu20-04/3782/9 "2022-07-18T04:02:39Z")

</div>



---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [July 30, 2022, 12:42am UTC](https://community.stardog.com/t/moving-database-directory-to-a-new-partition-ubuntu20-04/3782/10 "2022-07-30T00:42:38Z")

</div>



---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [August 12, 2022, 1:26pm UTC](https://community.stardog.com/t/moving-database-directory-to-a-new-partition-ubuntu20-04/3782/11 "2022-08-12T13:26:05Z")

</div>



---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [August 26, 2022, 10:12am UTC](https://community.stardog.com/t/moving-database-directory-to-a-new-partition-ubuntu20-04/3782/12 "2022-08-26T10:12:02Z")

</div>



---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [September 9, 2022, 7:00am UTC](https://community.stardog.com/t/moving-database-directory-to-a-new-partition-ubuntu20-04/3782/13 "2022-09-09T07:00:02Z")

</div>



---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [September 23, 2022, 3:28am UTC](https://community.stardog.com/t/moving-database-directory-to-a-new-partition-ubuntu20-04/3782/14 "2022-09-23T03:28:24Z")

</div>



---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [October 6, 2022, 11:28pm UTC](https://community.stardog.com/t/moving-database-directory-to-a-new-partition-ubuntu20-04/3782/15 "2022-10-06T23:28:10Z")

</div>



---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [October 20, 2022, 8:52pm UTC](https://community.stardog.com/t/moving-database-directory-to-a-new-partition-ubuntu20-04/3782/16 "2022-10-20T20:52:59Z")

</div>



---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [November 5, 2022, 3:44am UTC](https://community.stardog.com/t/moving-database-directory-to-a-new-partition-ubuntu20-04/3782/17 "2022-11-05T03:44:48Z")

</div>



---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [November 26, 2022, 11:27am UTC](https://community.stardog.com/t/moving-database-directory-to-a-new-partition-ubuntu20-04/3782/18 "2022-11-26T11:27:31Z")

</div>



---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [December 19, 2022, 12:25pm UTC](https://community.stardog.com/t/moving-database-directory-to-a-new-partition-ubuntu20-04/3782/19 "2022-12-19T12:25:48Z")

</div>



---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [January 15, 2023, 1:33pm UTC](https://community.stardog.com/t/moving-database-directory-to-a-new-partition-ubuntu20-04/3782/20 "2023-01-15T13:33:10Z")

</div>



[Next page](https://community.stardog.com/t/moving-database-directory-to-a-new-partition-ubuntu20-04/3782.md?page=2)
