How To Find Un Allocated Space On Linux
Using only fdisk, the “start” and “end” columns in your ‘fdisk -l’ output are the start and end cylinders. From the header of your ‘fdisk -l’ output, you can also see how many cylinders the disk has and how many bytes a cylinder represents.
fdisk -l /dev/cciss/c0d0
Disk /dev/cciss/c0d0: 72.8 GB, 72833679360 bytes
255 heads, 32 sectors/track, 17433 cylinders
Units = cylinders of 8160 * 512 = 4177920 bytesDevice Boot Start End Blocks Id System
/dev/cciss/c0d0p1 * 1 100 407984 83 Linux
/dev/cciss/c0d0p2 101 1642 6291360 83 Linux
/dev/cciss/c0d0p3 1643 3184 6291360 83 Linux
/dev/cciss/c0d0p4 3185 17433 58135920 f Win95 Ext’d (LBA)
/dev/cciss/c0d0p5 3185 4212 4194224 83 Linux
/dev/cciss/c0d0p6 4213 4983 3145664 83 Linux
/dev/cciss/c0d0p7 4984 5497 2097104 83 Linux
/dev/cciss/c0d0p8 5498 6011 2097104 82 Linux swap
/dev/cciss/c0d0p9 6012 9608 14675744 83 Linux
Since your last partition ends on cylinder 9608, you still have cylinders 9609 through 17433 unallocated. 7825 cylinders times 4 megs yields about 30g unallocated. This is approximate because your cylinders are actually just slightly under 4 megs (using powers of two), but I also rounded down on the final number, so it should be pretty close to the real number.
Or
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytesDevice Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 905 7164990 83 Linux
/dev/sda3 906 1036 1052257+ 82 Linux swap / Solaris
Total space 21GB . You can use partx -l command to find the used space and can subtract from total space.
[root@localhost ~]# partx -l /dev/sda
# 1: 63- 208844 ( 208782 sectors, 106 MB)
# 2: 208845- 14538824 ( 14329980 sectors, 7336 MB)
# 3: 14538825- 16643339 ( 2104515 sectors, 1077 MB)
# 4: 0- -1 ( 0 sectors, 0 MB)
So my server has around 12 GB unallocated space
Category: Linux Administration
