Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Let's say I have this virtual machine running:

[root@centos ~]# fdisk -ul

Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders, total 16777216 sectors
Units = sectors of 1 * 512 = 512 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63      417689      208813+  83  Linux
/dev/sda2         2522205    13799834     5638815   83  Linux
/dev/sda3        13799835    16771859     1486012+  8e  Linux LVM
/dev/sda4          417690     2522204     1052257+   5  Extended
/dev/sda5          417753     2522204     1052226   82  Linux swap /     Solaris

How can I know how much free space left for more partitions on the disk?

share|improve this question
    
With "free space" you mean "not yet allocated to a partition" aka "unpartitioned space", do you? The v command of fdisk verifies the partition table and reports such space as well, e.g. Remaining 239 unallocated 512-byte sectors in my case. –  Martin Scharrer Jul 7 '11 at 16:37
    
that's exactly what I meant. but the -v command means: Print version number of fdisk and exit. –  kovadom Jul 7 '11 at 17:49
2  
I'm talking about the v command, not the -v command line option, i.e. you need to start fdisk /dev/sda in interactive mode and then type v<ENTER>. –  Martin Scharrer Jul 7 '11 at 18:03
add comment

1 Answer 1

up vote 4 down vote accepted

As root, type in a shell:

# cfdisk /dev/sdX  #Where /dev/sdX is the device 

it will show you something like this:

cfdisk (util-linux-ng 2.18)

                          Disk Drive: /dev/sdb
                    Size: 3926949888 bytes, 3926 MB
          Heads: 255   Sectors per Track: 63   Cylinders: 477

Name        Flags      Part Type  FS Type          [Label]        Size (MB)

sdb1                    Primary   vfat             [ABDEL]          1998.75
sdb2        Boot        Primary   ext3             [linx]           1924.72

if the device has free space it will be shown.

Note: cfdisk in fact is a terminal based partition editor.

share|improve this answer
    
You could use cfdisk -P s /dev/sdX to print out the partition table to the console without entering the interactive partition editor. If you do enter it as @abdelfatah directs, you can exit by pressing 'q'. –  Caleb Jul 7 '11 at 12:05
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.