Console commands for hard drives

From unRAID
Jump to: navigation, search

This older page has been deprecated, please go to the Console page, Console Commands for Hard Drives section

The following commands require the Device ID, which you can get from UnMENU (an UnRAID Add On) or the unRAID Web Management page, Devices tab. Locate your drive, then look for the Device ID in parentheses. It is always 3 lowercase letters, beginning with either hd or sd, eg. sda, sdk, hdc, hdg. For simplicity, sdx will be used below, and you will substitute the appropriate Device ID for your drive. (Extra spaces are added for clarity only, only one space is needed.)

Console commands


To view the identity and configuration information for a drive (at the console or telnet prompt)

hdparm  -I  /dev/sdx

To determine the read speed of a hard drive, the following command can be used. The very last number in MB/sec is the one you want, ignore the rest. Although one run will give you a decent result, for better accuracy, take the average of at least 5 runs. See also Check Harddrive Speed.

hdparm  -tT  /dev/sdx


To obtain the SMART info for a drive, including some identity and configuration information, and physical statistics and error history. For more information about SMART and smartctl, see the UnRAID Topical Index, SMART section, also here and here and here and here and here.

smartctl  -a  -d  ata  /dev/sdx

To copy the SMART report to a file called smart.txt on your unRAID flash drive, that you can copy elsewhere and post to the forums, use the following command. Of course, you can change the file name to what ever you like, for example, smart_Seagate320_2008-12-15.txt.

smartctl  -a  -d  ata  /dev/sdx  >/boot/smart.txt


smartctl  -a  -d  ata  /dev/sdx  |  todos  >/boot/smart.txt

This second form makes it easier to look at the smart.txt file from a Windows workstation, because it adds the standard end-of-lines that are used in Windows.

To run a short or long SMART test on a drive, select one of the following commands (short test takes minutes, long test can take several hours depending on size of drive)

smartctl  -d  ata  -tshort  /dev/sdx
smartctl  -d  ata  -tlong  /dev/sdx

As of unRAID v4.3 final, smartctl is included with unRAID. Prior to this, it needed to be copied to the flash drive, see this for links to obtaining it. If you had to copy it to your flash drive, then the command to execute would be /boot/smartctl instead of just smartctl. For example, the command to get a SMART report would be

/boot/smartctl  -a  -d  ata  /dev/sdx

Other commands

To view the partitioning of a drive

fdisk  -l  -u  /dev/sdx

To verify how the drive is labeled (note the "1" at the end of the command, defining the first partition on device /dev/sdx)

vol_id  /dev/sdx1

Shows you the drives by their model and serial number and the drive device ID (sda, hdc, etc) linked to each

ls -l /dev/disk/by-id
ls -l /dev/disk/by-id/[au]* | grep -v part1

Lists the drive devices that have "volume labels", and device ID linked to each. Typically, only the flash drive will have an entry here and it MUST have a volume label of "UNRAID" for unRAID to start up properly

ls -l /dev/disk/by-label

Note: in the default setup of unRAID, v is an alias for ls -l, so you can replace the ls -l above with just v.