Moving $HOME to a separate data partition?

Bo Berglund bo.berglund at gmail.com
Thu Oct 14 14:48:39 UTC 2021


On Wed, 13 Oct 2021 23:26:00 +0200, Bo Berglund <bo.berglund at gmail.com> wrote:

>On Wed, 13 Oct 2021 20:59:06 +0200, Bo Berglund <bo.berglund at gmail.com> wrote:
>
>>But I am not sure if I should just rsync the whole $HOME dir as is and then
>>mount it to /home/bosse in fstab.
>>
>>With *all* of the home dir on the data partition as one entity mounted to the
>>/home/bosse dir I would not have to go through the hooplas like above.
>>
>>If I keep the overall file structure the same as now even though the data has
>>changed partition, will then things like the nfs and samba shares I have
>>configured still work if the roots are "in place" albeit being mounted from
>>another partition?
>
>Replying to self:
>-----------------
>After considering all of the issues in my original post and reading this howto
>for moving the home dir:
>https://www.maketecheasier.com/move-home-folder-ubuntu/
>
>I decided to do just that.
>
>It will result in my home dir looking exactly like before and everything in the
>same place in the file system, but with all of the data occupying the bulk of
>disk space relocated to a separate partition.
>
>I am just now waiting for the rsync step to finish, it will take some time
>because we are talking about circa 150 GiB of data.
>An hour or two at least on this slow machine with source and destination on the
>same physical (2010 vintage mechanical) drive also slowing down the process.
>The DParted operations last night took 1-2 hours for shrinking partitions and
>copying content from one drive to the other.
>
>We'll see tomorrow how it plays out.
>I am hopeful.

But it totally failed!

The target drive had free space of 258 GiB and the size of $HOME was 178 GiB so
it should fit (I have today pruned it down further to 153 GiB).

Yet when I inspected the result of the overnight rsync it had filled the target
drive to 100%!

I suspect that the rsync command showed on the webpage I linked to is incorrect!

sudo rsync -aXS /home/. /media/home/.

Maybe instead of *copying* the symbolic links in my home it *followed* the
symlinks and wound up duplicating video files all over the place.
But I don't know, hard to understand.

Not what I had expected...
So the target disk was exhausted. :(

Or else some other thing happened which made rsync pull way too much files over.

Another issue that surfaced during this examination:
Most of my symlinks are absolute and reference files inside $HOME, this is not
good either because such links do not survive folder renames.

So I have now searched for all links below $HOME and changed them to relative
paths instead.

Now what?

I have worked all day to clean up the mess and convert my absolute symlink paths
to relative so they will not point outside of the mounted drive.


1) Erase all of the content of the target partition.
Can this be done with a quick format like you can on Windows, or do I have to
wait forever?
If so what is the best way to proceed?

I don't want to wipe the data, just free the disk space so it can be used for
new data by rsync.
When I google people are talking about protecting privacy and the like so there
is loads of suggestions how to wipe the disk clean.
I just want to free up space for new files....

Is this what I want:
bosse at ubuntuserv:/mnt/extdisk$ rm -r bosse/


2) Make another attempt at copying the /home folder to the data drive.
What rsync or other command should I use?

Current sizes:

$ sudo du -sh /home/bosse/
153G    /home/bosse/

$ sudo du -sh /mnt/extdisk/bosse/
258G    /mnt/extdisk/bosse/

So there should be 100+ GiB free space *after* the copy, right?

Assume the partition is now mounted on /mnt/extdisk

When I do an ls -la on the external drive it comes up with most of the same
stuff as on $HOME, except for these:

/mnt/extdisk/bosse$ ll
total 2580
drwxr-xr-x 24 bosse bosse    4096 2021-10-13 19:53 .
drwxr-xr-x  3 root  root     4096 2018-01-30 01:01 ..
-rw-r--r--  1 root  root       66 2019-08-10 09:43 .selected_editor
drwxr-xr-x  3 root  root     4096 2021-10-13 22:20 test
drwx------  2 root  root     4096 2021-10-13 22:32 vievc
drwx------  2 root  root     4096 2021-10-13 22:32 websvn
drwx------  2 root  root     4096 2021-10-13 22:32 www

Everything else seems to be the same as on the source.

If I check the size of test it comes up as 240 GiB!!!!


-- 
Bo Berglund
Developer in Sweden





More information about the ubuntu-users mailing list