Linux View Hard Drive Partitions with fdisk and parted commands

by on November 1, 2007 · 7 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!

{ 7 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

6 vikash July 26, 2014 at 8:27 pm

i have installed ubuntu linux in 23gb partition of my laptop but after installation grub is not showing windows 7 to boot and ubuntu not showing other drives. i already have tried “boot repair”. now i dont know what to do and how to save my data?
need help.

Model: ATA WDC WD3200BEVT-6 (scsi)
Disk /dev/sda: 320GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 1049kB 18.1GB 18.1GB primary ext4 boot
2 18.1GB 22.1GB 3999MB extended
5 18.1GB 22.1GB 3999MB logical linux-swap(v1)

Reply

7 Abhi September 14, 2014 at 5:37 pm

Hi Vikash,

If you had not removed windows partitions while installing Ubuntu, then your windows partitions should be intact.

Don’t panic, its easy accessing windows partitions and the files and folders within them from Ubuntu (But not the other way around ;D not at-least jeopardizing the Ubuntu installation, and let me get straight on this that it MS to blame for this, not Ubuntu).

You can easily take backup of windows partition data on any external media like External Hard Disk/Pen Drive/CD/DVD/etc if you want.
—– (You don’t even need to) ——-

To access windows partitions, just open the File Browser (A Drawer like icon on the Launcher Panel on the left of the desktop screen)

In the windows that is now opened, you can see your windows partition on the left panel.
See the image on this link to see how it should look like:
http://2.bp.blogspot.com/-omfXnS75kuM/TjK-YxLqAZI/AAAAAAAACRQ/v3-g6RFsgEY/s1600/PCMan+file+manager+in+ubuntu+11.04.png

(The “Win XP” and “Mix” shown on the left panel are windows partitions. The name will differ as per the naming on your PC)

To access files on these partitions you simply need to click on the partition.
(See HOW EASY IT WAS and you were probably tearing your hair off by now :D )

You can plug in an external hard disk and copy your files to it from here if you want.

And for that windows 7 Partition not showing, it is probably because of “Secure Boot” and “EFI” settings in the BIOS of your PC/Laptop. There are lots of how-to’s out there in the net. Just google it, study and take notes before doing an Installation.

A quick fix you can try at this stage is running the following commands:

$sudo su -
[enter password of your account]

#update-grub
or
#update-grub2 (***use this if available)

Now reboot your PC/Laptop to check if both Ubuntu and Windows are available now in the grub boot menu.

Reply

Leave a Comment

Tagged as: , , , , , ,

Previous Faq:

Next Faq: