<< Back to shouce.jb51.net

2.3. Creating a File System on the Partition

Now that a blank partition has been set up, the file system can be created. The most widely-used system in the Linux world is the second extended file system (ext2), but with the newer high-capacity hard disks, the journaling file systems are becoming increasingly popular. Here we will create an ext2 file system, but build instructions for other file systems can be found at http://www.linuxfromscratch.org/blfs/view/svn/postlfs/filesystems.html.

To create an ext2 file system on the LFS partition, run the following:

mke2fs /dev/[xxx]

Replace [xxx] with the name of the LFS partition (hda5 in our previous example).

If a swap partition was created, it will need to be initialized as a swap partition too (also known as formatting, as described above with mke2fs) by running the following. If you are using an existing swap partition, there is no need to format it.

mkswap /dev/[yyy]

Replace [yyy] with the name of the swap partition.