BACK

File Systems


mkfs 

Used to build a Linux filesystem on a device.

Syntax:

# mkfs [ -V ] [ -t fstype ] [ fsoptions ] FILESYSTEM [ blocks ]

Example:

# mkfs -V  -t ext2  -c  /dev/hda3

Options:

-V verbose
[ fsoptions ] -c check for bad blocks

-l filename file with list of bad blocks

-v verbose

 


mke2fs

Used to create a Linux second extended file system.

Syntax:

# mke2fs [options ] DEVICE [ block count ]

Example:

# mke2fs -c -v /dev/hda2

Options:

-c checks the device for bad blocks before creating filesystem
-f fragment size specifies the size of file fragments in bytes
-i bytes per inode creates a inode for every bytes per inode on the disk, min. = 1024, default = 4096
-l filename read the filename for a list of bad blocks

-m reserved blocks percentage

specifies the percentage of blocks reserved for SuperUser, default= 5%
-o creator OS manually overrides default value 
-q quiet execution
-v verbose
-F forces mk2fs to run even if the device isn't a block special device
-L volume label sets the filesystem's volume label
-M last mounted directory sets the last mounted directory for the filesystem
-r revision sets the filesystem revision for the filesystem
-R RAID options sets RAID related options for the filesystem
-S Write superblock and group description only

 


mkswap

Makes a swap partition on a partition created with fdisk and marked as type 82.

First you have to create the /swap file and its block size, use the command:

# dd  if=/dev/zero  of =swapfile  bs=1024  count=131073

Syntax:

# mkswap  [ -c ]  device_size_in_blocks

Example:

# mkswap  -c  /swap  131073

Next use the sync command and to make the swap file active, use the command:

# swapon /swap

To get rid of the swap file first use the sync command, then issue the command:

# swapoff /swap

BACK