Friday, April 8, 2011

Discovering linux disk configurations from the command line.

How can I discover if a remote machine is configured with or without hardware or software RAID? All I know is i have 256GB at present, I need to order more space but before I can I need to know how the drives are configured.

df lists the drive as:

/dev/sdb1            287826944 273086548    119644 100% /mnt/db

and hdparm:

/dev/sdb:  
  HDIO_GET_MULTCOUNT failed: Invalid argument  
  readonly     =  0 (off)  
  readahead    = 256 (on)  
  geometry     = 36404/255/63, sectors = 299439751168, start = 0  

What else should I run and what should I look for?

From stackoverflow
  • Call/email the sysadmin and ask him/her.

  • Software RAID would not be /dev/sdb - dev/md0. Nor is it LVM.

    So it's either real hardware RAID, or a raw disk.

    lspci might show you and RAID controllers plugged in.

    dmesg | grep sdb might tell you some more about the disk.

    sdparm /dev/sdb might tell you something? Particularly if it really is a SCSI disk.

    chillitom : Thanks lspci prints: 02:0e.0 RAID bus controller: Dell PowerEdge Expandable RAID controller 5
    chillitom : sdparm prints: /dev/sdb: DELL PERC 5/i 1.00
    Douglas Leeder : So you've got a Hardware RAID controller then. You'll have to find some Dell diagnostics to find out any more about the underlying disks.
    chillitom : Thanks Douglas. I'm now wrestling possibly the worst command line tool I've ever seen made by LSI (DELL PERC are obviously rebranded from LSI), it's called MegaCli.. avoid at all costs.
  • dmesg might help.

    On a system where we do have software raid we see things like:

    SCSI device sda: 143374744 512-byte hdwr sectors (73408 MB)

    sda: Write Protect is off

    sda: Mode Sense: ab 00 10 08

    SCSI device sda: write cache: enabled, read cache: enabled, supports DPO and FUA

    SCSI device sda: 143374744 512-byte hdwr sectors (73408 MB)

    sda: Write Protect is off

    sda: Mode Sense: ab 00 10 08

    SCSI device sda: write cache: enabled, read cache: enabled, supports DPO and FUA

    sda: sda1 sda2

    sd 0:0:0:0: Attached scsi disk sda

    SCSI device sdb: 143374744 512-byte hdwr sectors (73408 MB)

    sdb: Write Protect is off

    sdb: Mode Sense: ab 00 10 08

    SCSI device sdb: write cache: enabled, read cache: enabled, supports DPO and FUA

    SCSI device sdb: 143374744 512-byte hdwr sectors (73408 MB)

    sdb: Write Protect is off

    sdb: Mode Sense: ab 00 10 08

    SCSI device sdb: write cache: enabled, read cache: enabled, supports DPO and FUA

    sdb: sdb1 sdb2

    sd 0:0:1:0: Attached scsi disk sdb

    A bit later we see:

    md: md0 stopped.

    md: bind

    md: bind

    md: raid0 personality registered for level 0

    md0: setting max_sectors to 512, segment boundary to 131071

    raid0: looking at sda2

    raid0: comparing sda2(63296000) with sda2(63296000)

    raid0: END

    raid0: ==> UNIQUE

    raid0: 1 zones

    raid0: looking at sdb2

    raid0: comparing sdb2(63296000) with sda2(63296000)

    raid0: EQUAL

    raid0: FINAL 1 zones

    raid0: done.

    raid0 : md_size is 126592000 blocks.

    raid0 : conf->hash_spacing is 126592000 blocks.

    raid0 : nb_zone is 1.

    raid0 : Allocating 4 bytes for hash.

    and a df shows:

    Filesystem Size Used Avail Use% Mounted on /dev/sda1 7.8G 3.3G 4.2G 45% /

    tmpfs 2.0G 0 2.0G 0% /dev/shm

    /dev/md0 117G 77G 35G 69% /scratch

    So part of sda and all of sdb have been bound as one raid volume.

    What you have could be one disk, or it could be hardware raid. dmesg should give you some clues.

    It is always possible that it is a hardware raid controller that just looks like a single sata (or scsi) drive. Ie, our systems with fiber channel raid arrays, linux only sees a single device, and you control the raid portion and disk assignment via connecting to the fiber raid array directly.

    chillitom : SCSI device sdb: 584843264 512-byte hdwr sectors (299440 MB) SCSI device sdb: 584843264 512-byte hdwr sectors (299440 MB) sdb: asking for cache data failed sdb: assuming drive cache: write through sdb: sdb1 Attached scsi disk sdb at scsi0, channel 2, id 1, lun 0 so.. not raided?
    Bruce ONeel : It could be hardware raided, but, it doesn't look like it's raided with software.
  • You can try mount -v or you can look in /sys/ or /dev/ for hints. dmesg might reveal information about the drivers used, and lspci could list any add-in hw raid cards, but in general there is no generic method you can rely on to find out the exact hardware & driver setup.

  • To check for software RAID:

    cat /proc/mdstat
    

    On my box, this shows:

        Personalities : [raid1]
        md0 : active raid1 sda1[0] sdb1[1]
              96256 blocks [2/2] [UU]
    
        md1 : active raid1 sda2[0] sdb2[1]
              488287552 blocks [2/2] [UU]
    
        unused devices: <none>
    

    You get the names of all software RAID arrays, the RAID level for each, the partitions that are part of each RAID array, and the status of the arrays.

  • You might try using mdadm with more explanation here. If the 'mount' command does not show /dev/md*, chances are you are not using (or seeing) the software raid.

    This is really a system administration, not programming related question, I'll tag it as such.

0 comments:

Post a Comment