How To Wiki
Advertisement

This howto will display all the partition of all hard drives in your computer mounted or unmounted.

Tools[]

Methods[]

Using /proc/partitions[]

  1. Execute: cat /proc/partitions
    • or open it in any text editor,viewer or pager
  2. Example output:
major minor  #blocks  name
  3     0   40209120 hda
  3     1   24579418 hda1
  3     2      72292 hda2
  3     3    3092512 hda3
  3     4   12458407 hda4
  3    64   78150744 hdb
  3    65   78148161 hdb1
 22    64   30015216 hdd
 22    65   30009388 hdd1
 33     0   40146624 hde
 33     1   40146403 hde1
 33    64   19551168 hdf
 33    65   19551073 hdf1

Using df[]

The df command will only show you mounted partitions, but can give you useful information. See man df for the many useful options

Example output:

Filesystem              1K-blocks      Used Available Use% Mounted on
rootfs                  110993628  96457144   8978528  92% /
/dev/root               110993628  96457144   8978528  92% /
tmpfs                     1284140      2312   1281828   1% /run
rc-svcdir                    1024        84       940   9% /lib64/rc/init.d
cgroup_root                 10240         0     10240   0% /sys/fs/cgroup
udev                        10240         0     10240   0% /dev
shm                       1284140         4   1284136   1% /dev/shm
/dev/sda2                 1032088    438276    541384  45% /boot
192.168.2.2:/mnt/HD_a2/ 960404328 128027208 832377120  14% /mnt/dlink_nas_vol2

Using mount[]

The mount command will only show you mounted partitions, but will give you all the details of the mount

  • Execute: mount -l
  • Example output
rootfs on / type rootfs (rw)
/dev/root on / type ext4 (rw,noatime,user_xattr,barrier=1,data=ordered)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
rc-svcdir on /lib64/rc/init.d type tmpfs (rw,nosuid,nodev,noexec,relatime,size024k,mode=755)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
cgroup_root on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,relatime,size0240k,mode=755)
cpuset on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cset)
cpu on /sys/fs/cgroup/cpu type cgroup (rw,nosuid,nodev,noexec,relatime,cpu)
cpuacct on /sys/fs/cgroup/cpuacct type cgroup (rw,nosuid,nodev,noexec,relatimepuacct)
freezer on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatimereezer)
udev on /dev type tmpfs (rw,nosuid,relatime,size=10240k,mode=755)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620)
shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime)
/dev/sda2 on /boot type ext2 (rw,noatime)
usbfs on /proc/bus/usb type usbfs (rw,noexec,nosuid,devmode=0664,devgid=85)

Using fdisk[]

  • Execute: fdisk -l
    • you may have to run this as root
  • Example output
Disk /dev/sda: 160.0 GB, 159998918144 bytes
255 heads, 63 sectors/track, 19452 cylinders, total 312497887 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: 0x56fcd9b7

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048    83888127    41943040    7  HPFS/NTFS/exFAT
/dev/sda2        83888128    85985279     1048576   83  Linux
/dev/sda3        85985280    90179583     2097152   82  Linux swap / Solaris
/dev/sda4        90179584   312497886   111159151+  83  Linux

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 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: 0xa8cdaecb

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1              63     1060289      530113+  82  Linux swap / Solaris
/dev/sdb2         2088450  1953520064   975715807+  83  Linux
/dev/sdb4         1060290     2088449      514080   83  Linux

Partition table entries are not in disk order

Disk /dev/sdc: 4095 MB, 4095737344 bytes
241 heads, 62 sectors/track, 535 cylinders, total 7999487 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: 0x20202020

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1              63      160649       80293+   0  Empty
/dev/sdc2          160656     7999486     3919415+   b  W95 FAT32

Using blkid[]

  • Execute: blkid
    • you may have to run this as root
  • Example output
/dev/sda1: UUID="2C3822FE3822C6A4" TYPE="ntfs" 
/dev/sda2: UUID="0f6a17c9-a7d4-48eb-8740-f54c624121f3" TYPE="ext2" 
/dev/sda3: UUID="8b083002-4f78-4b6f-8fd7-7d8bbcbd1b6c" TYPE="swap" 
/dev/sda4: UUID="29127f13-f7e4-4189-b3e6-efa2f7ad9dca" TYPE="ext4" 
/dev/sdb1: TYPE="swap" 
/dev/sdb2: UUID="47cb8357-ddf6-42ea-9c64-9add6c49a157" TYPE="ext2" 
/dev/sdb4: UUID="3d352bc0-4936-42f0-a8f6-8235d89c02e2" TYPE="ext2" 
/dev/sdc2: LABEL="VAMPIRE HAR" UUID="B0EC-1054" TYPE="vfat" 


Using lsblk[]

  • Execute: lsblk
  • Example output
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0   149G  0 disk 
├─sda1   8:1    0    40G  0 part 
├─sda2   8:2    0     1G  0 part /boot
├─sda3   8:3    0     2G  0 part [SWAP]
└─sda4   8:4    0   106G  0 part /
sdb      8:16   0 931.5G  0 disk 
├─sdb1   8:17   0 517.7M  0 part 
├─sdb2   8:18   0 930.5G  0 part 
└─sdb4   8:20   0   502M  0 part 
sdc      8:32   1   3.8G  0 disk 
├─sdc1   8:33   1  78.4M  0 part 
└─sdc2   8:34   1   3.8G  0 part 


Related[]

From HowTo Wiki, a Wikia wiki.

Advertisement