I am running into an issue moving my /home folder from my SSD to an external HDD. I have a dual boot of linux and windows on the SSD and I am running out of space, so I want to move the /home partition to the external drive.

I am following this guide: https://www.maketecheasier.com/move-home-folder-ubuntu/

I have followed the first few steps:

  1. Created a temp home folder at /media/home and on fstab I gave it the UUID of the external partition. This worked fine, I can see this folder with the right size.

  2. I used rsync to copy all the files from /home to /media/home

I run into an issue at this point, I am not able to relocate my /home directory into /home_backup. It tells me that the device or resource is busy. So I looked it up and came to this similar question:

mv: cannot move `/home' to `/old_home': Device or resource busy

Now, reading the first answer and it says that if your /home is it's own partition (which is the case for me) you should ignore that step and comment out the current home paritition in fstab, or the new one will never be mounted.

Is this correct? the next answer says to log out and go on a virtual terminal, run as sudo -i and check lsof -n | grep '/home' to make sure that nothing is open. In my case it lists bash and sudo.

Maybe I'm being too careful, but I need the computer working for university and can't be slowed down by bricking my laptop. Can someone clear up what the right process is? I don't see how I can just mount my new partition at /home, and comment out the currnet partition in fstab while I am actively in the current partition. Especially if what I tried above tells me that sudo and bash are running out of the current /home/username.

Don't know if that makes sense, but hopefully someone can clear this up for me.

  • 1
    does this help answer your question>? maketecheasier.com/move-home-folder-ubuntu – 24601 Feb 8 '20 at 19:40
  • 3
    If you separately mounted it at /media, then you may have a conflict. See these instructions: help.ubuntu.com/community/Partitioning/Home/Moving – oldfred Feb 8 '20 at 19:40
  • I used the instructions linked by @oldfred when I did this years ago. – Organic Marble Feb 9 '20 at 2:26
  • @OrganicMarble Did you have your /home as a separate partition before following that process? I am not able to follow that exactly, because I cannot change /home to /home_old, as it tells me it is busy. – leonardo Feb 9 '20 at 13:47
  • No, moving my /home to a separate partition is the reason I did that procedure. When I started it was under / – Organic Marble Feb 9 '20 at 13:48

Here is a possibility.

Create a bootable Linux thumb drive. Here is an article https://www.cnet.com/how-to/what-to-do-with-your-usb-flash-drive-run-linux/

Boot from the thumb drive.

Mount the hard drive under media.

Use "sudo su" to become root.

You should now be able to rename the /home directory.

Shutdown and reboot from your hard disk.

If you set up your fstab correctly it should work.

If not, you may have difficulty logging in because there is no /home available.

In that unfortunate case you need to go back through the procedure and undo the rename.

You might consider a second option.

If your disk usage under /home is all down one or two directories, you might leave home in place and instead put in links to copies of those directories.

This leaves other user names in place and may be easier to trouble shoot.

Mike G.

  • I will try this later today after I'm done with some work. So basically I should do this from the external media, in that case nothing should be open from the /home directory in my SSD. – leonardo Feb 9 '20 at 9:30
  • I have my current home at /home and the new one I want mounted at /media/home. The second link I shared recommended to simply go to fstab, comment out the line where my /home partition in the SSD is mounted and then add the line mounting the HDD partition at /home. Would this break something? or when I reboot it'll simply be using the correct partition? then in this case it seems like it wouldn't matter the name of the current /home folder since it'd be in a partition that wouldn't get mounted anyways? don't know if that makes sense – leonardo Feb 9 '20 at 9:37

Do Mike's answer with one more step... after the mv create an empty /home. The guide says to do it too. I think it's needed for the mount to work.

(I would have commented on Mike's answer but I don't have the reputation to do it)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.