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

17,509

Solution 1

How do I check whether my sdb and sdc drives is mounted? And if they are, where are they mounted?

To find out what drives are mounted you can check /etc/mtab, which is a list of all devices mounted on the system. It can sometimes have various tmpfs and other things you aren't looking for mounted too, so I reccomend cat /etc/mtab | grep /dev/sd to get only physical devices.

As you showed in your answer df also works, if it doesn't show up in df, it's not mounted.

How can I mount all spare unused drives into a single directory? If not a single directory into separate directories in /media/?

The file /etc/fstab contains a list of drives on the system and rules for when, how and where to mount them. when you type in mount /dev/sda1 mount checks fstab for info on how to mount the disk. mount: can't find /dev/sdc1 in /etc/fstab or /etc/mtab means that mount didn't find a line in mtab for the disk, not that it failed to find the disk itself.

You can make mount not look in fstab by specifying where to mount the drive yourself, as in mkdir /media/sdb1; mount /dev/sdb1 /media/sdb1

If you edit fstab to add entries for your spare drives, you can make your spare drives mount at boot.

You can install pysdm to make writing entries in /etc/fstab easy.

How do I check which disk is used and which disk is still a clean slate[?]

The best way would probably be to try to mount any partitions on it and look at the data. based on the screenshots from gparted /dev/sdb1 and /dev/sdc1 look to be formatted and have data on them. Gparted doesn't have anything in the "Space Used" column for unformatted drives, because you can't use space on an unformatted drive.

What is a GPT?

It's a header at the beginning of a disk that describes where the different partitions on the disk begin and end, and some metadata about them. It supersedes and maintains some compatibility with an older format for this task called MBR(Master Boot Record).

Solution 2

mount views all currently mounted disks. You can use mount /dev/sdXY /mnt/DISK to manually mount disks wher X stands for the disk number and Y is the partition number and "DISK" is the mount point. This "DISK" directory should be different for each disk and shoul exist before mounting

Share:
17,509

Related videos on Youtube

alvas
Author by

alvas

食飽未?

Updated on September 18, 2022

Comments

  • alvas
    alvas over 1 year

    Doing a df -h:

    alvas@mt:~$ df -h
    Filesystem      Size  Used Avail Use% Mounted on
    /dev/sda2       3.5T  2.7T  597G  83% /
    none            4.0K     0  4.0K   0% /sys/fs/cgroup
    udev             63G   12K   63G   1% /dev
    tmpfs            13G  1.8M   13G   1% /run
    none            5.0M     0  5.0M   0% /run/lock
    none             63G   72K   63G   1% /run/shm
    none            100M   20K  100M   1% /run/user
    /dev/sdd5       1.8T 1005G  718G  59% /media/2tb
    /dev/sdd1       1.9T  1.2T  531G  70% /media/2moretb
    /dev/sde1       1.9T  214G  1.7T  12% /media/shiny
    

    And then a sudo fdisk -l:

    alvas@mt:~$ sudo fdisk -l
    
    WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.
    
    
    Disk /dev/sda: 4000.2 GB, 4000225165312 bytes
    255 heads, 63 sectors/track, 486333 cylinders, total 7812939776 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1               1  4294967295  2147483647+  ee  GPT
    
    WARNING: GPT (GUID Partition Table) detected on '/dev/sdc'! The util fdisk doesn't support GPT. Use GNU Parted.
    
    
    Disk /dev/sdc: 4000.2 GB, 4000225165312 bytes
    255 heads, 63 sectors/track, 486333 cylinders, total 7812939776 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdc1               1  4294967295  2147483647+  ee  GPT
    
    Disk /dev/sdd: 4000.2 GB, 4000225165312 bytes
    255 heads, 63 sectors/track, 486333 cylinders, total 7812939776 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x0003bd79
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdd1      3865466880  7812939775  1973736448   83  Linux
    /dev/sdd2          501758  3865466879  1932482561    5  Extended
    /dev/sdd5          503808  3865466879  1932481536   83  Linux
    
    Partition table entries are not in disk order
    
    WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.
    
    
    Disk /dev/sdb: 4000.2 GB, 4000225165312 bytes
    255 heads, 63 sectors/track, 486333 cylinders, total 7812939776 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1               1  4294967295  2147483647+  ee  GPT
    
    Disk /dev/sde: 2000.4 GB, 2000365289472 bytes
    255 heads, 63 sectors/track, 243197 cylinders, total 3906963456 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x2ae33383
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sde1            2048  3906963455  1953480704    7  HPFS/NTFS/exFAT
    alvas@mt:~$ 
    alvas@mt:~$ df -h
    Filesystem      Size  Used Avail Use% Mounted on
    /dev/sda2       3.5T  2.7T  597G  83% /
    none            4.0K     0  4.0K   0% /sys/fs/cgroup
    udev             63G   12K   63G   1% /dev
    tmpfs            13G  1.8M   13G   1% /run
    none            5.0M     0  5.0M   0% /run/lock
    none             63G   72K   63G   1% /run/shm
    none            100M   20K  100M   1% /run/user
    /dev/sdd5       1.8T 1005G  718G  59% /media/2tb
    /dev/sdd1       1.9T  1.2T  531G  70% /media/2moretb
    /dev/sde1       1.9T  214G  1.7T  12% /media/shiny
    alvas@mt:~$ sudo fdisk -l
    
    WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.
    
    
    Disk /dev/sda: 4000.2 GB, 4000225165312 bytes
    255 heads, 63 sectors/track, 486333 cylinders, total 7812939776 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1               1  4294967295  2147483647+  ee  GPT
    
    WARNING: GPT (GUID Partition Table) detected on '/dev/sdc'! The util fdisk doesn't support GPT. Use GNU Parted.
    
    
    Disk /dev/sdc: 4000.2 GB, 4000225165312 bytes
    255 heads, 63 sectors/track, 486333 cylinders, total 7812939776 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdc1               1  4294967295  2147483647+  ee  GPT
    
    Disk /dev/sdd: 4000.2 GB, 4000225165312 bytes
    255 heads, 63 sectors/track, 486333 cylinders, total 7812939776 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x0003bd79
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdd1      3865466880  7812939775  1973736448   83  Linux
    /dev/sdd2          501758  3865466879  1932482561    5  Extended
    /dev/sdd5          503808  3865466879  1932481536   83  Linux
    
    Partition table entries are not in disk order
    
    WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.
    
    
    Disk /dev/sdb: 4000.2 GB, 4000225165312 bytes
    255 heads, 63 sectors/track, 486333 cylinders, total 7812939776 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1               1  4294967295  2147483647+  ee  GPT
    
    Disk /dev/sde: 2000.4 GB, 2000365289472 bytes
    255 heads, 63 sectors/track, 243197 cylinders, total 3906963456 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x2ae33383
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sde1            2048  3906963455  1953480704    7  HPFS/NTFS/exFAT
    

    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

  • mgutt
    mgutt over 3 years
    I use Unraid and no command works for me. /etc/mtab contains only the usb flash drive. /etc/fstab contains nothing useful at all. And simply executing mount lists only mounts to /dev/mdX but not the correlation to sdX. The same is valid for lsblk (it lists sdX devices, but not correlation, too). Not sure if this related to Unraid or the underlying Slackware.