User Tools

Site Tools


computing:storage:disk_prep_test

This is an old revision of the document!


Disk or Flash Drive Testing and Preparation

Testing

SMART

Disks support smart?

sudo smartctl -i /dev/sdf

Show disk info:

sudo smartctl -a /dev/sdf

Enable smart:

sudo smartctl -s on -d ata /dev/sdf

Initiate quick health check:

sudo smartctl -d ata -H /dev/sdf

Initiate extended self test:

sudo smartctl -d ata -t long /dev/sdf

then

sudo smartctl -l selftest /dev/sdf

Badblocks

:!: Badblocks can be hazardous to your data. Make a backup first!

There are some valid circumstances where you have to use the '-f' switch to force the testing. Be careful when doing so to make sure you 'do no harm'.

Determine Optimal Block Size

tune2fs -l /dev/sdf1 | grep Block

Non-Destructive Test

Read/write test a disk/partition:

sudo badblocks -nvs /dev/sdf                # entire disk
sudo badblocks -nvs /dev/sdf1               # partition only

Destructive Test

This is the best test and uses 4096K blocks for improved speed:

sudo badblocks -wvs -b 4096 /dev/sdf | tee badblocks.txt

Preparation

Wipe a Disk

Write zeros to disk (best for making compressible images) (also wipes out MBR):

sudo sh -c "cat /dev/zero > /dev/sdf"

Partition a Disk

Show disks:

sudo fdisk -l

Partition a drive:

sudo fdisk /dev/sdf

Write a DOS MBR

Write a DOS MBR (like fdisk /MBR) (may need –force)

sudo install-mbr /dev/sdf -v --interrupt n --partition D --timeout 0

Note: the syslinux package also includes a mbr.bin file:

sudo dd if=/usr/lib/syslinux/mbr.bin of=/dev/sdf

Make a Filesystem

Linux EXT3:

sudo mkfs.ext3 /dev/sdf1

FAT32 (Flash is normally FAT16 or FAT32): Partition the flash device as 'W95 FAT32' and set the 'bootable' flag if desired.

sudo mkdosfs -F 32 /dev/sdf1

or

sudo mkfs.vfat -F 32 /dev/sdf1
computing/storage/disk_prep_test.1335805770.txt.gz · Last modified: 2012/04/30 11:09 by gcooper