* [gentoo-user] How to unmount bind-mounted /dev? @ 2011-04-29 23:42 Alex Schuster 2011-04-30 6:10 ` Thomas Ulrich Nockmann 0 siblings, 1 reply; 9+ messages in thread From: Alex Schuster @ 2011-04-29 23:42 UTC (permalink / raw To: gentoo-user Hi there! I want to shrink [*] a partition that holds a 32-bit Gentoo chroot. But I cannot unmount it, the device is busy because proc and /dev is bind-mounted there. And I cannot unmount this /dev, again, the device is busy: weird ~ # umount /32/dev umount: /32/dev: device is busy. (In some cases useful info about processes that use the device is found by lsof(8) or fuser(1)) lsof /32/dev gives a lot of stuff, the same that lsof /dev gives. lsof /proc also has some lines, but I had no problem unmounting /32/proc. I could remove the /32/dev entry from fstab and reboot, but I need the machine up at the moment, and I'm also curious why this is a problem. Maybe you know? [*] BTW, I just wrote a script so automatize this. It shrinks the file system, then reduces the logical volume. It also reduces the size of a LUKS crypto volume on the LVM. Enlarging also works, but that already is easy using lvresize, cryptsetup resize and resize2fs. Shrinking is more tricky though, you have to calculate the sizes, and things could break if the underlying partition is made too small. Wonko ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-user] How to unmount bind-mounted /dev? 2011-04-29 23:42 [gentoo-user] How to unmount bind-mounted /dev? Alex Schuster @ 2011-04-30 6:10 ` Thomas Ulrich Nockmann 2011-04-30 9:57 ` Alex Schuster 0 siblings, 1 reply; 9+ messages in thread From: Thomas Ulrich Nockmann @ 2011-04-30 6:10 UTC (permalink / raw To: gentoo-user On Saturday 30 April 2011 Alex Schuster wrote: [...] Hello, > weird ~ # umount /32/dev > umount: /32/dev: device is busy. > (In some cases useful info about processes that use > the device is found by lsof(8) or fuser(1)) try 'umount -l /32/de' Thomas ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-user] How to unmount bind-mounted /dev? 2011-04-30 6:10 ` Thomas Ulrich Nockmann @ 2011-04-30 9:57 ` Alex Schuster 2011-04-30 10:15 ` Alex Schuster 0 siblings, 1 reply; 9+ messages in thread From: Alex Schuster @ 2011-04-30 9:57 UTC (permalink / raw To: gentoo-user Thomas Ulrich Nockmann writes: > On Saturday 30 April 2011 Alex Schuster wrote: >> weird ~ # umount /32/dev >> umount: /32/dev: device is busy. >> (In some cases useful info about processes that use >> the device is found by lsof(8) or fuser(1)) > try 'umount -l /32/de' Cool, this does the trick! Thanks, Wonko ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-user] How to unmount bind-mounted /dev? 2011-04-30 9:57 ` Alex Schuster @ 2011-04-30 10:15 ` Alex Schuster 2011-04-30 23:22 ` Mark Shields 0 siblings, 1 reply; 9+ messages in thread From: Alex Schuster @ 2011-04-30 10:15 UTC (permalink / raw To: gentoo-user I just wrote: > Thomas Ulrich Nockmann writes: > >> On Saturday 30 April 2011 Alex Schuster wrote: > >>> weird ~ # umount /32/dev >>> umount: /32/dev: device is busy. >>> (In some cases useful info about processes that use >>> the device is found by lsof(8) or fuser(1)) >> try 'umount -l /32/de' > > Cool, this does the trick! But it does not help :( After unmounting /32/dev, I can finally unmount /32, but now the fsck fails: weird ~ # fsck -Cf /dev/mapper/32 fsck from util-linux 2.19 e2fsck 1.41.14 (22-Dec-2010) fsck.ext3: Device or resource busy while trying to open /dev/mapper/32 Filesystem mounted or opened exclusively by another program? lsof and fuser report nothing. I guess I will have to reboot then. Wonko ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-user] How to unmount bind-mounted /dev? 2011-04-30 10:15 ` Alex Schuster @ 2011-04-30 23:22 ` Mark Shields 2011-04-30 23:48 ` Alex Schuster 0 siblings, 1 reply; 9+ messages in thread From: Mark Shields @ 2011-04-30 23:22 UTC (permalink / raw To: gentoo-user [-- Attachment #1: Type: text/plain, Size: 943 bytes --] On Sat, Apr 30, 2011 at 5:15 AM, Alex Schuster <wonko@wonkology.org> wrote: > I just wrote: > > > Thomas Ulrich Nockmann writes: > > > >> On Saturday 30 April 2011 Alex Schuster wrote: > > > >>> weird ~ # umount /32/dev > >>> umount: /32/dev: device is busy. > >>> (In some cases useful info about processes that use > >>> the device is found by lsof(8) or fuser(1)) > >> try 'umount -l /32/de' > > > > Cool, this does the trick! > > But it does not help :( After unmounting /32/dev, I can finally unmount > /32, but now the fsck fails: > > weird ~ # fsck -Cf /dev/mapper/32 > fsck from util-linux 2.19 > e2fsck 1.41.14 (22-Dec-2010) > fsck.ext3: Device or resource busy while trying to open /dev/mapper/32 > Filesystem mounted or opened exclusively by another program? > > lsof and fuser report nothing. I guess I will have to reboot then. > > Wonko > > Try a lazy umount, or forced umount? # umount -f # umount -l [-- Attachment #2: Type: text/html, Size: 1433 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-user] How to unmount bind-mounted /dev? 2011-04-30 23:22 ` Mark Shields @ 2011-04-30 23:48 ` Alex Schuster 2011-05-01 7:54 ` Mick 0 siblings, 1 reply; 9+ messages in thread From: Alex Schuster @ 2011-04-30 23:48 UTC (permalink / raw To: gentoo-user Mark Shields writes: > On Sat, Apr 30, 2011 at 5:15 AM, Alex Schuster <wonko@wonkology.org > <mailto:wonko@wonkology.org>> wrote: > > I just wrote: > > > Thomas Ulrich Nockmann writes: > >> try 'umount -l /32/de' > > > > Cool, this does the trick! > > But it does not help :( After unmounting /32/dev, I can finally unmount > /32, but now the fsck fails: > > weird ~ # fsck -Cf /dev/mapper/32 > fsck from util-linux 2.19 > e2fsck 1.41.14 (22-Dec-2010) > fsck.ext3: Device or resource busy while trying to open /dev/mapper/32 > Filesystem mounted or opened exclusively by another program? > > lsof and fuser report nothing. I guess I will have to reboot then. > Try a lazy umount, or forced umount? > > # umount -f > # umount -l The lazy unmount was Thomas' hint already and worked, the partition is no longer mounted. But I cannot fsck it, it is still in use. cryptsetup luksClose works neither. It's no big trouble, but still I'm curious why this is. Wonko ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-user] How to unmount bind-mounted /dev? 2011-04-30 23:48 ` Alex Schuster @ 2011-05-01 7:54 ` Mick 2011-05-01 13:08 ` Alex Schuster 0 siblings, 1 reply; 9+ messages in thread From: Mick @ 2011-05-01 7:54 UTC (permalink / raw To: gentoo-user [-- Attachment #1: Type: Text/Plain, Size: 1428 bytes --] On Sunday 01 May 2011 00:48:38 Alex Schuster wrote: > Mark Shields writes: > > On Sat, Apr 30, 2011 at 5:15 AM, Alex Schuster <wonko@wonkology.org > > > > <mailto:wonko@wonkology.org>> wrote: > > I just wrote: > > > Thomas Ulrich Nockmann writes: > > >> try 'umount -l /32/de' > > > > > > Cool, this does the trick! > > > > But it does not help :( After unmounting /32/dev, I can finally > > unmount /32, but now the fsck fails: > > > > weird ~ # fsck -Cf /dev/mapper/32 > > fsck from util-linux 2.19 > > e2fsck 1.41.14 (22-Dec-2010) > > fsck.ext3: Device or resource busy while trying to open > > /dev/mapper/32 Filesystem mounted or opened exclusively by another > > program? > > > > lsof and fuser report nothing. I guess I will have to reboot then. > > > > Try a lazy umount, or forced umount? > > > > # umount -f > > # umount -l > > The lazy unmount was Thomas' hint already and worked, the partition is > no longer mounted. But I cannot fsck it, it is still in use. cryptsetup > luksClose works neither. > It's no big trouble, but still I'm curious why this is. > > Wonko Asking the obvious: could this message be there because this partition is still mounted? Did you check that this partition has been unmounted from all mount points, both original mount point and bind-mount? -- Regards, Mick [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-user] How to unmount bind-mounted /dev? 2011-05-01 7:54 ` Mick @ 2011-05-01 13:08 ` Alex Schuster 2011-05-01 14:42 ` Mick 0 siblings, 1 reply; 9+ messages in thread From: Alex Schuster @ 2011-05-01 13:08 UTC (permalink / raw To: gentoo-user Mick writes: > On Sunday 01 May 2011 00:48:38 Alex Schuster wrote: > > The lazy unmount was Thomas' hint already and worked, the partition is > > no longer mounted. But I cannot fsck it, it is still in use. cryptsetup > > luksClose works neither. > > It's no big trouble, but still I'm curious why this is. > Asking the obvious: could this message be there because this partition > is still mounted? I grepped /proc/mounts for it and saw no references. I'm pretty sure I did not overlook something. And it's already the second time I tried this, one month ago the same had happened, but I did not care about it then. > Did you check that this partition has been unmounted > from all mount points, both original mount point and bind-mount? The partition only has one mount point, but others were mounted inside it: /dev/mapper/32 on /32 type ext3 (rw,noatime) /dev on /32/dev type none (rw,bind) /proc on /32/proc type none (rw,bind) /home on /32/home type none (rw,bind,noatime) /var/portage on /32/var/portage type none (rw,bind,noatime) /var/portage has another file system inside for the portage tree. When I want to unmount /32/var/portage, I have to unmount /32/var/portage/tree first. All except /32/dev could be unmounted, for /32/dev I needed the -l option to mount. Then /32 itself could be unmounted. But things like fsck or 'cryptsetup remove' failed, /dev/mapper/32 was in use. Then I rebooted, but I had forgotten to save my changes to fstab, so all those things were again mounted. I tried again anyway, and this time there was no problem. I had to use umount -l for /32/dev again, and this time also for /32/proc (that was not necessary the last time), but after unmounting /32, I could fsck its partition and shrink it. I have no idea why it did not work the last times I tried. I'll try to reproduce this from time to time, maybe after some more uptime and work on this partition it will happen again. Wonko ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-user] How to unmount bind-mounted /dev? 2011-05-01 13:08 ` Alex Schuster @ 2011-05-01 14:42 ` Mick 0 siblings, 0 replies; 9+ messages in thread From: Mick @ 2011-05-01 14:42 UTC (permalink / raw To: gentoo-user [-- Attachment #1: Type: Text/Plain, Size: 2682 bytes --] On Sunday 01 May 2011 14:08:36 Alex Schuster wrote: > Mick writes: > > On Sunday 01 May 2011 00:48:38 Alex Schuster wrote: > > > The lazy unmount was Thomas' hint already and worked, the partition is > > > no longer mounted. But I cannot fsck it, it is still in use. cryptsetup > > > luksClose works neither. > > > It's no big trouble, but still I'm curious why this is. > > > > Asking the obvious: could this message be there because this partition > > is still mounted? > > I grepped /proc/mounts for it and saw no references. I'm pretty sure I did > not overlook something. And it's already the second time I tried this, one > month ago the same had happened, but I did not care about it then. > > > Did you check that this partition has been unmounted > > from all mount points, both original mount point and bind-mount? > > The partition only has one mount point, but others were mounted inside it: > > /dev/mapper/32 on /32 type ext3 (rw,noatime) > /dev on /32/dev type none (rw,bind) > /proc on /32/proc type none (rw,bind) > /home on /32/home type none (rw,bind,noatime) > /var/portage on /32/var/portage type none (rw,bind,noatime) > > /var/portage has another file system inside for the portage tree. When I > want to unmount /32/var/portage, I have to unmount /32/var/portage/tree > first. All except /32/dev could be unmounted, for /32/dev I needed the -l > option to mount. Then /32 itself could be unmounted. But things like fsck > or 'cryptsetup remove' failed, /dev/mapper/32 was in use. > > Then I rebooted, but I had forgotten to save my changes to fstab, so all > those things were again mounted. I tried again anyway, and this time there > was no problem. I had to use umount -l for /32/dev again, and this time > also for /32/proc (that was not necessary the last time), but after > unmounting /32, I could fsck its partition and shrink it. > > I have no idea why it did not work the last times I tried. I'll try to > reproduce this from time to time, maybe after some more uptime and work on > this partition it will happen again. Yes, you've done the right thing, unmounting directories from the lower to the higher, before you try to unmount the top of the tree. I would think that /dev and /proc would be accessed by the OS in real time, every time you read/write to a device/memory/acpi, etc. so trying to umount them could be more troublesome. Perhaps immediately after rebooting there was not much activity from previous actions and that's why you were able to unmount them without too much trouble. -- Regards, Mick [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-05-01 14:44 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-04-29 23:42 [gentoo-user] How to unmount bind-mounted /dev? Alex Schuster 2011-04-30 6:10 ` Thomas Ulrich Nockmann 2011-04-30 9:57 ` Alex Schuster 2011-04-30 10:15 ` Alex Schuster 2011-04-30 23:22 ` Mark Shields 2011-04-30 23:48 ` Alex Schuster 2011-05-01 7:54 ` Mick 2011-05-01 13:08 ` Alex Schuster 2011-05-01 14:42 ` Mick
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox