How to list all drives and their file systems on Linux

Non-Datatex Product Support.
General support issues on PCs and Servers that is related to Datatex products.

Moderators: Leon van Heerden, Luanda_Junzi

How to list all drives and their file systems on Linux

Postby Leon van Heerden » Fri Dec 09, 2011 8:38 am

There are a couple commands to list the available drives on Linux.

  1. The proc partitions file
    Running the following command will list all the drives and partitions that were detected on Linux.
    Code: Select all
    cat /proc/partitions


    The output will look something like this:
    Code: Select all
    major minor  #blocks  name

       8        0  488386584 sda
       8        1  486296576 sda1
       8        2          1 sda2
       8        5    2086912 sda5
       8       16  244198584 sdb
       8       17  244196032 sdb1

    Where the "sda" list the first SATA drive and the size in bytes.
    The "sda1" is the first partition and it's size in bytes and so on.
    The "sdb" is the second drive and the "sdb1" is the first partition on the second drive.
    Now that you know which drives are listed, you can use the cfdisk command to determine the file system on the partitions.

  2. fdisk "note this can be dangerous if you write the incorrect settings"
    If you run the following command, you will see the drive's listed partitions and what file systems are on them.
    Note that you just use the drive, no partition numbers.
    Code: Select all
    fdisk /dev/sdb

    Press "p" to print the list of partitions.

    The output should look like this:
    Code: Select all
    root@servername:~/# fdisk /dev/sdb

    Command (m for help): p

    Disk /dev/sdb: 250.1 GB, 250059350016 bytes
    255 heads, 63 sectors/track, 30401 cylinders
    Units = cylinders of 16065 * 512 = 8225280 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       30401   244196032    c  W95 FAT32 (LBA)

    Command (m for help):


    The "System" column will show the listed file system for each partiton.
    Press "q" to quit this program.
----
Leon van Heerden
http://www.datatex.co.za
Leon van Heerden
 
Posts: 332
Joined: Fri Oct 29, 2010 11:21 am
Location: Cape Town

Return to General Support

Who is online

Users browsing this forum: No registered users and 1 guest