sdparm

 

介紹

sdparm - access SCSI modes pages; read VPD pages; send simple SCSI commands.

 


sdparm

 

-a, --all

    output all recognized fields for the device type (e.g. disk) of the DEVICE.

# To list the common (generic) mode parameters of a disk:

sdparm /dev/sde

    /dev/sde: LSI       RAID 5/6 SAS 6G   2.13
Caching (SBC) mode page:
  IC            0  [cha: n, def:  0, sav:  0]
  WCE           0  [cha: n, def:  0, sav:  0]
  RCD           1  [cha: n, def:  1, sav:  1]

 


Background Scan

 

smartctl -d megaraid,20 -x /dev/bus/0

Background scan results log
  Status: scan is active
    Accumulated power on time, hours:minutes 39686:36 [2381196 minutes]
    Number of background scans performed: 554,  scan progress: 47.28%
    Number of background medium scans performed: 554

 

sdparm /dev/sde -p bc

    /dev/sde: LSI       RAID 5/6 SAS 6G   2.13
>> Background control (SBC) mode subpage not found

-p, --page=PG[,SPG]

supply the page number (PG) and optionally the sub page number (SPG) of the  mode (or  VPD)  page to fetch.

# enable Background Media scans - set to 0 to disable
sdparm /dev/sdb -p bc -s EN_BMS=1

# number of hours between media scans - here, run a scan every 24 hours
sdparm /dev/sdb -p bc -s BMS_I=24

# how many milliseconds the drive must be idle before a scan can begin here
sdparm /dev/sdb -p bc -s MIN_IDLE=2000

# if a command is received during a background media scan,
# the drive must stop the BMS within 500ms of receiving a read/write command from the host
sdparm /dev/sdb -p bc -s MAX_SUSP=500

# perform a background media scan (pre-scan) at the next disk power-on regardless of the timer
sdparm /dev/sdb -p bc -s EN_PS=1

# if this is set to 1, only log events in the scan log that might require user intervention
sdparm /dev/sdb -p bc -s LOWIR=1

Notes

Some RAID controllers will do this function on their own (PERC and LSI controllers call it "Patrol Read"),

and thus if you're using hardware RAID you may not need nor want to enable this function.

But for anyone running SAS drives in raw IT mode HBAs, this is definitely something useful to have enabled.