Saturday 3 March 2007

Drive formatting

Ok, so I've finally arranged for a backup drive of my own, rather than just relying on the network backups at work (which are not off-site!). Starting with formatting, here we go:
sudo mkfs.ext3 -c -c -T largefile -m 1 -v /dev/sda1
where the two c's mean that I wan't to check the disk by both reading and writing, the T option lets me specify the typical use (results in a certain block size and number of inodes that I don't get to worry about), and the m option lets me specify the percentage of blocks reserved for the superuser. I'm not sure about this last value, but it can be adjusted later by tune2fs.

Source of knowledge: man pages. Couldn't find anything about the reserved blocks stuff in a quick Google search, unfortunately.

Side notes: I used GNU parted to setup the partitions, which takes you through the process so gently that I don't need to blog about it, just type help for help at the prompt (and well, if you've never partitioned before, read about the general idea first...). Then there was a silly thing because the device sda1 did not exist, and this page saved me by explaining the use of mknod. I hope that was just a glitch in the way I went about things, normally I guess you don't need to manually add device names for your hot-plugged USB disks...

Just for later reference, this is the output of my formatting command:

$ sudo mkfs.ext3 -c -T largefile -m 1 -v /dev/sda1
Password:
mke2fs 1.38 (30-Jun-2005)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
57344 inodes, 14653280 blocks
146532 blocks (1.00%) reserved for the super user
First data block=0
448 block groups
32768 blocks per group, 32768 fragments per group
128 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424

Running command: badblocks -b 4096 -s /dev/sda1 14653280
Checking for bad blocks (read-only test): done 280
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 37 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

In the end, I skipped the write tests because even the read-only test takes ages on a USB disk. It found one bad block... :( If I want to be more thorough, I can run a write test later using e2fsck with the two c switches.

No comments: