Managing File Systems
Mounting & Unmounting Local disks
- Filesystem on a partition or volume is mounted so that it appears as another subdirectory on the system.
- Lets execute a simple command sudo df -h on ubuntu (terminal in black) & centos (terminal in blue)
- Lets add a virtual disk to an ec2 instance
- Now execute lsblk
- Since we need to create file system you can choose any file system of your choice (ext4, xfs, btrfs)
sudo mkfs -t ext4 /dev/xvdf
- Lets create a dummy directory /extra, mount and list the disk
- Now if we restart the machine and check the mounts, mounts will not appear as linux will mount only the disks which have entries in /etc/fstab
- Lets have a backup of current fstab
sudo cp /etc/fstab /etc/fstab.orig
- Lets list the block ids
- Now lets edit fstab to add entries, The basic format is
/dev/device /dir/to/mount fstype Paramters fs_freq fs_passno
# or
UUID=<uuid> <directory to mount> <filesystem> Paramters fs_freq fs_passno
- Now even after restarts your mounts appear.
- Exercise findout what defaults,nofail 0 2 is
Next Steps
- Partitions & Logical Volume Manager.
