Day6 : Linux Filesystem
What is Linux filesystem?
Filesystem defines how data is store in a disk.
Why do we need Filesystem?
Lets say you have created a partition , but partition alone does not make a disk usable in the OS.
The disk and kernel is seen by the linux kernel as raw disk. So, to write to a disk or partition we must first create a filesystem.
After creating filesystem me must mount it to directory and thats when we can read or write data to it.
3 Commonly used Filesystem:
There are 3 commonly used filesystems : ext2, ext3 and etx4.
Steps to Create and Mount a Filesystem on a Partitioned Disk
First lets create a partition of size 250M on disk /dev/xvdb of size 1GB by using gdisk command , please check the screenshot for the detailed steps:
Let's check if the partition of 250M is created on /dev/xvdb disk
Now, that the partition is created next we have to create a filesystem to make this partition usable.
So to create a filesystem use mkfs command , here we are going to make use of ext4 filesystem.
Lets check if the filesystem is created for partition /dev/xvdb1 for this use blkid command.
Next we have to create a directory on which the partition disk will be mounted. We will create /mnt/data directory using mkdir command
Once the directory is created , now the filesystem can be mounted on the system using mount command.
To check if the file system is mounted either use df command or mount command.
To make this mount to be available after system boot make entry to /etc/fstab file like this