Howto Get the Hard Disk Size Under Linux?

August 18, 2009 Category: Uncategorized

A: There is no single tool for this job, but it seems that Fdisk is just fine:

server:~# fdisk -l 2> /dev/null | grep Disk | grep -v identifier

Disk /dev/sda: 500.0 GB, 500028145664 bytes

Disk /dev/sdb: 500.0 GB, 500028145664 bytes

Disk /dev/sdc: 1000.1 GB, 1000123400192 bytes

Disk /dev/sdd: 500.0 GB, 500028145664 bytes

Disk /dev/sde: 500.0 GB, 500028145664 bytes

Disk /dev/hda: 80.0 GB, 80026361856 bytes

Disk /dev/md5: 1500.0 GB, 1500084240384 bytes

The nice thing about using fdisk is that it automatically lists the size of all block devices.

Here is a list of my NAS, mentioned earlier.

Beast:~# fdisk -l 2> /dev/null | grep Disk | grep -v identifier

Disk /dev/sda: 60.0 GB, 60011642880 bytes

Disk /dev/sdb: 60.0 GB, 60011642880 bytes

Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes

Disk /dev/sdd: 1000.2 GB, 1000204886016 bytes

Disk /dev/sde: 1000.2 GB, 1000204886016 bytes

Disk /dev/sdf: 1000.2 GB, 1000204886016 bytes

Disk /dev/md0: 57.9 GB, 57996345344 bytes

Disk /dev/md1: 2015 MB, 2015100928 bytes

Disk /dev/sdg: 1000.1 GB, 1000123400192 bytes

Disk /dev/sdh: 1000.1 GB, 1000123400192 bytes

Disk /dev/sdi: 1000.1 GB, 1000123400192 bytes

Disk /dev/sdj: 1000.1 GB, 1000123400192 bytes

Disk /dev/sdk: 1000.1 GB, 1000123400192 bytes

Disk /dev/sdl: 1000.1 GB, 1000123400192 bytes

Disk /dev/sdm: 1000.1 GB, 1000123400192 bytes

Disk /dev/sdn: 1000.1 GB, 1000123400192 bytes

Disk /dev/sdo: 1000.1 GB, 1000123400192 bytes

Disk /dev/sdp: 1000.1 GB, 1000123400192 bytes

Disk /dev/sdq: 1000.1 GB, 1000123400192 bytes

Disk /dev/sdr: 1000.1 GB, 1000123400192 bytes

Disk /dev/sds: 1000.1 GB, 1000123400192 bytes

Disk /dev/sdt: 1000.1 GB, 1000123400192 bytes

Disk /dev/sdu: 1000.1 GB, 1000123400192 bytes

Disk /dev/sdv: 1000.1 GB, 1000123400192 bytes

Disk /dev/md5: 18002.2 GB, 18002220023808 bytes

Comments