This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
computing:storage:disk_prep_test [2011/11/08 08:34] gcooper created |
computing:storage:disk_prep_test [2018/01/17 10:32] (current) gcooper |
||
---|---|---|---|
Line 14: | Line 14: | ||
Disks support smart? | Disks support smart? | ||
- | sudo smartctl -i /dev/sdf | + | < |
+ | sudo smartctl -i /dev/sdX | ||
+ | </ | ||
Show disk info: | Show disk info: | ||
< | < | ||
- | sudo smartctl -a /dev/sdf | + | sudo smartctl -a /dev/sdX |
</ | </ | ||
Enable smart: | Enable smart: | ||
< | < | ||
- | sudo smartctl -s on -d ata /dev/sdf | + | sudo smartctl -s on -d ata /dev/sdX |
</ | </ | ||
Initiate quick health check: | Initiate quick health check: | ||
< | < | ||
- | sudo smartctl -d ata -H /dev/sdf | + | sudo smartctl -d ata -H /dev/sdX |
</ | </ | ||
Initiate extended self test: | Initiate extended self test: | ||
< | < | ||
- | sudo smartctl -d ata -t long /dev/sdf | + | sudo smartctl -d ata -t long /dev/sdX |
</ | </ | ||
then | then | ||
< | < | ||
- | sudo smartctl -l selftest /dev/sdf | + | sudo smartctl -l selftest /dev/sdX |
</ | </ | ||
==== Badblocks ==== | ==== Badblocks ==== | ||
- | Non-destructive read/write disk/ | + | :!: Badblocks can be hazardous to your data. **Make a backup first!** |
+ | |||
+ | :!: Running '' | ||
+ | |||
+ | There are some valid circumstances where you have to use the ' | ||
+ | |||
+ | === Determine Optimal Block Size === | ||
< | < | ||
- | sudo badblocks | + | tune2fs |
- | sudo badblocks -nvs /dev/sdf1 | + | |
</ | </ | ||
- | Destructive test (best) (10K blocks for speed): | + | === Non-Destructive |
+ | |||
+ | Read/ | ||
< | < | ||
- | sudo badblocks -wvs -Amazon - AWS 10240 /dev/sdf | + | sudo badblocks -nvs / |
+ | sudo badblocks | ||
+ | </ | ||
+ | === Destructive Test === | ||
+ | |||
+ | This is the best test and uses 4096K blocks for improved speed and saves a log file of bad blocks (add f to -wvs to force if drive reports in use): | ||
+ | |||
+ | < | ||
+ | sudo badblocks -wvs -b 4096 /dev/sdX | tee badblocks.txt | ||
</ | </ | ||
+ | |||
===== Preparation ===== | ===== Preparation ===== | ||
Line 59: | Line 79: | ||
Write zeros to disk (best for making compressible images) (also wipes out MBR): | Write zeros to disk (best for making compressible images) (also wipes out MBR): | ||
< | < | ||
- | sudo sh -Amazon - AWS "cat /dev/zero > /dev/sdf" | + | sudo sh -c "cat /dev/zero > /dev/sdX" |
</ | </ | ||
Line 71: | Line 91: | ||
Partition a drive: | Partition a drive: | ||
< | < | ||
- | sudo fdisk /dev/sdf | + | sudo fdisk /dev/sdX |
</ | </ | ||
Line 78: | Line 98: | ||
Write a DOS MBR (like fdisk /MBR) (may need --force) | Write a DOS MBR (like fdisk /MBR) (may need --force) | ||
< | < | ||
- | sudo install-mbr /dev/sdf -v --interrupt n --partition D --timeout 0 | + | sudo install-mbr /dev/sdX -v --interrupt n --partition D --timeout 0 |
</ | </ | ||
Note: the syslinux package also includes a mbr.bin file: | Note: the syslinux package also includes a mbr.bin file: | ||
< | < | ||
- | sudo dd if=/ | + | sudo dd if=/ |
</ | </ | ||
Line 90: | Line 110: | ||
Linux EXT3: | Linux EXT3: | ||
< | < | ||
- | sudo mkfs.ext3 /dev/sdf1 | + | sudo mkfs.ext3 /dev/sdX1 |
</ | </ | ||
Line 96: | Line 116: | ||
Partition the flash device as 'W95 FAT32' and set the ' | Partition the flash device as 'W95 FAT32' and set the ' | ||
< | < | ||
- | sudo mkdosfs -F 32 /dev/sdf1 | + | sudo mkdosfs -F 32 /dev/sdX1 |
</ | </ | ||
or | or | ||
< | < | ||
- | sudo mkfs.vfat -F 32 /dev/sdf1 | + | sudo mkfs.vfat -F 32 /dev/sdX1 |
</ | </ | ||