Learn how to completely mount a drive in Linux (and why it’s best to)

Morsa Photographs/Getty Photographs

I presently have 4 exhausting drives within my System76 Thelio desktop. The first drive serves as my working system and the others are strictly for housing several types of recordsdata. I’ve one drive for digital machines, one for music, and one for miscellaneous recordsdata. By laying out my system this fashion, even when the working system fails, my information continues to be accessible.

I’ve these secondary drives arrange such that they’re routinely obtainable always. Within the Linux-verse, that is referred to as “automounting” and it is an essential process you may wish to perceive.

Additionally: Open supply and Linux abilities are nonetheless in demand in a darkish economic system

Automounting is a factor as a result of when you might have secondary drives hooked up to a machine, they are not routinely obtainable to you upon boot of the machine. Sure, you’ll be able to open your desktop file supervisor, navigate to the drive, and mount it by clicking the entry. Nonetheless, this may be problematic in case you overlook to do this and also you both have a backup configured to routinely save recordsdata to that drive otherwise you merely go to avoid wasting a file to that drive from an utility. If the drive is not mounted, the app (or backup) will not be capable of entry the drive.

And that is why we at all times wish to configure these drives for automounting.

Let me present you the way it’s achieved.

Learn how to automount a drive in Linux

What you may want: To make this work, you may want a operating occasion of Linux, a secondary drive plugged into your machine, and a person with sudo privileges. I am going to display with Pop!_OS Linux however the course of must be the identical, no matter which distribution you utilize. I will even assume the drive has been formatted. I at all times format my secondary Linux drives with the ext4 format. When you’re utilizing an NTFS drive (a Home windows drive), you may want to put in the ntfs-3g software program with a command like sudo apt-get set up ntfs-3g.

READ MORE  Australia walks tight rope on trade with China as security concerns mount

Within the output of that command, it’s best to see entries like this:

sda 8:0 0 931.5G 0 disk
└─sda1 8:1 0 931.5G 0 half

Plug the drive in and run the command once more and you may see a brand new entry like:

sdb 8:16 0 931.5G 0 disk
└─sdb1 8:17 0 931.5G 0 half

If you cannot simply unplug the secondary disk, simply run the lsblk command. When you see two drives, sda and sdb, likelihood is superb your secondary drive is sdb. For the aim of exhibiting this course of, we’ll assume the identify of your drive is /dev/sdb.

The mount level would be the listing in your major drive that may function a location you’ll entry the secondary drive from. 

Additionally: Crucial motive you ought to be utilizing Linux at residence

This does not copy or transfer the recordsdata from one to the opposite however, somewhat, creates a spot for the working system to “mount” the secondary drive. Let’s create a mount level referred to as /information with the command:

Subsequent, change the possession of the brand new listing to your person with the command:

sudo chown -R $USER:$USER /information

The -R possibility makes positive all little one folders have the identical possession.

The /and many others/fstab is the file accountable for mapping the secondary drive to the mount level. 

Additionally: 8 issues you are able to do with Linux you could’t do with MacOS or Home windows 

Assuming the identify of your secondary drive is /dev/sdb, we’ll tack on a 1 to the tip (as a result of /dev/sdb1 is the primary usable partition). Open the fstab file for enhancing with the command:

READ MORE  ‘Now and Then,’ the Beatles’ Last Song, Is Here, Thanks to Peter Jackson’s AI

On the backside of that file, add an entry like this:

/dev/sdb1 /information ext4 defaults 0 0

This is a proof:

/dev/sdb1 — the secondary drive/information — the mount pointext4 — the secondary drive file system sort. If that is an NTFS drive, substitute with ntfs-3gdefaults — makes use of the default options0 0 — these fields are for dump and fsck. Simply depart them each as zeros

Save and shut the file with Ctrl-X.

Testing the mount

All you’ll want to do to check the mount is concern the command:

When you obtain no suggestions, every little thing is sweet. Now you can reboot your machine and the secondary drive shall be routinely mounted so you’ll be able to entry the recordsdata from /information.

Additionally: How to decide on the suitable Linux desktop distribution for you

Congratulations, you’ve got simply efficiently arrange a secondary drive automount on Linux.

Leave a Comment