Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I use parted command to show free space in my hard disk?

cfdisk shows free space while parted -l doesnt show any free and unallocated space.

share|improve this question
graeme@graeme-laptop:~$ sudo parted -l /dev/sda
Model: ATA ST9250827AS (scsi)
Disk /dev/sda: 250GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End    Size   Type      File system     Flags
 2      1049kB  250GB  250GB  primary   ext4            boot
 1      250GB   250GB  537MB  extended
 5      250GB   250GB  537MB  logical   linux-swap(v1)
share|improve this answer

df -h
to show free and used space for every mounted partition

share|improve this answer
i want to know the size of unallocated space on the harddisk. df -h wont work here. – bhumika Jun 18 '10 at 9:32
Ah just a sfdisk -l <dev> or even a fdisk -l <dev> – Pier Jun 18 '10 at 10:21

(parted) print

Disk geometry for /dev/hda: 0.000-2445.679 megabytes
          Disk label type: msdos
          Minor    Start       End     Type      Filesystem  Flags
          1          0.031    945.000  primary   fat32       boot, lba
          2        945.000   2358.562  primary   ext2
          3       2358.562   2445.187  primary   linux-swap

(parted) print 1

          Minor: 1
          Flags: boot, lba
          File System: fat32
          Size:            945.000Mb (0%)
          Minimum size:     84.361Mb (0%)
          Maximum size:   2445.679Mb (100%)
share|improve this answer
Model: ATA WDC WD800JD-75MS (scsi) Disk /dev/sda: 80.0GB Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End Size Type File system Flags 1 32.3kB 32.2GB 32.2GB primary ntfs boot 2 32.2GB 53.7GB 21.5GB extended lba 5 32.2GB 36.4GB 4162MB logical ntfs 6 36.4GB 53.7GB 17.3GB logical ext2 3 53.7GB 79.0GB 25.3GB primary ext3 4 79.0GB 80.0GB 1012MB primary linux-swap(v1) this is the output of parted -l. i need to know the unallocated space on my harddrive. – bhumika Jun 18 '10 at 9:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.