2

I made a separate partition for /home, but during installation process I forgot to mount it and hence no entry was made in fstab.

I had everything in partition under the root ( well not the swap and efi system partition). I realised what I did, very late and by that time I had already installed packages and wrote data in the home directory.

Now what I want to know is “is there any way possible to move my home directory to a separate partition with out losing any data?

I was thinking of doing something like mounting the root directory in /mnt and than mount a new partition(for home) in /mnt/home from a liveUSB and than generate the fstab.

But I am like 79% sure that this will wipe out my home directory.

SPEC: Arch Linux x86_64 latest kernel (5.0.4)

1 Answer 1

0

Because you already have an home partition, we should be able to do this with out a live OS.

  • mount the new home on /mnt
  • move files from old-home (/home), to new home (/mnt). (/home should now be empty).
  • remount new-home to /home (bind mount sudo mkdir -p /home && sudo mount --bind /mnt /home (you can also use --move, in place of --bind), or unmount then mount).

It is not as you want, but the mount is not persistent.

  • edit /etc/fstab (There may be tools to help you with this, I can't remember).
10
  • Will the installed packages turn out fine after this ? Because I have installed package in my home directory. Other files(music ,videos , text files ) will be okay I know , but the I am worried that this may render the environment variables of the software defunct. I am not sure though. Apr 6, 2019 at 10:09
  • You need to do the move as root, to ensure that ownership info is not lost. However because it will all end up back in /home the environment variable will be OK. Just don't use any of these files during he migration. Apr 6, 2019 at 10:15
  • what if instead of move , I do copy? just asking. I mean will original files be erased ? or I will end up with two home directory,? Apr 6, 2019 at 10:21
  • Did you mean cp. If so then the originals will remain, but will be covered by the mount. You can do this, and remove them (or not) latter. You can use a bind mount to mount this part of the root partition on to /mnt, when you want to see / remove them. Apr 6, 2019 at 10:24
  • I can mount the partition to home but cannot bind mount it. I think bind mount is not possible with partition? Apr 7, 2019 at 22:02

You must log in to answer this question.

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