7

I trying to merge my separate /home partition with my / partition in linux mint 13. I was told to umount /home, mount it on a different location and copy the contents to the /home directory on the / partition.

I have tried, but I cannot umount /home. When I try to do so, I get a message:

umount: /home device is busy (which processes use this device can be possibly be found with lsof or fuser)

How can I unmount my /home and mount it on a separate location (/dev/sda2/mnt/home) to be able to copy the contents to /home?

10

umount: /home device is busy

This means that you (or someone) is currently using files on the /home filesystem. The simplest solution is to have all normal users logout of the system and then log back in as root.

(You might need to configure the system to "Allow local system administrator login" in the Login Window application, Security tab.)

If umount still complains, then, as the error message states, have a look at the output of:

lsof /home

and,

fuser -mv /home

These commands will show you what processes have open files on the /home filesystem so you can go about closing them.

Note that something as seemingly innocent as having a terminal/console open with /home as the current working directory will cause /home to be in use and will stop umount /home.

  • how can I enable the system to 'allow local system administrator login' in mint? – DutchArjo May 10 '14 at 20:02
  • 1
    @DutchArjo According to this source, it should be under the Login Window application, Security tab. – John1024 May 10 '14 at 20:05
  • Hello @DutchArjo. On unix's lyke OS, you can go to single mode user using Ctrl Alt <F1-F6>. Once there, you can use root as login. Of course, you need to log out of another user accounts before. I hope this can help you! – slackmart May 10 '14 at 23:03
  • 2
    @sgmart, no, you go to single user mode either by using the 's' option when booting up, or init s or shutdown. Ctrl-alt-F1 just switches to the first text mode virtual terminal. I believe mint, like ubuntu, has the root account locked by default so this is the only way to log in as root ( you can't login as root on a virtual tty when not in single user mode ). – psusi May 11 '14 at 22:19
  • Ok, I'm glad to read this. I just can say login as root is the key here; then thanks @psusi, on resume: enable root login, got to virtual tty Ctrl Alt F4, login as root and proceed... – slackmart May 11 '14 at 22:40
2

Since the error message suggest that run lsof or fuser to show which process is using /home, you should try:

$ fuser -v /home/
                     USER        PID ACCESS COMMAND
/home:               root     kernel mount /home

With lsof the output can be longer.

The simple solution for you is trying to modify /etc/fstab to mount /home to different partition. Something like this:

/dev/sdb3    /home    ext4    defaults,noatime    0 2

Make sure to comment or remove old entry, restart and see the change.

1

Another thought is to reboot using the rescue disk, get a root shell, mount all the partitions and then do the cp -r of the old data to the new location, then do a sync and unmount all the partitions and reboot. BTW, you can also modify the /etc/fstab table to make things the way you want on the mounted root partiton (not the rescue /etc/fstab).

Reboot then after that and all is good.

1

I trying to merge my separate /home partition with my / partition in linux mint 13. I was told to umount /home, mount it on a different location and copy the contents to the /home directory on the / partition.

You can move your home directory to a new folder.

usermod -m -d /new_home/your_username your_username

You must do this to all of your users, after that, you can umount /home without problem.

1

it is solved. I was not logged properly I guess. Once the root login was enabled in the startup screen security settings I was able to umount /sda5. mounted /sda5 to /mnt/home and from there do

cp -va /mnt/home/* /home

Resized and everything else and have my /home now on the / partition.

Resizing had to be done by booting from gparted cdrom.

it's working fine now!

1

You undoubtedly have some processes that are using files in your home directory. All your processes probably have it as their working directory, for example. Your session manager may be logging to ~/.xsession-errors, and so on.

If you've already done the move

When you moved your home directory to a different filesystem, you copied the files and removed the old ones. But you can't make running processes switch to the new files (not unless they have a feature to do that).

You'll need to log out and back in. When you log in now, the processes will be using your new home directory.

You can see which processes are still using your old home directory (or anything else on the home filesystem) by running fuser /home or lsof /home. Once you kill these processes, you'll be able to unmount /home. You can use fuser -k /home to kill them all (carefully check what they are before doing this!).

Better way to do the move

Ideally, you should move your home directory while not logged in, because your running processes might want to save data (e.g. saving your current session) and some will use the file that they already have open. You can do the move by logging in on a text console (Ctrl+Alt+F1) and logging in as root (make sure you have a root password configured). Move the content of /home to a new directory, then unmount the empty filesystem and move the directories around:

mkdir /home.new
mv /home/* /home.new/
umount /home
rmdir /home.new
mv /home.new /home

Or you can move the /home mount:

mkdir /home.old
mount --move /home /home.old
mv /home.old/* /home/
umount /home.old
rmdir /home.old
1

I was having this problem in Google Compute engine, where I have setup /home as a separate partition.

In this case you can never log in as root, you must login as a user, then switch to root, so it was never possible to umount /home

My solution was to login as my normal user

ssh myuser@myvm

Then once inside I switched to root and closed my own session like this:

cd /
exec sudo su

First I went to the root folder in case my home folder complained about being in use. Then I replace my current bash session with a root session by prepending exec to sudo su

Now I could umount /home without issues.

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.