Large HD reminder


Prepare hard drive with parted. It is recommended to ask parted to use optimal partition alignment:

parted -a optimal /dev/sdX

(parted) help
(parted) print
(parted) mklabel gpt
(parted) mkpart primary ext4 0% 100%
(parted) name 1 storage_01
(parted) print
(parted) quit

create filesystem
mkfs.ext4 /dev/sdX1

To remove hot-plugged SATA disk, first unmount then suspend disk

umount /dev/sdXn
hdparm -y /dev/sdX
hdparm -Y /dev/sdX

Repair ext4 partition

fsck.ext4 -cDft -C 0 /dev/sd**

-c – check for bad sectors
-D – optimize directories if possible
-f – force check, even if filesystem seems clean
-t – print timing stats (use -tt for more)
-y – assume answer “yes” to all questions (such as, “do you want to continue”)
-C 0 – print progress info to stdout

Hard drive tests

A simple write test that writes zeroes to the entire disk
dd if=/dev/zero of=/dev/sdX

3 TB drive results

dd: writing to ‘/dev/sdc’: No space left on device
5860533169+0 records in
5860533168+0 records out
3000592982016 bytes (3.0 TB) copied, 58234.7 s, 51.5 MB/s

hdparm test

hdparm -Tt /dev/sdX

/dev/sdX:

/dev/sdc:
 Timing cached reads:   25128 MB in  2.00 seconds = 12580.01 MB/sec                                                                                                                                      
 Timing buffered disk reads: 560 MB in  3.00 seconds = 186.56 MB/sec 

A few passes with badblocks should provide a good test of your new hard drive.

emerge -uav e2fsprogs
badblocks -nsv /dev/sdX

Never use the -w option on a device containing an existing file system. This option erases data! If you want to do write-mode testing on an existing file system, use the -n option instead. It is slower, but it will preserve your data.

stress testing new hard drive with stress linux

emerge -av stress bonnie++
stress --help
stress --cpu 3 --io 1 --vm 1 --vm-bytes 128M --hdd 1 --hdd-bytes 1024K --timeout 10s
bonnie++

specific stress test of a mounted ssd disk

bonnie++ -d /path/to/mounted/ssd -r your-system-ram-size-in-MB
# for 16GB RAM
bonnie++ -d /mnt/mounted-ssd-001 -r 16000

testing new hard drive with smartmontools

emerge -av smartmontools

(turn on monitoring)
smartctl -s on /dev/sdX
=== START OF ENABLE/DISABLE COMMANDS SECTION ===
SMART Enabled.

(view all information)
# smartctl --all

(perform long test)
# smartctl --test=long /dev/sdX

(check log after the test)
# smartctl --log=error /dev/sdX

start smartmon daemon and to start it at boot time, add it your runlevel:

/etc/init.d/smartd start

rc-update add smartd default

To ensure the changes are synced to the USB disk before removing it:

sync