Notification texts go here Contact Us Buy Now!

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

Overview

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.

Configuration

1. Use the mkdir to create a new directory called URBackup under /mnt/
[root@Techlanda.com ~]# mkdir /mnt/URBackup
2. Use the blkid command to find the UUID of the partition to be automatically mounted at boot time.
[root@Techlanda.com ~]# blkid (list the UUID)
[root@Techlanda.com ~]# 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.
[root@Techlanda.com ~]# 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.
[root@Techlanda.com ~]# mount -a
(or)
[root@Techlanda.com ~]# mount /mnt/URBackup/
5. Use the mount command to list the currently mounted partitions.
[root@Techlanda.com ~]# mount -l

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



Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.