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

Uhhuh. NMI received for unknown reason 3d on CPU 4

Problem: Message from syslogd@linux03 at Aug 31 04:28:21 ... kernel:[273033.123489] Uhhuh. NMI received for unknown…

How To Create a 64-bit Linux Bootable USB Thumb Drive with 32-bit UEFI Compatibility

Part 1: Making the USB Booting Thumb Drive Download Rufus: https://rufus.ie/ Download Linux ISO -…

How To Install Graylog in a Kubernetes Cluster Using Helm Charts

The following narrative is based on the assumption that a Kubernetes (current stable version 20.10)…