Technology and troubleshooting.

Friday, June 3, 2016

Mounting Linux Filesystems Automatically at Boot Time

  This tutorial describes How to Mounting Filesystems Automatically at Boot Time
Mounting Linux Filesystems Automatically at Boot Time


All devices connected to a Linux system are listed under the /dev directory, including hard disks and partitions. Linux operating systems use partitions with file systems by attaching to them. A partition with a filesystem in the /dev directory, like /dev/sdb1, is attached to a directory in the operating system hierarchy, like /mnt/. This is called mounting: the device is mounted to a directory.

Sometimes it is acceptable to manually mount partitions as they are needed. Often though, a partition was created to be used persistently, and in some cases data stored on the partition may be required to run the system. Instead of mounting partitions manually every time they are needed, it makes more sense to mount them automatically as part of the operating system’s boot up operations.

Key Ideas

Mount: The mount command is used to attach a filesystem to a directory in the operating system’s file hierarchy.
/etc/fstab: The fstab file in the /etc/ directory governs how filesystems are mounted during the operating system’s boot operations. It contains a list of partitions, mount points, and mount options.
UUID: Partitions have a unique identifier called a UUID to provide a stable way of addressing them. The names of devices under /dev is subject to change if, for example, additional hard disks are connected to the system. UUIDs provide a consistent way of addressing partitions.
blkid: The blkid command displays all disk partitions and their associated UUIDs.
mkdir: The mkdir command creates directories.


1. Use the mkdir to create a new directory called URBackup under /mnt/
[ ~]# mkdir /mnt/URBackup
2. Use the blkid command to find the UUID of the partition to be automatically mounted at boot time.
[ ~]# blkid (list the UUID)
[ ~]# blkid /dev/sdb1 (This command assumes that the partition to be automatically mounted at boot time is /dev/sdb1)
3. Edit and save the /etc/fstab file, adding a new line for the new automatic mounting instruction.
Replace this with the output of /dev/sdb1.
[ ~]# vi /etc/fstab
UUID=c2fb3267-26c9-464a-8366-00eaf72c626c /mnt/URBackup    ext4    defaults 0 0
:wq! to save (or) :q! to abort changes
4. Use the mount command with the -a option to mount all entries in the /etc/fstab file.
[ ~]# mount -a
[ ~]# mount /mnt/URBackup/
5. Use the mount command to list the currently mounted partitions.
[ ~]# mount -l

I hope this information is useful for you. Please forgive any typos or incomplete sentences.



Post a Comment

Popular Posts