mke2fs mini-HowTo

Adam Dosch

March 06, 2003

General overview of the mke2fs command for Fd Linux

1.  Overview

2.  Usage

3.  Examples

4.  Scenarios












Here is a general overview of mke2fs, which is a tool that allows you to create a Linux second extended (ext2) file system on any block device (hard drive partition, ramdisk, etc).  This can be quite useful especially when trouble shooting add-on package script problems and/or additional ramdisk mounting associated with Fd Linux.



Because Fd Linux is NOT a rescue disk, the only viable use for mke2fs is to create the ext2 file system on additional ramdisks to expand the current loaded file system that is booted from the floppy disk.

There are a few operation flags that could come in handy when you are getting ready to create a file system on a ramdisk.  They are as follows:

-b block-size
Specify the size of blocks in bytes. Valid block size vales are 1024, 2048 and 4096 bytes per block. If omitted, mke2fs block-size is determined by the file system size and the expected usage of the filesystem (see the -T option).
-m reserved-blocks-percentage
Specify the percentage of the file system blocks reserved for the super-user. This value defaults to 5%.
-N number-of-inodes
overrides the default calculation of the number of inodes that should be reserved for the file system (which is based on the number of blocks and the bytes-per-inode ratio). This allows the user to specify the number of desired inodes directly.

If you want further in depth detail and explanation of all the other operation flags that mke2fs can handle, please refer to it's MAN page here.



To make the file system on a ramdisk that would take up the whole ramdisk (4096kb), you would type:

    (root->fdlinux)% mke2fs -m 0 /dev/ramX

To specify how much of the ramdisk you want to format, you would type:

    (root->fdlinux)% mke2fs -b 1024 -m 0 /dev/ramX

X = the number of the next available ramdisk device available (1 - 7)



NOTE:  We are using /dev/ram1 as an example.  Be sure to type `mount` and see what ramdisk devices are already mounted and formatted with the ext2 file system before trying this.

1)  You have just booted up Fd Linux and you connect to a FTP host to download something of importance.  After typing the command `free`, you notice that you do not have enough space on the currently mounted file system, /dev/ram0, to store this thing you are trying to download.  You want to be able to use the next available ramdisk to hold the thing you are downloading and you also want to format the WHOLE entire ramdisk because you will be downloading other things throughout the day.  The command you would type to do this is:

    (root->fdlinux)% mke2fs -m 0 /dev/ram1

2)  While using Fd Linux for 6 months as your primary router/firewall for your home network, you notice that your firewall log files are filling up your currently mounted file system, /dev/ram0, and you are going to run out of space.  Once you use `tar` and `gzip` to archive and compress the log files, You decide that you want to be able to create a file system on the next available ramdisk to hold all your old log files, but you only want to use 2MB of the ramdisk (2048kb).  The command you would type to do this is:

    (root->fdlinux)% mke2fs -m 0 -b 2048 /dev/ram1



If you feel that anything should be added to this mini-HowTo, please feel free to send me an Inquiry Ticket about it!