Table of Content

Weight: 2

Description: Candidates should be able to configure disk partitions and then create filesystems on media such as hard disks. This includes the handling of swap partitions.

Key Knowledge Areas:

  • Manage MBR partition tables
  • Use various mkfs commands to create various – – filesystems such as:
    ext2/ext3/ext4
    XFS
    VFAT
  • Awareness of ReiserFS and Btrfs
  • Basic knowledge of gdisk and parted with GPT

Terms and Utilities:

fdisk
gdisk
parted
mkfs
mkswap

mkfs

sudo mkfs -t ext2 /dev/sdb1
sudo mkfs -t ext3 /dev/sdb1
sudo mkfs.xfs /dev/sdb1 … or sudo mkfs -t xfs /dev/sdb1
sudo mkfs -t reiserfs /dev/sdb1
sudo mkfs -t vfat /dev/sdb1

swap

create swap 
sudo mkswap /dev/sdb2

activate swap
sudo swapon /dev/sdb2

check status 
swapon -s

change filesystem

dumpe2fs [options] device .. Most popular option is -h It can be run while mounted
tune2fs Must unmount device to use.
The tune2fs program enables you to change many of the filesystem parameters that are reported by dumpe2fs. This program's syntax is fairly simple, but it hides a great deal of complexity.

tune2fs [options] device

make ext2 and convert to ext3

dd if=/dev/zero of=filesystem bs=1M count=4
/sbin/mke2fs filesystem
/sbin/tune2fs -j filesystem

debugfs

A utility to interactively modify a filesystems features. This program provides the ability of dumpe2fs , tune2fs and many ofLinux’s normal file-maipulation tools all rolled into one.

ext2 filesystem type is the only one without journaling. using the -j option in tune2fs adds the journaling feature converting it to an ext3 FS.

make reiserfs fs

dd if=/dev/zero of=filesystem bs=1M count=60
/sbin/mkreiserfs -f filesystem
mount -o loop filesystem /mnt/
cp -a /usr/ /mnt/ 2>/dev/null
/sbin/reiserfsck --rebuild-tree filesystem

Quiz questions

1. Name five file systems that can be created with mkfs.
2. When does the kernel read the partition table on the hard disks?
3. Under what circumstances will the kernel not reread the partition table after running fdisk,
and what error message is displayed?
4. What is the command to make a vfat filesystem on an existing partition, hda3?
Answers to quiz questions
1. ext2, jfs, ext3, minix, msdos, reiserfs
2. At startup and after running fdisk
3. When one of the partitions is in use – mounted or used as swap space.
4. mkfs.msdos /dev/hda3