LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   how to find disk capacity (https://www.linuxquestions.org/questions/linux-general-1/how-to-find-disk-capacity-91816/)

Henry_1 09-11-2003 07:39 PM

how to find disk capacity
 
How can I find the total capacity of my disk on linux. I tried df but it does not give the space allocated to swap

DavidPhillips 09-11-2003 07:46 PM

fdisk -l /dev/hda

Disk /dev/hda: 60.0 GB, 60011642880 bytes
255 heads, 63 sectors/track, 7296 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 1 141 1132551 a0 IBM Thinkpad hibernation
/dev/hda2 * 142 3789 29302560 7 HPFS/NTFS
/dev/hda3 3790 3806 136552+ 83 Linux
/dev/hda4 3807 7296 28033425 5 Extended
/dev/hda5 3807 3931 1004031 82 Linux swap
/dev/hda6 3932 7296 27029331 83 Linux

Henry_1 09-11-2003 07:56 PM

Thanks David. But its not showing me the disk capacity when I run fdisk -l

fdisk -l /dev/sda

Disk /dev/sda: 255 heads, 63 sectors, 1106 cylinders
Units = cylinders of 16065 * 512 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 50 401593+ 83 Linux
/dev/sda2 51 63 104422+ 6 FAT16
/dev/sda3 64 307 1959930 83 Linux
/dev/sda4 308 1106 6417967+ 5 Extended
/dev/sda5 308 554 1983996 82 Linux swap
/dev/sda6 555 747 1550241 83 Linux
/dev/sda7 748 940 1550241 83 Linux
/dev/sda8 941 1041 811251 83 Linux
/dev/sda9 1042 1106 522081 83 Linux

DavidPhillips 09-11-2003 11:34 PM

It appears your version is different but it is showing it. Just total up the blocks


If you had the version I have it would report 9G


This is what's used, since we are showing partitions.

.........401593
.........104422
.......1959930
.......6417967
.......8883912
..........*..1024
9097125888 bytes


9 GB partitioned space with no gaps between partitions.


The actual disk capacity would be

(16065 * 512) x 1106 = 9097159680 bytes

9 GB

so it's all used

DavidPhillips 09-11-2003 11:40 PM

That is a rather large swap partition.


All times are GMT -5. The time now is 06:32 AM.