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 fix outdated and unsupported Ubuntu versions

rooty@FOGSERVER01$ lsb_release -aNo LSB modules are available.Distributor ID: UbuntuDescription: Ubuntu 13.10Release: 13.10Codename: saucyUbuntu 13.10 (Saucy…

Networking: Upgrading Legacy Ubiquiti Devices

Step 1: obtain the bin URL from https://www.ui.com/download/unifi/unifi-ap/uaplr Step 2: perform the upgrade rambo@kimlinux:/home/rambo# ssh…

How to Setup Software RAID on Ubuntu 20.04

Step 1: prepare to configure RAID by checking the system In the below example, we're…