Linux which disk is mounted

How do I find on which physical device a folder is located?

Specifically: I did sudo mkdir /work , and would like to verify it indeed sits on my harddrive and not mapped to some other drive. How do I check where this folder is physically located?

4 Answers 4

The df(1) command will tell you the device that a file or directory is on:

The first field has the device that the file or directory is on.

$ df /root Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda1 1043289 194300 795977 20% / 

If the device is a logical volume, you will need to determine which block device(s) the logical volume is on. For this, you can use the lvs(8) command:

# df /usr Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/orthanc-usr 8256952 4578000 3259524 59% /usr # lvs -o +devices /dev/mapper/orthanc-usr LV VG Attr LSize Origin Snap% Move Log Copy% Convert Devices usr orthanc -wi-ao 8.00g /dev/sda3(0) 

The last column tells you that the logical volume usr in the volume group orthanc ( /dev/mapper/orthanc-usr ) is on the device /dev/sda3 . Since a volume group can span multiple physical volumes, you may find that you have multiple devices listed.

Another type of logical block device is a md (Multiple Devices, and used to be called meta-disk I think) device, such as /dev/md2 . To look at the components of a md device, you can use mdadm —detail or look in /proc/mdstat

# df /srv Filesystem 1K-blocks Used Available Use% Mounted on /dev/md2 956626436 199340344 757286092 21% /srv # mdadm --detail /dev/md2 . details elided. Number Major Minor RaidDevice State 0 8 3 0 active sync /dev/sda3 1 8 19 1 active sync /dev/sdb3 

You can see that /dev/md2 is on the /dev/sda3 and /dev/sdb3 devices.

Читайте также:  Настройка samba oracle linux

There are other methods that block devices can be nested (fuse, loopback filesystems) that will have their own methods for determining the underlying block device, and you can even nest multiple layers so you have to work your way down. You’ll have to take each case as it comes.

Источник

How do I check where devices are mounted?

What is the command that lets me see what and where devices are mounted? I’m having trouble changing songs on my old iPod, and I have a feeling it’s because of the mount point.

3 Answers 3

There are at least three programs I know of that list device mount points:

    mount — mount a filesystem (used for general mount info too):

$ mount /dev/sda3 on / type ext4 (rw,errors=remount-ro) proc on /proc type proc (rw,noexec,nosuid,nodev) sysfs on /sys type sysfs (rw,noexec,nosuid,nodev) . /dev/mapper/lvmg-homelvm on /home type btrfs (rw,relatime,compress=lzo,space_cache) /dev/sda5 on /home/muru/arch type btrfs (rw,relatime,compress=lzo,space_cache) binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev) systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd) 
$ df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda3 30832636 11993480 17249912 42% / none 4 0 4 0% /sys/fs/cgroup . /dev/sda5 31457280 3948600 25396496 14% /home/bro3886/arch 
$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 465.8G 0 disk ├─sda1 8:1 0 100M 0 part ├─sda2 8:2 0 58.5G 0 part ├─sda3 8:3 0 30G 0 part / ├─sda4 8:4 0 1K 0 part ├─sda5 8:5 0 30G 0 part ├─sda6 8:6 0 339.2G 0 part │ └─lvmg-homelvm (dm-0) 252:0 0 1.2T 0 lvm └─sda7 8:7 0 8G 0 part [SWAP] sdb 8:16 0 931.5G 0 disk └─sdb1 8:17 0 931.5G 0 part └─lvmg-homelvm (dm-0) 252:0 0 1.2T 0 lvm 

Of these three, mount lists all the mountpoints, AFAICT. The others have their weaknesses.

Читайте также:  Change right directory linux

    findmnt suggested by @webwurst is now my favourite tool for the job. It’s a Swiss Army knife when it comes to output control (newer versions can output in JSON too):

$ findmnt / TARGET SOURCE FSTYPE OPTIONS / /dev/sda1 ext4 rw,relatime,errors=remount-ro,data=ordered $ findmnt / -no source /dev/sda1 $ findmnt / --json < "filesystems": [ ] > $ findmnt / --df SOURCE FSTYPE SIZE USED AVAIL USE% TARGET /dev/sda1 ext4 40.2G 25.8G 12.5G 64% / 

Источник

How to check which disk is mounted where? How to mount all spare disks?

How do I check whether my sdb and sdc drives is mounted? And if they are, where are they mounted? **What is GPT (GUID Partition Table) ? ** How do I check which disk is used and which disk is still a clean slate How can I mount all spare unused drives into a single directory? If not a single directory into separate directories in /media/ ? It’s strange because fdisk showed 5 physical disks but mount can only find 2:

gillin@mt:~$ mount /dev/sda1 mount: can't find /dev/sda1 in /etc/fstab or /etc/mtab gillin@mt:~$ mount /dev/sdb1 mount: can't find /dev/sdb1 in /etc/fstab or /etc/mtab gillin@mt:~$ mount /dev/sdc1 mount: can't find /dev/sdc1 in /etc/fstab or /etc/mtab gillin@mt:~$ mount /dev/sdd1 mount: according to mtab, /dev/sdd1 is already mounted on /media/2moretb mount failed gillin@mt:~$ mount /dev/sde1 mount: according to mtab, /dev/sde1 is already mounted on /media/shiny mount failed 

Using gparted, I’ve found sdb and sdc` but they’re unformatted and they looked unused but is it really safe to use it? My machine had a RAID 1/0 system but i’m not sure what is the specific settings. How to make sure that it’s safe to format sdb and sdc? Does the available space on the gparted ensure that? enter image description here enter image description here

Читайте также:  Linux php executable path

Источник

Оцените статью
Adblock
detector