Linux View Hard Drive Partitions with fdisk and parted commands

by on November 1, 2007 · 5 comments· LAST UPDATED November 1, 2007

in , ,

Q. I'd like to see all the partitions on my scsi hard drives. Under Windows Disk manager shows exactly how space is allocated on the disk drivers and free space etc. How do I display hard drive partitions information?

A. You can use any one of the following command:
[a] fdisk command : Partition table manipulator for Linux
[b] GNU Parted : a partition manipulation program

fdisk -l command

To list the partition tables for the specified devices and then exit. If no devices are given, those mentioned in /proc/partitions (if that exists) are used i.e. it will try to display all partitions, enter:
$ sudo fdisk -l
OR
# fdisk -l
Output

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000f1a3e
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       12749   102400000    7  HPFS/NTFS
/dev/sda2           12750       24906    97651102+  83  Linux
/dev/sda3           24907       25149     1951897+  82  Linux swap / Solaris
/dev/sda4           25150       60802   286375936    f  W95 Ext'd (LBA)
/dev/sda5           25150       60802   286374912    7  HPFS/NTFS

GNU parted command

Pass print option to displays the partition table, enter:
$ sudo parted /dev/sda print
Output:

Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number  Start   End    Size    Type      File system  Flags
 1      1049kB  105GB  105GB   primary   ntfs         boot
 2      105GB   205GB  100GB   primary   ext3
 3      205GB   207GB  1999MB  primary   linux-swap
 4      207GB   500GB  293GB   extended               lba
 5      207GB   500GB  293GB   logical   ntfs
Information: Don't forget to update /etc/fstab, if necessary. 
TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 5 comments… read them below or add one }

1 Mohit Guleria July 1, 2008 at 8:45 am

Is there any day to day Linux Admin topic that you have left ;-)

Reply

2 Abhi August 13, 2010 at 3:02 pm

I’ve been facing this problem for some time and I guess i might get some help over here.

When partition is made or altered by Linux or Windows, it can easily be read by Linux but not if the partition table is altered by Linux (i.e. by making changes in partitions by Linux), it becomes unreadable by Windows.

Take the case of installing Windows XP or something on a box containing RHEL. When one tries to boot that system with a Windows XP cd for installing it, the setup hangs after showing something like – “Windows is checking you system configuration”. This happens because XP is unable to read partition Table entries made by Linux.

Now wipe out the entire MBR along with the Partition Table, XP boots okay showing the entire hard disk space as Unallocated Space.

Now i want to know if there is any workaround available for this problem. i.e Installing Windows on a box having RHEL installed on it. I dont want to remove RHEL every time before installing Windows for making it dual bootable.

Reply

3 suman January 19, 2011 at 9:33 am

Hi,
I have installed Redhat-5 in my system….
But cdwriter not mount….
Means when i run “mount /media/cdrecorder”, it is showing path not found….
I can go up to “cd /media”, then when i give “ls” command nothing is showing
Please support

Suman

Please support

Reply

4 SP June 6, 2011 at 5:03 am

Hi Suman

You just insert the CD or DVD then login into the root and type these commands

mount /dev/dvd /media mount /dev/cd /mnt
cd /media cd /mnt
ls /media ls /mnt

you can follow any one column..

Reply

5 Prashant August 24, 2012 at 9:53 am

I have a harddisk I installed ubuntu linux in it the harddisk space it 20 gb i instlled it in 10 gb with swap space now i wnat to see the remeaning space how could i see use it
please help??

Reply

Leave a Comment

Tagged as: , , , , , ,

Previous Faq:

Next Faq: