1833059 Members
2483 Online
110049 Solutions
New Discussion

Re: Disk' size

 
SOLVED
Go to solution
Carme Torca
Super Advisor

Disk' size

Hi,

How could I know the size of one disk.
With a fdisk I have:


Command (m for help): p

Disk /dev/cciss/c0d0: 255 heads, 32 sectors, 8716 cylinders
Units = cylinders of 8160 * 512 bytes

Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 * 1 25 101984 83 Linux
/dev/cciss/c0d0p2 26 539 2097120 83 Linux
/dev/cciss/c0d0p3 540 1053 2097120 82 Linux swap
/dev/cciss/c0d0p4 1054 8716 31265040 f Win95 Ext'd (LBA)
/dev/cciss/c0d0p5 1054 2308 5120384 83 Linux
/dev/cciss/c0d0p6 2309 2822 2097104 83 Linux
/dev/cciss/c0d0p7 2823 8716 24047504 83 Linux

But I don't know the size of one block!,
Thanks!,
Carmen.
Users are not too bad ;-)
12 REPLIES 12
Vernon Brown_4
Trusted Contributor

Re: Disk' size

----
root@cloud233:/home/sauer > dumpe2fs /dev/sda1 | grep "Block size"
dumpe2fs 1.17, 26-Oct-1999 for EXT2 FS 0.5b, 95/08/09
Block size: 1024
----

This is the way one person did it :o)

Block sizes will depend upon your disk setup in BIOS.

Vern
Carme Torca
Super Advisor

Re: Disk' size

Hi,

If I have this disk: /dev/cciss/c0d0, what I have to put in the instruccion???

Thanks!
Users are not too bad ;-)
Jeroen Peereboom
Honored Contributor

Re: Disk' size

Carmen,

My fdisk command (RedHat AS 2.1) shows as first line:
Disk /dev/hda: 40.0 GB, 40007761920 bytes

That's nice.

But your Linux doesn't show that.
Your c0d0p1 has 25 cylinders of 8160*512 bytes = 10444800 bytes.
It equals 101984 blocks ->
1 block = 10444800 / 101984 = 1024 bytes.

JP.
Jeroen Peereboom
Honored Contributor
Solution

Re: Disk' size

By the way, you don't need the blocksize.

8716 cylinders * 8160 * 512 = 36414750720 bytes. Approx. 35 GB.

(8160 = heads * sectors.)

JP.
Mark Grant
Honored Contributor

Re: Disk' size

Well, if it were an ide disk, the simplest thing is to "cat /proc/ide/hda/capacity"

I don't actually have any scsi attached disks on a linux box right so I can't be sure BUT I would imagine you get something similar if you follow the "/proc/scsi" tree.
Never preceed any demonstration with anything more predictive than "watch this"
Jeroen Peereboom
Honored Contributor

Re: Disk' size

Mark,

I tried that too. But it shows 78140160 for my 40 GB ide disk.
And I have two such files...
???

JP
Mark Grant
Honored Contributor

Re: Disk' size

THat's odd!

Those are kernel interfaces. If the kernel thinks thats how big your disk is, it doesn't really matter how big it really is, the kernel knows better :)

Which files do you have two of?
Never preceed any demonstration with anything more predictive than "watch this"
Jeroen Peereboom
Honored Contributor

Re: Disk' size

Sorry,

(Red Hat Linux 9)
2 /proc/ide/hda/capacity.
Both give the same size.
For the moment I don't care...

JP.
Roberto Polli
Trusted Contributor

Re: Disk' size

Hi carmen.
try
# cat /proc/driver/cciss/cciss0 cciss0: HP
Smart Array 5312 Controller
Board ID: 0x40830e11
Firmware Version: 2.36
IRQ: 18
Logical drives: 2
Current Q depth: 0
Current # commands on controller: 0
Max Q depth since init: 128
Max # commands on controller since init: 130
Max SG entries since init: 31
Monitor thread period: 0
Monitor thread deadline: 0
Status: operational
Sequential access devices: 0

cciss/c0d0: 17.35GB RAID 1(0+1)
cciss/c0d1: 173.61GB RAID 0

Peace, R.
Martin P.J. Zinser
Honored Contributor

Re: Disk' size

Hi,

/proc/ide/hda/capacity reports the size in 512 byte blocks.

Divide the number you get from fdisk -l by 512 and you arrive at the number from the capacity file.

Greetings, Martin
Michael Williams_6
Trusted Contributor

Re: Disk' size

Hi Carmen,

I see you've had a lot of responses, but I notice you have some 8 partitions, so do you mean the size of the disk (which is what everyone's given good responses for) or the partitions? If you're lazy like me and just want a rough total, you can use df -h (human readable) that tells you sizes in G, M or K...

michaelw@abacus4: df -h
Filesystem Size Used Avail Use% Mounted on
/dev/ida/c0d0p4 5.5G 5.0G 530M 91% /
/dev/ida/c0d0p2 1.6G 55M 1.5G 4% /tmp
/dev/ida/c0d1p1 68G 21G 48G 30% /a4/d1
/dev/ida/c0d2p1 68G 25G 44G 37% /a4/d2
/dev/ida/c0d3p1 68G 22G 47G 33% /a4/d3
/dev/ida/c0d4p1 34G 63M 34G 1% /a4/d4
/dev/ida/c0d5p1 68G 20G 49G 30% /a4/d5
/dev/ida/c0d6p1 68G 21G 47G 31% /a4/d6
/dev/ida/c0d7p1 68G 19G 49G 28% /a4/d7
/dev/ida/c0d8p1 34G 83M 34G 1% /a4/d8
shmfs 505M 0 505M 0% /dev/shm
abnis1:/homes 68G 11G 57G 17% /homes
Huc_1
Honored Contributor

Re: Disk' size

Perhaps, Just an
# fdisk -l /dev/cciss/c0d0

would do the trick ?

J-P
Smile I will feel the difference