esp /dev/sda1 vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro I wonder if it is mounted elsewhere as well? findmnt /dev/sda1 Now, as you can see, /dev/sda1 is mounted on /esp. The command you are asking about is findmnt (though lsblk might also serve): lsblk -f /dev/sda You can see Showing Only Interesting Mount Points/Filtering Non-Interesting Types or Listing Directories under / that are Not Under the Same Mountpoint for some example usage, but there's also a brief rundown below. awk -v needle="$device_path" '$1=needle ' In both files, the first whitespace-separated field contains the device path and the second field contains the mount point. proc/mounts is always up-to-date whereas /etc/mtab might not be if /etc was read-only at some point that wasn't expected by the boot scripts. The paths and options may be different, as /etc/mtab represents what mount passed to the kernel whereas /proc/mounts shows the data as seen inside the kernel. The mount program records similar information in /etc/mtab. Under Linux, you can get mount point information directly from the kernel in /proc/mounts. Printf '"%s" does not appear to be directly mounted\n' "$device" Printf '"%s" is mounted on "%s"\n' "$device" "$mountpoint" So: if mountpoint=$(findmnt -nr -o target -S "$device") then $ lsblk -o MOUNTPOINT -nr /dev/storage/homeĪbove findmnt does return with a failure exit status if the device is not mounted, not lsblk. To get the mountpoint only: $ findmnt -nr -o target -S /dev/storage/home That one is also useful to find all the file system mounted under a specific device (disk or partition.): $ lsblk /dev/sda2 Or lsblk (also from util-linux, since 2.19): $ lsblk /dev/VG_SC/home home /dev/mapper/VG_SC-home ext4 rw,relatime,errors=remount-ro,data=ordered On Linux, you can now use the findmnt command from util-linux (since version 2.18): $ findmnt -S /dev/VG_SC/home
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |