3

I'm trying to create a new partition on my Linux system, my intent is to take a small amount of my /home filesystem and change the type for experimentation. I'm using OpenSuse 12.1 in a virtual box.

gparted shows I have the following partitions:

Partition   File System MountPoint   Size          Used
********************************************************
/dev/sda1   linux-swap               744.00MiB       ---
/dev/sda2   ext4        /             10.35GiB    5.16GiB
unallocated                            1.00MiB       ---
/dev/sda3   ext4        /home         28.92GiB   11.51GiB
unallocated                            1.00MiB       ---

I'm logged in a root and my cwd is /, when I try umount /home I get:

umount: /home: device is busy. (In some cases useful info about processes that use the device is found by lsof(8) or fuser(1))

When I run fuser -m /dev/sda3 I get a good sized list: 1 303 311 594 649 672 692 696 700 738 754 786...

running ps -e I can find these processes:

PID    TTY      TIME  CMD
1      ?    00:00:00  systemd
303    ?    00:00:00  systemd-stdout-
311    ?    00:00:00  udevd
594    ?    00:00:00  systemd-logind
649    ?    00:00:00  systemd-logind
672    ?    00:00:00  avahi-daemon
692    ?    00:00:00  acpid
700    ?    00:00:00  haveged
...

What I'm trying to figure out is how to proceed. I guess I can "force" the umount, but that seems like a bad idea. I can kill all of these processes, then do the umount, but I'm not sure that will work.

What other options do I have? How should I unmount the /home drive?

3 Answers 3

2

You should boot into a rescue session using a Linux CD, or you can drop to a lower runlevel using init. It is not a good idea to unmount your $HOME while logged in.

You might also be able to do this if you log in as root (actually log in, not su or sudo). That way the /home partition is not needed and you will be able to unmount it. You will still have to make sure no one is accessing it (see next paragraph) and unmount it manually.

Finally, a useful tool is lsof /dev/sda3 which will list the processes currently accessing that partition. To kill all processes listed by lsof (careful, this may crash your system, depending on the process, but if this happens you should be OK after a reboot), do this:

kill `lsof /dev/sda3 | awk '{print $2}'`
3
  • Since it's running in a virtual box, the CD becomes problematic. You might also be able to do this if you log in as root. That way the /home partition is not needed. I am logged in as root, which it was my intent to avoid problem this way, I'm trying to figure out why that doesn't work.
    – Mike
    Commented Jan 14, 2013 at 16:54
  • directly logged in as root. no FTP is running on the machine. Just issuing lsof prints a ton of crap, I suspect the problem is tied to the fact there are a number of logging mechanisms running (see my output of fuser in the question). But again... to kill them?
    – Mike
    Commented Jan 14, 2013 at 16:59
  • @Mike, The CD should not be a problem, see user1301428's comment. To kill all processes accessing /home, see my updated answer.
    – terdon
    Commented Jan 14, 2013 at 17:10
0

You have to be sure that no user is currently logged in in order to unmount a home partition. To do this you can either do that operation using a live distro, or you can try to login to your OS in console mode and login directly as root.

If you want to try this second option, you may find this question useful.

2
  • Yes, I am logged in as root, there is no one else on the system. If you can suggest how to use a "live distro" with Virtualbox I could give that a try.
    – Mike
    Commented Jan 14, 2013 at 16:56
  • 1
    @Mike you should simply select the iso file to boot from inside VirtualBox's preferences. Change the boot order of the VM in order to assign a higher priority to the CD boot and then, when you launch your VM it should automatically boot from CD. Commented Jan 14, 2013 at 16:59
0

Be sure to log out of any Vsphere client sessions to the VM. Both the standard and Web Based. Then use SSH to login with root and you should be able to umount the partition.

You must log in to answer this question.

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