Mounting a filesystem from a drive is without doubt one of the most typical duties that you’ll do as you utilize your Linux system. It permits you to entry overseas units inside your machine and manipulate the information inside them. This text will present you learn how to mount a drive in your Linux system in addition to entry information inside disks with completely different inside filesystems.
Mounting an Exterior Drive utilizing the GUI
By default, trendy Linux distros will have the ability to mechanically mount a drive in addition to entry many of the frequent filesystems proper out of the field.
To start out, plug within the drive that you just need to mount to your machine. This might both be an exterior laborious drive or a easy USB drive.
Go to your system’s utility launcher, then open your default file supervisor.
Inside, you will see that your exterior drive on the supervisor’s left sidebar. Click on the label of your drive to totally mount it and look at its contents.
To unmount your drive, click on the small eject icon beside your drive’s label.
Tip: aside from mounting an exterior drive, it’s also possible to mount ISO information in your file supervisor.
Pressure Mount a Drive in Linux utilizing GNOME Disks
Open your system’s utility launcher, then open the Disks utility. It will checklist all of the at present lively drives in your machine. Choose your exterior disk from this system’s left sidebar.
Click on the “Play” button beneath the visible partition desk to your exterior drive. It will forcibly mount the drive to your filesystem.
Open your system’s default file supervisor and scroll by this system’s left sidebar. Click on your exterior drive’s label to entry its contents.
To unmount your exterior drive, return to GNOME Disks. Choose your drive and click on the “Cease” button below your drive’s visible partition desk.
Mounting an Exterior Drive utilizing the Command Line
Whereas utilizing the GUI is sufficient to mount a primary drive in Linux, there will be cases the place you could entry one over SSH as a headless machine. For that, you could use the built-in UNIX mount command.
To start out, plug the drive that you just need to mount, then run the next command:
It will checklist all of the SATA/SCSI units in your machine. Usually, the “sda” disk corresponds to your system drive whereas all the things else after are further, non-system drives.
Run the next command to test if there are any mountable partitions inside your exterior drive:
Create a listing the place your drive can mount itself correctly:
sudo mkdir -p /media/drive
Mount your exterior drive’s partition to your system’s root filesystem. The next command will show all of the contents of your exterior drive to the “/media/drive” folder and transfer your present working listing to it.
sudo mount /dev/sdb1 /media/drive cd /media/drive
Make sure that your drive has the proper permission bits to your present consumer:
sudo chown -R $USER:$USER /media/drive
Test whether or not the drive is working correctly by itemizing its contents:
Mount a Drive in Linux with a Particular Filesystem
One other nice characteristic of the mount command is that it could actually specify the filesystem that it’s going to mount the drive as.
To start out, test the filesystem kind for the obtainable partitions inside your exterior drive:
It will print a listing of the partitions inside your drive together with their filesystem below the second column.
You should utilize the worth within the second column with the
-t choice in mount to power mount a partition as that filesystem:
sudo mount -t vfat /dev/sdb1 /media/drive
Test whether or not you’ve got correctly mounted the filesystem by going contained in the media listing and itemizing its contents:
To unmount the drive, you need to use the umount command adopted by the listing the place the drive is at present mounted:
If you could mount an NTFS partition in your Linux machine, right here is the best way to do it.
Ceaselessly Requested Questions
I’ve a “mount: incorrect fs kind, dangerous choice, dangerous superblock” error after I mount my drive.
This difficulty is because of a lacking filesystem binary in your system. The commonest filesystem that causes this downside is NTFS because it does not come on most Linux distros by default. To repair this, you could set up the
ntfs-3g bundle out of your distro’s bundle supervisor.
My exterior drive is being mounted as “read-only.”
This downside is attributable to an improperly unmounted Ext4 drive. You may repair by remounting the drive both with a “read-write” tag:
sudo mount -o rw /dev/sdb1 /mnt/drive or the “noload” choice:
sudo mount -o ro,noload /dev/sdb1 /mnt/drive.
Is it doable to mechanically mount a drive in Linux?
Sure. To do this, you’ll be able to go to your GNOME Disks program and choose the drive that you just need to automount. Click on the “Gear” icon below the drive’s partition desk, then choose “Edit Mount Choices.” Inside, disable the “Consumer System Defaults” choice, then tick the “Mount at System Startup” checkbox. Alternatively, you’ll be able to add an /and so forth/fstab entry so it could actually auto mount the drive on boot up.
Picture credit score: Immo Wegmann through Unsplash. All alterations and screenshots by Ramces Crimson.