Saturday, December 26, 2020

Chapter 4 : Creating FSTAB entries to automate mounting of partitions of the disk during system boot

 Hi,

In this post/chapter I am going to talk about how to automate the process of mounting of partitions of the disk...

We are going to use the partitions created in chapter-02 to mount automatically , to recollect let me summarize the partitions here briefly...

Disk Partition Partition Name Partition Type Size of the Partition
/dev/sde1bootext2100 MB
/dev/sde2rootext430 GB
/dev/sde3swapswap9.9 GB


The purpose of having this post/chapter is when ever the system is shutdown... the mount point we established would vanish and it becomes tedious for the user to mount the partitions again and again after every system boot.

This is where fstab comes handy as a solution to this problem.

the following would describe the edition of  fstab and check whether the mounting has happened without error...

Identifying the UUID of the partitions

To identify the UUID of the partitions we can the use the utility called "blkid" which would list all the UUID of the partitions available in the system.

$ blkid

The output of the above command is sampled below...


from the above command output, we can inference the following details...

Disk Partition Partition UUID Partition Type
/dev/sde186fa30de-9907-4ced-a5ba-c6043ae04aeeext2
/dev/sde2d9bfa86a-9ba8-4681-9bd0-3c3e25ee9ce3ext4
/dev/sde33ce6bf45-e899-4c48-94b4-0c11305c2353swap


Editing the FSTAB file

Before we edit the fstab file, we have to know the structure of the file, the structure of the table is furnished in the table below to have the understand what each parameter is meant for...

File SystemDenotes the partition name or the UUID of the partition
Mount PointThe location at which the partition is mounted
TypeType of the file system on the partition
OptionsDenotes the options available in the manual page of fdisk
DumpDenotes the flag for the back up, 0=no-backup, 1=yes-backup
Pass-

Based on the above understanding, we would arrive the fstab entries as follows...

File System Mount Point Type Options Dump Pass
UUID=d9bfa86a-9ba8-4681-9bd0-3c3e25ee9ce3 /mnt/lfs ext4 defaults 0 1
UUID=86fa30de-9907-4ced-a5ba-c6043ae04aee /mnt/lfs/boot ext2 defaults 0 1
UUID=3ce6bf45-e899-4c48-94b4-0c11305c2353 swap swap defaults 0 0

Use the command below to edit the fstab file...

$ sudo vi /etc/fstab

after we include the above fstab entires in fstab file, the file would like the one shown below...




Testing or Validating the fstab entries

This testing phase is required after including the fstab entries because the system would not boot properly if there is an error in any of the entries included.

For the SWAP partitions to be mounted, we should have switched on SWAP using the following command

$ sudo swapon /dev/sde3

In order to check or test the entires, use the command below...

$ sudo mount -a

This command would try to mount all the entries made available in the fstab file.

$ sudo mount

This command would display the result of each entires as that of the one show below... you have to cross check whether the partition is mounted correctly or not, if there is no error then the partition would show up or else not.



You can also use an other command to check whether the partitions are mounted correctly or not.

Key in the "lsblk" command at the prompt, to have the result



the command "lsblk" is just an other option, the former is the actual way to check the integrity of the entires...



No comments:

Post a Comment

Addressing Modes of 8080 / 8085 MicroProcessor

Hi,   In this post I am going to talk about different addressing modes of 8080/8085...without much talking let us get into the topic.   Ther...