Installing the File System

Installing the Filesystem

When doing a fresh install there is generall very little that you need to do in regard to installing a filesystem. Most of the work is done for you. All you really need to do is choose the filesystem(s) you want to use. However, for many people (newbies and experienced users alike), which file system to choose it not always clear-cut.

In the section on supported filesystems, we talk about some of the various filesystem types and what things to consider when choosing one over the other.

If you expect that you are going to have a large number of files on your systems (like hundreds of thousands or millions), then you will need to increase the number of inodes. Basically, inodes are pointers to the data on the disk, as well as contain information about the file such as the file owner, permissions and so on. In most cases, you are limited by the number of inodes which are created when the filesystem is created. Once you run out, you need to either move the files to another filesystem, or backup the data, recreate the filesystem then restore the tape. Both are sometimes not possible. Keep in mind, however, that for most home users, the defult number of inodes is usually enough.In the section on the disk layout we talk about inodes in detail.

Generically, filesystems are created using using the mkfs command. One of the options it takes is the filesystem type. The basically tells mkfs to start the real program which then creates the filesystem. For example, the mke2fs is called when create an ext2fs. When calling mkfs, you typically have few options. So if you need to specify the number of inodes, you will need to start the real program by hand. In the case of the ext2fs, you can use the -i option to specify the number of inodes. Check out the appropriate man-page for details.

One interesting thing about the ReiserFS is that inode are allocated dynamically. That means you will only run out of indode when you run out of space on the disk.

Examples of mkfs commands are:

FilesystemCommand
EXT2 FSmkfs.ext2
EXT4 FSmkfs.ext3
SCO BFSmkfs.bfs
Minix FSmkfs.minix
DOS (FAT) FS mkfs.msdos
Virtual FAT FSmkfs.vfat
XFSmkfs.xfs
XIA FSmkfs.xiafs

A list of supported filesystem types can be found in the here. and the section on file system tools.

By default all of these reside in the /sbin directory. If we do an ls -li to get the inode number, as well, we end up with something like this:

481394 -rwxr-xr-x 1 root root 5124 Sep 23 2003 /sbin/mkfs 481395 -rwxr-xr-x 1 root root 7744 Sep 23 2003 /sbin/mkfs.bfs 481396 -rwxr-xr-x 1 root root 15196 Sep 23 2003 /sbin/mkfs.cramfs 480620 -rwxr-xr-x 3 root root 31252 Sep 23 2003 /sbin/mkfs.ext2 480620 -rwxr-xr-x 3 root root 31252 Sep 23 2003 /sbin/mkfs.ext3 480930 -rwxr-xr-x 2 root root 61691 Sep 23 2003 /sbin/mkfs.jfs 481397 -rwxr-xr-x 1 root root 15488 Sep 23 2003 /sbin/mkfs.minix 480434 lrwxrwxrwx 1 root root 7 Dec 28 10:43 /sbin/mkfs.msdos -> mkdosfs 480413 -rwxr-xr-x 2 root root 142344 Sep 23 2003 /sbin/mkfs.reiserfs 480551 -rwxr-xr-x 1 root root 342040 Sep 23 2003 /sbin/mkfs.xfs

Note that both mkfs.ext2 and mkfs.ext3 both have the same inode number and are thus the exact same program. This makes sense since the ext3fs is just an extension of the ext3fs.s

In it’s simplest form, you can usually run the appropriate mkfs command and pass it just the name of the partition, without any option. For example, if we wanted to create and ext3fs, we could do it like this:

/sbin/mkfs.ext3 /dev/hda12

This gives us an output like this:

mke2fs 1.34 (25-Jul-2003) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 2247744 inodes, 4494175 blocks 224708 blocks (5.00%) reserved for the super user First data block=0 138 block groups 32768 blocks per group, 32768 fragments per group 16288 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000 Writing inode tables: done Creating journal (8192 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 38 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.

Note that the very first line indicates that the program called is mke2fs, although we started it as mkfs.ext3. If we were to start it as mkfs.ext2, the output would be the same except that you would not have the line:

Creating journal (8192 blocks): done

This is quite simply because the ext2fs is not a journalling filesystem where the ext3fs is. If were ran mkfs.ext2 a said we wanted a journalling filesystem (using the -j option) the output would be the same.

Note that the program created 10 copied of the superblock. Each being an exact copy of the other. The superblock contains information about the type of file system, its size, how many data blocks there are, the number of free inodes, free space available, and where the inode table is. Detail can be found in the section on disk layout.

Details on checking the file system can be found in the section on filesystem tools.