LPI Linux Certification/Operating The Linux File System
Candidates should be able to properly configure and navigate the standard Linux filesystem. This objective includes configuring and mounting various filesystem types.
- Key Knowledge Areas:
- The concept of the fstab configuration
- Tools and utilities for handling SWAP partitions and files
- Use of UUIDs
- The following is a partial list of the used files, terms and utilities:
- mount and umount
Mounting and umounting partition
To access an existing partition you need to mount it first using the mount command.
For example if you want to mount a ntfs partition on /mnt/windows you should issue the following command:
mount -t ntfs /dev/hda3 /mnt/windows
Of course you need to change hda3 with your ntfs partition.
To umount a partition you simply need to use umount
If you use mount without arguments it will print the currently mounted devices, you can also see /proc/mounts and /etc/mtab to discover which partition are currently mounted.
If you want to use a more automatic method to mount filesystem you should edit /etc/fstab
<file system> <mount point> <type> <options> <dump> <pass> proc /proc proc defaults 0 0 /dev/hda2 / ext3 defaults 0 1 /dev/hda4 none swap defaults 0 0 /dev/hda1 /boot ext3 defaults 0 2 /dev/hda3 /mnt/windows ntfs defaults 0 0 /dev/hdb /media/cdrom iso9660 ro,user,noauto 0 0 /dev/fd0 /media/floppy auto user,noauto 0 0
In the above example of /etc/fstab we have the ntfs partition mounted automatically during the system boot on /mnt/windows, while on the cdrom and floppy devices we have specified the noauto and user options, this means that they aren't mounted during boot but also that any user can mount it whenever they need. The sixth field should be 1 for root filesystem and 2 for other fs that need to be checked with fsck during boot.
The swap partition can be used as virtual memory, to create a swap partition you should use mkswap
and need to be activated with swapon
you can also deactivate it with swapoff
The sync utility can be used to force the change onto the partition, modern filesystem like ext3 or reiserfs sync the partition every time that a change is made so you don't need to issue the command manually.