[]RSS

About Archives Artwork Comic Contact Philosophy Projects Tags

Unix Admin Cheats

Random shell hacks

  • shopt -s cdspell (forgives spelling errors in shell names)

Formating disks

(Assumes drive is 2nd IDE and target ext3 filesystem)

  1. Check logs (less /var/log/message) for correct device ID. Always check the drive ID a few times, formatting the wrong drive is funny in the bad way. Likely a second drive will be hdb, assuming it’s on the primary channel. Linux systems letter drives hda, hdb, hdc, hdd for standard IDE channels. The master device on channel 0 is hda, the master device on channel 2 is hdc.

  2. Add a partition table (/sbin/fdisk /dev/hdb).

  3. Add a file system (/sbin/mkfs.ext3 -c /dev/hdb). It’s handy to use -c if you’re not sure about the drive. It’s also handy to watch the system log (tail -f /var/log/message) in another console, to see if there are any problems with the device as it’s formatted.