Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

umount --all-targets only unmounts partitions not all partitions on a device #672

Closed
ProBackup-nl opened this issue Jul 30, 2018 · 1 comment

Comments

@ProBackup-nl
Copy link

Having /dev/sdb2 mounted in /mnt/sdb2,
and having read comment 1 from the year 2013 for bug 916216, especially the code sample:

for pid in $(ps --no-headers -xao pid); do 
   nsenter -t $pid umount --recursive --all-targets /dev/sdb
done

I would have expected "umount from util-linux 2.32.1 (libmount 2.32.1: btrfs, assert, debug)" option --all-targets to function when a device without partition number is specified.

Actual result:

# mount /dev/sdb2 /mnt/sdb2
# umount --recursive --all-targets /dev/sdb
umount: /dev/sdb: not mounted

Expected result:

# umount --recursive --all-targets /dev/sdb
[root@d2 ~]# lsblk /dev/sdb2
NAME MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sdb2   8:18   1 28.7G  0 part

Note: even the code sample above doesn't result in all partitions on /dev/sdb to get unmounted.

Is my expectation wrong?

PS Otherwise it would be nice to have a -quiet or -noerror flag, so one can execute
# umount --recursive --all-targets /dev/sdb*
without the "not mounted" output:

umount: /dev/sdb: not mounted
umount: /dev/sdb1: not mounted
@ProBackup-nl ProBackup-nl changed the title umount --all-targets only unmounts partitions not devices umount --all-targets only unmounts partitions not all partitions on a device Jul 30, 2018
@karelzak
Copy link
Collaborator

karelzak commented Aug 1, 2018

Unfortunately your expectation is wrong. The command umount has no clue about whole-disk and partitions concept. It works with individual block devices only. The solution is to use sdb*.

The options -quiet seems like good idea -- I'll implement it.

karelzak added a commit that referenced this issue Aug 1, 2018
The command umount supports things like --all-targets and --recursive
to umount all nodes in specified tree. Sometimes it makes sense to
aggressively use wildcards like /dev/sdb* and in this case --quiet
seems like a good choice

	umount --quiet --all-targets /dev/sdb*

to suppress 'not mounted' error messages. The new option suppress only
these error messages and nothing else.

Addresses: #672
Signed-off-by: Karel Zak <kzak@redhat.com>
@karelzak karelzak closed this as completed Aug 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants