/proc/partitions (was: Get a list of hard disks)
On Fri, 13 Aug 2004 13:25:42 -0700, Stefan O'Rear wrote:
> On Fri, Aug 13, 2004 at 04:13:23PM -0400, Tong wrote:
>> Hi,
>>
>> How can I get a list of hard disks available in my system?
>
> Try these:
>
> stefan:~$ ls /proc/ide -l --color=none
> total 0
> -r--r--r-- 1 root root 0 Aug 13 13:23 drivers
> lrwxrwxrwx 1 root root 0 Aug 13 13:23 hda -> ide0/hda
> lrwxrwxrwx 1 root root 0 Aug 13 13:23 hdb -> ide0/hdb
> lrwxrwxrwx 1 root root 0 Aug 13 13:23 hdc -> ide1/hdc
> dr-xr-xr-x 4 root root 0 Aug 13 13:23 ide0
> dr-xr-xr-x 3 root root 0 Aug 13 13:23 ide1
Hmm, I can't make too much information out of my output, Mine is:
$ ls /proc/ide -l --color=none
total 0
-r--r--r-- 1 root root 0 Aug 13 16:37 drivers
lrwxrwxrwx 1 root root 8 Aug 13 16:37 hda -> ide0/hda
lrwxrwxrwx 1 root root 8 Aug 13 16:37 hdb -> ide0/hdb
lrwxrwxrwx 1 root root 8 Aug 13 16:37 hdc -> ide1/hdc
lrwxrwxrwx 1 root root 8 Aug 13 16:37 hdd -> ide1/hdd
dr-xr-xr-x 4 root root 0 Aug 13 16:37 ide0
dr-xr-xr-x 4 root root 0 Aug 13 16:37 ide1
-r--r--r-- 1 root root 0 Aug 13 16:37 sis
My HDs are hda and hdb.
> stefan:~$ cat /proc/partitions
> major minor #blocks name
>
> 3 0 13260240 hda
> 3 1 8001 hda1
> 3 2 8032 hda2
> 3 3 1 hda3
> 3 5 377496 hda5
> 3 6 56196 hda6
> 3 7 9767488 hda7
> 3 8 3028221 hda8
> 3 64 4210920 hdb
> 3 65 1365493 hdb1
> 3 66 2843505 hdb2
Ah! Maybe that's the reason why my "sfdisk -s" produces no output (strace
told me "sfdisk -s" reads /proc/partitions)
Mine is:
% cat /proc/partitions
major minor #blocks name rio rmerge rsect ruse wio wmerge wsect wuse running use aveq
3 0 60051600 ide/host0/bus0/target0/lun0/disc 72159 136746 1668720 467190 383039 658435 8342136 1659840 -429 17038808 22703194
3 1 1638598 ide/host0/bus0/target0/lun0/part1 0 0 0 0 0 0 0 0 0 0 0
3 2 1028160 ide/host0/bus0/target0/lun0/part2 0 0 0 0 0 0 0 0 0 0 0
3 3 3092512 ide/host0/bus0/target0/lun0/part3 0 0 0 0 0 0 0 0 0 0 0
3 4 1 ide/host0/bus0/target0/lun0/part4 0 0 0 0 0 0 0 0 0 0 0
3 5 514048 ide/host0/bus0/target0/lun0/part5 1458 7877 74680 9070 2140 18285 166272 42490 0 10100 52000
How can I get the format like yours?
Reply to: