Re: find device of a known mountpoint

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 31, 2017 at 11:00:24AM +0200, Rüdiger Meier wrote:
> $ truncate -s100M /tmp/img
> $ losetup /dev/loop0  /tmp/img
> $ mkfs.ext2  /dev/loop0
> 
> $ mkdir /tmp/mnt
> $ ln -s /tmp  /tmp/xyz/symlink
> 
> $ mount /dev/loop0 /tmp/xyz/symlink/mnt
> $ mount | grep loop
> /dev/loop0 on /tmp/mnt type ext2 ...
> 
> 
> I need a command which outputs "/dev/loop0" when "/tmp/xyz/symlink/mnt" is
> given.

  $ findmnt -no SOURCE /tmp/xyz/symlink/mnt
  /dev/loop0


Note that for bind mounts there is nothing like primary (original)
and secondary mountpoints. It's two ways to the same filesystem.

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux