0

I run ubuntu 16.04 on sdc, with a home directory of some 156Gb. I recently installed Ubuntu 17.04 on sda. I want to use the home directory on sdc as my home directory on sda, but there is only 50 Gb free space available, so copying from sdc to sda is not an option. Is there some way to redirect the home directory on sda to the one on sdc, in such way that it becomes automaticly my home directory on sda when starting ubuntu 17.04?

2

1 Answer 1

1

If your home directory is a separate partition (a scheme I prefer for exactly this reason), mounted to /home in your 16.04 installation, it should be as simple as using the same device/UUID in /etc/fstab of your 17.04 installation, provided the UID of your user(s) are identical in both systems.

If you don't use separate partitions (yet), things get a bit more complicated. The (recommended) long-term solution would be to create one for your home, but if you don't have enough spare disk space you'll first have to archive your files somewhere, shrink the 16.04 partition, create a new one for /home and restore your files there.

You could get around that by moving the remaining 16.04 RootFS excluding /home into a new partition, which may be significantly smaller and fit e. g. on sda, but this requires some non-trivial adaption of /etc/fstab, and perhaps other stuff (grub etc.).

A (not very nice) hack for the "all on one partition" case would be to mount your 16.04 partition to some mountpoint (e. g. /mnt/ubuntu16.04) and set a symbolic link from /home to /mnt/ubuntu16.04/home. Be aware that this makes your complete 16.04 installation accessible from 17.04, which may result in unwanted manipulations.

If the UIDs differ on both systems you should first create the users on 17.04 using the same UIDs as in 16.04.

2
  • Murphy, thanks for your suggestions. I will try separate partition approach on sdc, because its has still 500Gb available and then modify fstab in my 17.04 on sda. Should I remove the current home directory on sda also?
    – jfh
    Sep 4, 2017 at 14:53
  • Not before you're sure you don't need it anymore. You can simply mount the separate partition over an existing directory, in which case you don't see the original content. But yes, in the end you should remove it and reuse the space, because the original content gets dated. When manipulating partitions, think of backups, and keep a rescue system disk/drive handy!
    – Murphy
    Sep 4, 2017 at 14:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .