h1

Formatting a Disk in Ubuntu 9.10

May 30, 2010

When most people think of formatting a disk, they think it is the process of deleting everything on the disk. Formatting a disk actually involves a little bit more, and it completely replaces the filesystem on the disk.

A side benefit to formatting a disk is making the disk work on different computers. Only certain types of filesystems are supported by each O/S, and formatting a disk with a common filesystem can ensure that it works with these different operating systems. As an example, if you format a USB key with the ext3 filesystem, it won’t work in Windows. If you use the VFAT filesystem, it will work in both Windows and Linux.

Formatting is fairly simple, and you just need to know the location of the device. USB storage devices (such as USB keyring drives and key fobs) tend to be located at /dev/sda1 or /dev/sdb1. Make sure that you have the right device, and then use one of the many mkfs commands to create the relevant filesystem. As an example, to create an ext3 filesystem, use the following command:

foo@bar:~$ sudo mkfs.ext3 /dev/sda1

A range of other mkfs commands can be used to create other filesystems:

mkfs
mkfs.cramfs
mkfs.ext2
mkfs.ext3
mkfs.jfs
mkfs.minix
mkfs.msdos
mkfs.reiser4
mkfs.reiserfs
mkfs.vfat
mkfs.xfs

Each of these commands is used in the same way.

Advertisements
%d bloggers like this: