Hard Drive Formatting


I just spent three hours trying to format a hard drive under Linux. It really shouldn’t be so difficult.. this is one task which is much easier to perform on Windows than Linux. My goal was to format a USB hard drive with two partitions, one ext3 and one FAT32.

Some things I learned:

Use fdisk to create partitions, or the curses-based cfdisk. These tools can also be used to simply view the current partition layout.

The /dev/sd# numbers are assigned in the order the partitions are created, regardless of where they reside on the disk.

Windows refuses to create FAT32 partitions larger than 32MB.

Set the volume label with e2label. This only works for Linux filesystems; for dos-based systems you set the volume label when you create the filesystem.

Expect a lost+found directory to be created in your new Linux filesystem.

My xubuntu system didn’t immediately update the /dev hierarchy to reflect my partition changes; a reboot fixed this.

What worked for me to create one ext3 and one vfat partition on my new hard drive (sudo required for most commands):
cfdisk
reboot -t now
mkfs -m 0 -j /dev/sda1
e2label /dev/sda1 externalHD
mkdosfs -F 32 -n externalHD2 -v /dev/sda2

To mount a partition automatically on boot you have to add it to the fstab file. The partition will be mounted as root, but if you chown the mount point after the mount, the mount point will retain those permissions on subsequent mounts.

No Comments

No comments yet.

Comments RSS TrackBack Identifier URI

Leave a comment


powered by WordPress     themed by Mukkamu     presented by ideaharbor.org     everything else by steve hulet