j-haog
Last Updated: February 25, 2016
·
796
· lotia
B9d7297223985ffafd0b1981b6cdcb28

Selective filesystem remount

Use case, I want to remount certain fileysystems with additional options enabled. I used this to enable acls on all mounted ext[34] filesystems.

for mntpnt in $(grep -v "none" /proc/mounts | grep -e "ext[34]" | cut -f2 -d ' '); do sudo mount -o remount,acl,noatime,defaults ${mntpnt}; done

Within the subshell, the first grep removes any lines with "none" in them, getting rid of filesystems that aren't a block device, the second one searches for ext3 or ext4, and the cut returns just the mount point, which is the second column in the space separated output.

The output of the subshell is passed to mount, which is remounting the filesystem using the remount option and adding any other options in the comma separated list. Note that there are no spaces after the commas.

Say Thanks
Respond

1 Response
Add your response

5193
D31bc8113ca672865c7308410cee1f86

Simple but effective :-).

over 1 year ago ·
Filed Under