Linux View Hard Drive Partitions with fdisk and parted commands

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
# fdisk -l

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

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. 

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 8 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
8 comments… add one
  • Mohit Guleria Jul 1, 2008 @ 8:45

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

  • Abhi Aug 13, 2010 @ 15:02

    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.

  • suman Jan 19, 2011 @ 9:33

    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


    Please support

  • SP Jun 6, 2011 @ 5:03

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

  • Prashant Aug 24, 2012 @ 9:53

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

  • vikash Jul 26, 2014 @ 20:27

    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)

    • Abhi Sep 14, 2014 @ 17:37

      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:

      (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-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.

  • Amit May 20, 2016 @ 15:52

    Hello friend,

    1st i installed windows 7 then installed RED HAT 7. after that dual booting option is not showing. Please help.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum