WARNING: Be sure to use an empty partition! Accidentally entering the wrong device filename could wipe out your entire system!
This exercise uses a few commands that are described in more detail later in this Lesson. To create some filesystems, follow these steps:
- Log in as
root
.
- Use
fdisk
to verify the partitions on your target disk by typing fdisk -l /dev/sdc
. You should see a list of partitions, including the one you'll use for your tests. (If fdisk
reports a single partition with ee
under the Id
column, the disk is a GPT disk, and you should verify the disk's partitions with gdisk
rather than fdisk
.)
- Verify that your test partition is not currently mounted. Type
df
to see the currently mounted partitions and verify that /dev/sdc1
is not among them.
- Type
mkfs -t ext2 /dev/sdc1
. You should see several lines of status information appear.
- Type
mount /dev/sdc1 /mnt
to mount the new filesystem to /mnt
. (You may use another mount point if you like.)
- Type
df /mnt
to see basic accounting information for the filesystem. On our test system with a /dev/sdc1
that's precisely 1000MiB in size, 1,007,896 blocks are present; 1,264 are used, and 955,432 blocks are available. Most of the difference between the present and available blocks is caused by the 5 percent reserved space.
- Type
umount /mnt
to unmount the filesystem.
- Type
mkfs -t ext2 -m 0 /dev/sdc1
to create a new ext2 filesystem on the device, but without any reserved space.
- Repeat steps 5–7. Note that the available space has increased (to 1,006,632 blocks on our test disk). The available space plus the used space should now equal the total blocks.
- Repeat steps 4–7, but use a filesystem type code of
ext3
to create a journaling filesystem. (This won't be possible if you use a floppy disk.) Note how much space is consumed by the journal.
- Repeat steps 4–7, but use another filesystem, such as JFS or ReiserFS. Note how the filesystem creation tools differ in the information that they present and in their stated amounts of available space.
Be aware that, because of differences in how filesystems store files and allocate space, a greater amount of available space when a filesystem is created may not translate into a greater capacity to store files.