Linux Classroom Series – 11/Aug/2020

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. Preview
  • Lets execute a simple command sudo df -h on ubuntu (terminal in black) & centos (terminal in blue) Preview Preview
  • Lets add a virtual disk to an ec2 instance
  • Now execute lsblk Preview Preview Preview Preview
  • 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

Preview Preview

  • Lets create a dummy directory /extra, mount and list the disk Preview Preview
  • 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 Preview
  • 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

Preview Preview

  • Now even after restarts your mounts appear.
  • Exercise findout what defaults,nofail 0 2 is

Next Steps

  • Partitions & Logical Volume Manager.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin