Making and Managing Linux Filesystems

Posted: September 22, 2010 in REDHAT 5 LinUX

Programs used to manage filesystems

  • badblocks(8) – Search a device for badblocks. The command “badblocks /dev/hda” will search the first partition of the first IDE hard drive for badblocks.
  • cfdisk(8) – A partition table manipulator used to create or delete disk partitions.
  • dosfsck(8) – Used to check a msdos filesystem.
  • dumpe2fs(8) – Lists the superblock and blocks group information on the device listed. Use with a command like “dumpe2fs /dev/hda2”. The filesystem on the device must be a Linux filesystem for this to work.
  • fdformat(8) – Performs s lowlevel format on a floppy disk. Ex: “fdformat /dev/fd0H1440”.
  • fdisk(8) – Used to add or remove partitions on a disk device. It modifies the partition table entries.
  • fsck(8) – Used to check and/or repair a Linux filesystem. This should only be used on systems that are not mounted.
  • hdparm(8) – Used to get or set the hard disk parameters.
  • mkdosfs(8) – Used to create a msdos filesystem.
  • mke2fs(8) – Create a Linux native filesystem which is called a second extended filesystem. This creates the current version of the Linux filesystem.
  • mkfs(8) – Used to make a Linux filesystem on a device. The command “mkfs /dev/hdb1” will create a Linux filesystem on the first partition of the second IDE drive.
  • mkswap(8) – Creates a Linux swap area on a device.
  • mount(8) – Used to mount a filesystem. It supports many types of filesystems.
  • stat(1u) – Used to print out inode information on a file. Usage: stat filename
  • swapoff(8) – Used to de-activate a swap partition.
  • swapon(8) – Used to activate a swap partition.
  • tune2fs(8) – Used to adjust filesystem parameters that are tunable on a Linux second extended filesystem. The filesystem must not be mounted write when this operation is performed. Can adjust maximum mount counts between filesystem checks, the time between filesystem checks, the amount of reserved blocks, and other parameters.
  • umount(8) – Unmount a filesystem.

Making a Filesystem

Making a swap partition

type “mkswap -c /dev/hda3 10336”

The -c has swap check for bad blocks. The 10336 is the size of the partition in blocks, about 10M. The system enables swap partitions at boot time, but if installing a new system you can type “swapon /dev/hda3” to enable it immediately.

Making an ext2 file system on a floppy

  1. fdformat /dev/fd0H1440
  2. mkfs -t ext2 -c /dev/fd0H1440

Other file systems:
A normal hard drive can have many types of filesystems on it. To create an ext2 file system, type “mke2fs -c /dev/hda2 82080” to create an 82 meg filesystem. Note: mkfs is a front end to many file system types including ext2, minux, and msdos.

Checking a Filesystem

fsck – Used to check and repair a filesystem.
fsck is a front end to a filesystem type specific fsck.ext2, fsck.minix, and fsck.msdos.
Syntax: fsck -t type device

Ex: fsck -t ext2 /dev/hda3


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s