Posted On March 11, 2023

Linux: how to make automounts persistent

kimconnect 0 comments
blog.KimConnect.com >> Linux >> Linux: how to make automounts persistent
# Step 1: discover the device using its current mount path

mountPath=/media/kim/Data
findmnt | grep $mountPath

$ findmnt | grep $mountPath
├─/media/kim/Data                             /dev/sdb1                                        fuseblk                              rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096

# Step 2: show partition file system type

fsck -N /dev/sdb1

$ fsck -N /dev/sdb1
fsck from util-linux 2.37.2
[/usr/sbin/fsck.ext2 (1) -- /dev/sdb1] fsck.ext2 /dev/sdb1 

# Step 3: Mount the new partition if required
mountPath=/media/kim/Data
partition=/dev/sdb1
sudo mkdir -p $mountPath # create new mount point if it doesn't exist
sudo mount $partition $mountPath # mounting partition toward new target mount point

$ sudo mount $partition $mountPath
Mount is denied because the NTFS volume is already exclusively opened.
The volume may be already mounted, or another software may use it which
could be identified for example by the help of the 'fuser' command.

# Step 4: find disk UUID

partition=sdb1
ls -l /dev/disk/by-uuid/ | grep $partition

$ ls -l /dev/disk/by-uuid/ | grep $partition
lrwxrwxrwx 1 root root 10 Mar 11 11:58 7806E98D06E94D26 -> ../../sdb1

# Step 5: Add this line to /etc/fstab (assuming disk has been formatted as NTFS)
UUID=7806E98D06E94D26 /media/kim/Data ntfs-3g rw 0 0
 
# Reload mounts or reboot
sudo mount -a # or sudo reboot

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

How to Install Ubiquiti Unifi Controller on Ubuntu 20.04

I have a scenario where an existing Unifi controller has been running on a Windows…

CentOS 8: How to Only Apply Security Updates

[cuilo@test-box ~]# sudo yum --security update CentOS-8 - AppStream 12 kB/s | 4.3 kB 00:00…

How to Mount NFS Share On Linux Client

# Install prerequisite sudo apt-get install nfs-common # Set variables nfsShare=test # assuming that the…
Other project: DragonCoin.com