fstab issue

Issues related to applications and software problems and general support
Post Reply
LuciusSnow
Posts: 18
Joined: 2020/02/15 22:24:29

fstab issue

Post by LuciusSnow » 2021/07/21 16:50:16

Hi all,

I use two NVME SSD drives. Centos detects them as /dev/nvme0n1p1 and /dev/nvme1n1p1. I assignate the volume labels in fstab like this:

/dev/nvme0n0p1 /media/Video1a ntfs defaults 0 0
/dev/nvme0n1p1 /media/Video1b ntfs defaults 0 0

Everything is fine. But, sometimes, I need to unplug physically the first SSD in nvme0n0p1. The problem, then, is that the second one plugged in nvme1n1p1 becomes nvme0n0p1 and so get Video1a volume label attributed (instead of Video1b). I need to keep it as Video1b everytime with or without the first drive plugged. By the way, for some hardware reasons (too long to explain), I can't swap them physically.

Do you have any idea to solve this?

Thank you very much.

Mike_Rochefort
Posts: 198
Joined: 2016/03/16 02:34:19

Re: fstab issue

Post by Mike_Rochefort » 2021/07/21 16:56:57

I would recommend using the UUID of the partitions, rather than the /dev mount points.

One way to determins the UUIDs is to use lsblk --output UUID <device>. For example:

Code: Select all

# lsblk -p --output NAME,UUID,MOUNTPOINT /dev/sda3
NAME      UUID                                 MOUNTPOINT
/dev/sda3 2a127fe1-5d9d-4e93-894c-4e100b0a7a04 /home
Just lsblk -f will print out all the UUIDs of the system, and specifying a block device (e.g. /dev/sda) provides just the partitions on that device.

Then in fstab you would specify:

Code: Select all

UUID=<UUID_nvme0n0p1> /media/Video1a ntfs defaults 0 0
UUID=<UUID_nvme0n1p1> /media/Video1b ntfs defaults 0 0
Cheers,
Mike
Last edited by Mike_Rochefort on 2021/07/21 17:01:25, edited 3 times in total.
Junior Solutions Architect @RedHat | RHCSA
Feature animation enthusiast formerly @BlueSkyStudios and @Pixar
--
Report CentOS Stream 8 bugs: https://da.gd/c8s-bugs
Report CentOS Stream 9 bugs: https://da.gd/c9s-bugs

LuciusSnow
Posts: 18
Joined: 2020/02/15 22:24:29

Re: fstab issue

Post by LuciusSnow » 2021/07/21 16:59:11

Great! I didn't know it was possible.

Thank you very much.

Mike_Rochefort
Posts: 198
Joined: 2016/03/16 02:34:19

Re: fstab issue

Post by Mike_Rochefort » 2021/07/21 17:10:30

Happy to help! You can define mounts using a variety of options, including the following:

- LABEL
- UUID
- PARTLABEL
- PARTUUID

To see what you currently have available to you, you can run lsblk --output NAME,LABEL,UUID,PARTLABEL,PARTUUID. Explanations for these options can be found in the "first field" part of the man pages: man fstab.

Cheers,
Mike
Junior Solutions Architect @RedHat | RHCSA
Feature animation enthusiast formerly @BlueSkyStudios and @Pixar
--
Report CentOS Stream 8 bugs: https://da.gd/c8s-bugs
Report CentOS Stream 9 bugs: https://da.gd/c9s-bugs

Post Reply

Return to “CentOS 8 - General Support”