How to Migrate NextCloud Data Location
-
If you were actually wanting to move the /data directory to a new server, there are CLI tools to rescan the data directory and such to rebuild the user database of files.
This will force a resync of things though. But when doing a migration, it can be a lifesaver.
-
In my ignorance, I wasn't really sure what "Shut down NextCloud" meant other than stop httpd so that's what I was doing. I also had to modify the commands from
/data
to/var/www/html/nextcloud/data/
since that's where the other guide had me put the data folder. I tried the commands initially as stated and got an error about not being able to find/data/
In the end, I could see the links created, however I started getting error messages when trying to delete test files I had sent up and such. No big deal. Now I will be attempting to redo this on Fedora server and set it up where
/data
is on the block storage from the start. -
@jaredbusch said in How to Migrate NextCloud Data Location:
If you were actually wanting to move the /data directory to a new server, there are CLI tools to rescan the data directory and such to rebuild the user database of files.
This will force a resync of things though. But when doing a migration, it can be a lifesaver.
This is the command I use when I need to migrate all or a specific user data.
sudo -u apache php /var/www/html/nextcloud/occ files:scan --all or --path=username
-
@zachary715 said in How to Migrate NextCloud Data Location:
In my ignorance, I wasn't really sure what "Shut down NextCloud" meant other than stop httpd so that's what I was doing. I also had to modify the commands from
/data
to/var/www/html/nextcloud/data/
since that's where the other guide had me put the data folder. I tried the commands initially as stated and got an error about not being able to find/data/
In the end, I could see the links created, however I started getting error messages when trying to delete test files I had sent up and such. No big deal. Now I will be attempting to redo this on Fedora server and set it up where
/data
is on the block storage from the start./var/www/html/nextcloud/data
is the default location. you will keep it there, or put a link there. That is what makes it all smooth and simple to run, and also makes troubleshooting easier. -
@scottalanmiller said in How to Migrate NextCloud Data Location:
So if you are like me, your NC data is stored in /data. This is the directory that will explode in size as you store things there.
So what we need to do is make a new place for the data to go, first of all. We will assume that your new block storage is already created and mounted as /extblock. If you are unsure how to mount the new storage in the first place, that's a good topic for a fresh post as it is not directly related to NextCloud and more just Linux general block mounting.
So now /data has the current data and /extblock has the big empty space.
-
Shut down NextCloud
-
cp -rp /data/ /extblock/
-
mv /data /data-old
This step preserves the old data just in case something has gone wrong. -
ln -s /extblock /data
And in theory that is it. You've copied everything from the old space to the new one, then made a link to make the new one look like the old one so that NC doesn't need to know that any of this happened. Of course, you can cd /data once all this is done and verify that it looks correct. -
Start NextCloud
@scottalanmiller, I found this post while researching. It was very helpful, but you missed a . in step 2. It should be
- cp -rp /data/. /extblock/
otherwise you get /extblock/data/***
-
-
@Donahue said in How to Migrate NextCloud Data Location:
@scottalanmiller said in How to Migrate NextCloud Data Location:
So if you are like me, your NC data is stored in /data. This is the directory that will explode in size as you store things there.
So what we need to do is make a new place for the data to go, first of all. We will assume that your new block storage is already created and mounted as /extblock. If you are unsure how to mount the new storage in the first place, that's a good topic for a fresh post as it is not directly related to NextCloud and more just Linux general block mounting.
So now /data has the current data and /extblock has the big empty space.
-
Shut down NextCloud
-
cp -rp /data/ /extblock/
-
mv /data /data-old
This step preserves the old data just in case something has gone wrong. -
ln -s /extblock /data
And in theory that is it. You've copied everything from the old space to the new one, then made a link to make the new one look like the old one so that NC doesn't need to know that any of this happened. Of course, you can cd /data once all this is done and verify that it looks correct. -
Start NextCloud
@scottalanmiller, I found this post while researching. It was very helpful, but you missed a . in step 2. It should be
- cp -rp /data/. /extblock/
otherwise you get /extblock/data/***
Isn't that the goal?
-
-
@scottalanmiller said in How to Migrate NextCloud Data Location:
@Donahue said in How to Migrate NextCloud Data Location:
@scottalanmiller said in How to Migrate NextCloud Data Location:
So if you are like me, your NC data is stored in /data. This is the directory that will explode in size as you store things there.
So what we need to do is make a new place for the data to go, first of all. We will assume that your new block storage is already created and mounted as /extblock. If you are unsure how to mount the new storage in the first place, that's a good topic for a fresh post as it is not directly related to NextCloud and more just Linux general block mounting.
So now /data has the current data and /extblock has the big empty space.
-
Shut down NextCloud
-
cp -rp /data/ /extblock/
-
mv /data /data-old
This step preserves the old data just in case something has gone wrong. -
ln -s /extblock /data
And in theory that is it. You've copied everything from the old space to the new one, then made a link to make the new one look like the old one so that NC doesn't need to know that any of this happened. Of course, you can cd /data once all this is done and verify that it looks correct. -
Start NextCloud
@scottalanmiller, I found this post while researching. It was very helpful, but you missed a . in step 2. It should be
- cp -rp /data/. /extblock/
otherwise you get /extblock/data/***
Isn't that the goal?
No, steps 3 and 4 conflict. Either add the "." to step 3, or else change step 4 to:
ln -s /extblock/data /data
-
-
@Donahue said in How to Migrate NextCloud Data Location:
@scottalanmiller said in How to Migrate NextCloud Data Location:
@Donahue said in How to Migrate NextCloud Data Location:
@scottalanmiller said in How to Migrate NextCloud Data Location:
So if you are like me, your NC data is stored in /data. This is the directory that will explode in size as you store things there.
So what we need to do is make a new place for the data to go, first of all. We will assume that your new block storage is already created and mounted as /extblock. If you are unsure how to mount the new storage in the first place, that's a good topic for a fresh post as it is not directly related to NextCloud and more just Linux general block mounting.
So now /data has the current data and /extblock has the big empty space.
-
Shut down NextCloud
-
cp -rp /data/ /extblock/
-
mv /data /data-old
This step preserves the old data just in case something has gone wrong. -
ln -s /extblock /data
And in theory that is it. You've copied everything from the old space to the new one, then made a link to make the new one look like the old one so that NC doesn't need to know that any of this happened. Of course, you can cd /data once all this is done and verify that it looks correct. -
Start NextCloud
@scottalanmiller, I found this post while researching. It was very helpful, but you missed a . in step 2. It should be
- cp -rp /data/. /extblock/
otherwise you get /extblock/data/***
Isn't that the goal?
No, steps 3 and 4 conflict. Either add the "." to step 3, or else change step 4 to:
ln -s /extblock/data /data
But that would put the data directly under /data, right? Is that what you want?
-
-
@scottalanmiller said in How to Migrate NextCloud Data Location:
@Donahue said in How to Migrate NextCloud Data Location:
@scottalanmiller said in How to Migrate NextCloud Data Location:
@Donahue said in How to Migrate NextCloud Data Location:
@scottalanmiller said in How to Migrate NextCloud Data Location:
So if you are like me, your NC data is stored in /data. This is the directory that will explode in size as you store things there.
So what we need to do is make a new place for the data to go, first of all. We will assume that your new block storage is already created and mounted as /extblock. If you are unsure how to mount the new storage in the first place, that's a good topic for a fresh post as it is not directly related to NextCloud and more just Linux general block mounting.
So now /data has the current data and /extblock has the big empty space.
-
Shut down NextCloud
-
cp -rp /data/ /extblock/
-
mv /data /data-old
This step preserves the old data just in case something has gone wrong. -
ln -s /extblock /data
And in theory that is it. You've copied everything from the old space to the new one, then made a link to make the new one look like the old one so that NC doesn't need to know that any of this happened. Of course, you can cd /data once all this is done and verify that it looks correct. -
Start NextCloud
@scottalanmiller, I found this post while researching. It was very helpful, but you missed a . in step 2. It should be
- cp -rp /data/. /extblock/
otherwise you get /extblock/data/***
Isn't that the goal?
No, steps 3 and 4 conflict. Either add the "." to step 3, or else change step 4 to:
ln -s /extblock/data /data
But that would put the data directly under /data, right? Is that what you want?
if the goal is to get it under just
/data
, then you want the "." but if the goal is to get the data under/data/data
then omit the "." as in the original instructions. -
-
@Donahue said in How to Migrate NextCloud Data Location:
@scottalanmiller said in How to Migrate NextCloud Data Location:
@Donahue said in How to Migrate NextCloud Data Location:
@scottalanmiller said in How to Migrate NextCloud Data Location:
@Donahue said in How to Migrate NextCloud Data Location:
@scottalanmiller said in How to Migrate NextCloud Data Location:
So if you are like me, your NC data is stored in /data. This is the directory that will explode in size as you store things there.
So what we need to do is make a new place for the data to go, first of all. We will assume that your new block storage is already created and mounted as /extblock. If you are unsure how to mount the new storage in the first place, that's a good topic for a fresh post as it is not directly related to NextCloud and more just Linux general block mounting.
So now /data has the current data and /extblock has the big empty space.
-
Shut down NextCloud
-
cp -rp /data/ /extblock/
-
mv /data /data-old
This step preserves the old data just in case something has gone wrong. -
ln -s /extblock /data
And in theory that is it. You've copied everything from the old space to the new one, then made a link to make the new one look like the old one so that NC doesn't need to know that any of this happened. Of course, you can cd /data once all this is done and verify that it looks correct. -
Start NextCloud
@scottalanmiller, I found this post while researching. It was very helpful, but you missed a . in step 2. It should be
- cp -rp /data/. /extblock/
otherwise you get /extblock/data/***
Isn't that the goal?
No, steps 3 and 4 conflict. Either add the "." to step 3, or else change step 4 to:
ln -s /extblock/data /data
But that would put the data directly under /data, right? Is that what you want?
if the goal is to get it under just
/data
, then you want the "." but if the goal is to get the data under/data/data
then omit the "." as in the original instructions.Which was the goal, hence why it was the way that it was.
-
-
why would you want to have
/data/data
? And if you were going to do this on purpose, why not make the link to/data/data
instead of just/data
? Unless I made a fundamental mistake or misunderstanding (possible), when I tried to follow your directions without the ".", I wound up with an extra/data
in the middle of the path when then should not have been one. -
@Donahue said in How to Migrate NextCloud Data Location:
why would you want to have
/data/data
? And if you were going to do this on purpose, why not make the link to/data/data
instead of just/data
? Unless I made a fundamental mistake or misunderstanding (possible), when I tried to follow your directions without the ".", I wound up with an extra/data
in the middle of the path when then should not have been one.I treat the top level /data as a universal. Every system that I use with broken out storage uses /data. Then whatever folders are needed are under that. That both the top level from me "/data" and the folder from the vendor "data" are similar is a happenstance overlap. I used both to keep a standarad.
-
@scottalanmiller said in How to Migrate NextCloud Data Location:
@Donahue said in How to Migrate NextCloud Data Location:
why would you want to have
/data/data
? And if you were going to do this on purpose, why not make the link to/data/data
instead of just/data
? Unless I made a fundamental mistake or misunderstanding (possible), when I tried to follow your directions without the ".", I wound up with an extra/data
in the middle of the path when then should not have been one.I treat the top level /data as a universal. Every system that I use with broken out storage uses /data. Then whatever folders are needed are under that. That both the top level from me "/data" and the folder from the vendor "data" are similar is a happenstance overlap. I used both to keep a standarad.
I see. It just seemed redundant.
-
@Donahue said in How to Migrate NextCloud Data Location:
@scottalanmiller said in How to Migrate NextCloud Data Location:
@Donahue said in How to Migrate NextCloud Data Location:
why would you want to have
/data/data
? And if you were going to do this on purpose, why not make the link to/data/data
instead of just/data
? Unless I made a fundamental mistake or misunderstanding (possible), when I tried to follow your directions without the ".", I wound up with an extra/data
in the middle of the path when then should not have been one.I treat the top level /data as a universal. Every system that I use with broken out storage uses /data. Then whatever folders are needed are under that. That both the top level from me "/data" and the folder from the vendor "data" are similar is a happenstance overlap. I used both to keep a standarad.
I see. It just seemed redundant.
I would use
/data/nextcloud/data
in this case -
@Donahue said in How to Migrate NextCloud Data Location:
@scottalanmiller said in How to Migrate NextCloud Data Location:
@Donahue said in How to Migrate NextCloud Data Location:
why would you want to have
/data/data
? And if you were going to do this on purpose, why not make the link to/data/data
instead of just/data
? Unless I made a fundamental mistake or misunderstanding (possible), when I tried to follow your directions without the ".", I wound up with an extra/data
in the middle of the path when then should not have been one.I treat the top level /data as a universal. Every system that I use with broken out storage uses /data. Then whatever folders are needed are under that. That both the top level from me "/data" and the folder from the vendor "data" are similar is a happenstance overlap. I used both to keep a standarad.
I see. It just seemed redundant.
Beyond standardization, it also has the benefit of allowing the mount point to go elsewhere and still appear as expected.
Keep in mind that there is no need for it to be /data/data, either one can be renamed anything that you want. You could make the mount be /phymount2 or you could make the second one into /data/ncstuff or whatever you want.
Because you are linking to the second level, the name to which you link need not be the same as what you call the link itself.