Sunday, May 27, 2007

HOWTO format and mount an external hard disk

When I initially tried to back up my music library onto my Windows-created FAT32 external hard drive, the terminal threw a bunch of "Invalid argument" errors and failed to copy those respective files. It turns out that windows-formatted drives can not have certain characters in their filenames ( \ / : * ? < > | ), so I decided to reformat the drive in a Linux-friendly fashion.

Instructions
  1. Connect the target drive to your computer (let's assume it's recognized as /dev/sdb1)
  2. Reformat it using the ext3 file system (Linux default) by either...
    1. sudo mkfs.ext3 /dev/sdb1 (lots of options with this tool... read the manpage )
    2. Using gparted (install with sudo aptitude install gparted), a GUI-based tool
  3. Create a mount point sudo mkdir /external
  4. Mount the drive sudo mount /dev/sdb1 /external
  5. Use the drive!
  6. (optional) If you want the drive to be recognized in a certain way upon boot, edit the /etc/fstab file to your liking (Ubuntu 7.04 recognizes it anways)
  7. (optional) To unmount the drive sudo umount /dev/sdb1
Useful commands
  • sudo fdisk -l List partition tables for all devices (mounted or not)
  • df -h Human-readable output of system disk space and usage
Tips
hd* = IDE drive
sd* = SATA drive

Information used from these sources

No comments: