[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Disk tools in debian



On Sun, 2004-07-11 at 21:24, * Tong* wrote:
> Hi, 
> 
> In other distros, if I want to have a look at what HDs I have and
> their size, I just issue 'sfdisk -s', then all the HDs I have and
> their size are shown. But in debian, nothing happens after issuing
> 'sfdisk -s'. Hence, question #1,
> 
> How can I know what HDs I have in my system (so that I can feed to
> result to the rest of my script)? 

Run sfdisk as root.  It probably doesn't have permission to read the
disks.

> Other things I can do with other distros but not debian are:
> 
> - get all disk geometries
> 
> $ sfdisk -g
> /dev/hdd: 2494 cylinders, 255 heads, 63 sectors/track
> /dev/hda: 7476 cylinders, 255 heads, 63 sectors/track

Works as root

> - get all partitions
> 
> fdisk -l | grep '^/hd[a-d]'
> /dev/hdd1             1        64    514048+  82  Linux swap
> /dev/hdd2   *        65       319   2048287+  83  Linux
> [...]
> /dev/hda1             1        64    514048+  82  Linux swap
> /dev/hda2            65       321   2064352+   b  Win95 FAT32

Again, run it as root.

> I'll stress that my questions are scripting-wise. I need to write
> generic script that doesn't require me to throw in specific hd
> info for it to run. I think the disk tools is sadly a week point
> in Debian, or maybe I haven't find the right gadget. Please help.

Possibly other distributions are more lax about giving read permission
on the disk devices.  If so, I find it highly surprising, since if an
ordinary user can read the disk devices, he can read any data on them.

(I tried your examples using the current version from unstable, and I
tried sfdisk on woody.)

-- 
Oliver Elphick                                          olly@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E  1EC0 5664 7A2F A543 10EA
                 ========================================
     "I waited patiently for the LORD; and he inclined unto 
      me, and heard my cry. He brought me up also out of an 
      horrible pit, out of the miry clay, and set my feet 
      upon a rock, and established my goings. And he hath 
      put a new song in my mouth, even praise unto our God.
      Many shall see it, and fear, and shall trust in the 
      LORD."                 Psalms 40:1-3 



Reply to: