LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-05-2022, 11:42 AM   #1
kevinbenko
Member
 
Registered: Jun 2005
Location: Fargo, North Dakota
Distribution: Debian Stable {Probably forever}
Posts: 656

Rep: Reputation: 174Reputation: 174
The Importance of a UUID?


*: I am not a newbie, but I had a stroke in 2011 and am now brain-damaged
===

I have a newish computer that hates me, I have set it up with

3 "permanent" drives, (1 2TB SSD, and 2 3TB HDD)
1 external cd/dvd player,
1 external backup drive (1 8TB HDD)

===

The problem is with the 8 TB HDD. In theory I would only turn it on to make a daily backup. It did work initially, as planned, but I had trouble getting the computer boot/reboot, so I started messing with my /etc/fstab file.

It works BUT I no longer have access to my 8 TB HDD.

The SSD device is
/dev/nve0n1p1 (UEFI)
, /dev/nve0n1p2 (main)
, and /dev/nve0n1p3 (swap)

The HDD are /dev/sda1 (My Real Home Directory and Music)
, /dev/sdb1 (Movies and Old {Rectum} TV Shows (don't ask))
, and /dev/sdc1 (Backup).

/dev/sdc1 has no UUID, my drives are currently about 25% - 30% full.

How do I get me a UUID for /dev/sdc1, and how EXACTLY set up that line in the /etc/fstab for the {bad word} to work.

the problem line in my current /etc/fstab file is:

/dev/sdc1 /home/PUBLIC/BU-1 ext4 defaults,users,noauto,exec,rw 0 2

Do you have any suggestions how I can "fix" this problem?

{{The CD/DVD drive works perfectly (for now)}}

===

Thank you for your time, and have an excellent day!
 
Old 06-05-2022, 11:55 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,781

Rep: Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936
All filesystems have an UUID or an ID of some sort. To find the UUIDs you can look at the output of the command

Code:
lsblk -f
You can easily change the /etc/fstab by replacing the UUID with the device ID like.

Code:
UUID=4c0a0e12-ee87-4dbd-827b-42e480961cb5 /home/PUBLIC/BU-1 ext4 defaults,users,noauto,exec,rw 0 2
UUIDs should be unique so do not use what is posted above.

Last edited by michaelk; 06-05-2022 at 11:57 AM.
 
Old 06-05-2022, 11:56 AM   #3
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,679
Blog Entries: 19

Rep: Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492
You don't actually need a uuid to put a disk into fstab. You can use the device name, in your case /dev/sdc1.

But if you want to know the UUID of it, just do a long listing (ls -l) of /dev/disk/by-uuid.
 
Old 06-05-2022, 12:50 PM   #4
Debian6to11
Member
 
Registered: Jan 2022
Location: Limassol, Cyprus
Distribution: Debian
Posts: 382
Blog Entries: 1

Rep: Reputation: 71
You can also use
Code:
sudo blkid
to find out the UUID of a disk or partition, including some more information.
 
Old 06-05-2022, 01:05 PM   #5
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Rep: Reputation: 164Reputation: 164
You do not need the UUID to mount a device. But let's say your 8TB drive is referenced as /dev/sdc1 in fstab. Then, let's say you add another drive, and Linux maps sdc to the new drive instead of your 8TB drive. So now your drives are mixed up. But if you instead mount the drive by UUID, your mounts will be stable.
 
Old 06-05-2022, 01:24 PM   #6
kevinbenko
Member
 
Registered: Jun 2005
Location: Fargo, North Dakota
Distribution: Debian Stable {Probably forever}
Posts: 656

Original Poster
Rep: Reputation: 174Reputation: 174
The blkid and the sudo blkid does NOT show show my /dev/sdc1

And, yes it is plugged into a USB port.

And, for some odd reason, after I recreated the mount point, it now points as /dev/usb1.

Yes... I am going crazy.
 
Old 06-05-2022, 01:29 PM   #7
kevinbenko
Member
 
Registered: Jun 2005
Location: Fargo, North Dakota
Distribution: Debian Stable {Probably forever}
Posts: 656

Original Poster
Rep: Reputation: 174Reputation: 174
Question, I am "sort of" sure that the problem is that:

1: The computer hates me, and
2: the problem has something to do with my /etc/fstab entry for /dev/sdc1.

But I don't know, because I am asking y'all.

{since I lived Tennessee for three years, I am allowed to use the word "y'all" without feeling embarrassed}

Thank you for you help, and have a glorious day!
 
Old 06-05-2022, 01:32 PM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,781

Rep: Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936
lsblk -f and look in /dev/disk/by-uuid are alternatives to blkid.

Also look at the output of dmesg command after you plug in the drive to see if it is recognized correctly. I have not seen a USB drive associated with /dev/usb1 before.

Last edited by michaelk; 06-05-2022 at 04:04 PM.
 
Old 06-06-2022, 05:37 AM   #9
Debian6to11
Member
 
Registered: Jan 2022
Location: Limassol, Cyprus
Distribution: Debian
Posts: 382
Blog Entries: 1

Rep: Reputation: 71
After a search I found that blkid is part of the util-linux package. I do not know if it is installed by default (if you are using Debian from your info). This is the link: https://packages.debian.org/bullseye/util-linux
You most likely know how to check your packages; I usually use "apt policy <package>"

As far as your disk, you want to mount it with fstab, but why? Since it is an external disk, and I assume, not always connected, I believe in fact you should not use fstab, but rather let it automount via the file manager, or manually mount via the file manager depending on your settings.
I set a Label on the partition with GParted, and manually mount it with the file manager. The mount point is under /media/user/<Label>.

And a quote from a user in these forums about Label:
"With a label, it will automount the partition at /media/user/label; if you don't have a label it will use the UUID."

It makes me wonder why yours got mounted under /dev/usb1.
 
Old 06-06-2022, 06:44 AM   #10
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,679
Blog Entries: 19

Rep: Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492
Quote:
Originally Posted by Debian6to11 View Post
After a search I found that blkid is part of the util-linux package. I do not know if it is installed by default (if you are using Debian from your info). This is the link: https://packages.debian.org/bullseye/util-linux
Yes, it will be there. Util-linux is a very basic part of Linux, almost as basic as coreutils. You have to have it for your system to function.
Quote:
As far as your disk, you want to mount it with fstab, but why? Since it is an external disk, and I assume, not always connected, I believe in fact you should not use fstab, but rather let it automount via the file manager, or manually mount via the file manager depending on your settings.
That's very much a matter of personal taste. Some people prefer to mount by hand in the traditional way.
Quote:
I set a Label on the partition with GParted, and manually mount it with the file manager. The mount point is under /media/user/<Label>.
You can set labels with e2label as well, which is simpler to use.
Quote:
And a quote from a user in these forums about Label:
"With a label, it will automount the partition at /media/user/label; if you don't have a label it will use the UUID."
Or, with a usb stick, under the manufacturer's name
Quote:
It makes me wonder why yours got mounted under /dev/usb1.
Me too. I've never seen a mountpoint like that.
 
Old 06-06-2022, 04:38 PM   #11
kevinbenko
Member
 
Registered: Jun 2005
Location: Fargo, North Dakota
Distribution: Debian Stable {Probably forever}
Posts: 656

Original Poster
Rep: Reputation: 174Reputation: 174
OK, next time a boot/reboot I will pull the USB from that drive and we'll see what happens.

Last edited by kevinbenko; 06-06-2022 at 04:40 PM.
 
Old 06-06-2022, 05:04 PM   #12
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,875
Blog Entries: 1

Rep: Reputation: 2077Reputation: 2077Reputation: 2077Reputation: 2077Reputation: 2077Reputation: 2077Reputation: 2077Reputation: 2077Reputation: 2077Reputation: 2077Reputation: 2077
Quote:
Originally Posted by kevinbenko View Post
2: the problem has something to do with my /etc/fstab entry for /dev/sdc1.
Highly likely you are correct.
Code:
/dev/sdc1 /home/PUBLIC/BU-1 ext4 defaults,users,noauto,exec,rw 0 2
is a relatively low reliability fstab entry.

Assuming 45adb858-db02-4aaf-97fc-93ead2892115 is the actual UUID of your filesystem on /dev/sdc1, which is extremely unlikely, the following would be a maximum reliability entry:
Code:
UUID=45adb858-db02-4aaf-97fc-93ead2892115 /home/PUBLIC/BU-1 ext4 users,noauto,exec 0 0
replacing 45adb858-db02-4aaf-97fc-93ead2892115 with the actual UUID of /dev/sdc1, would maximally reliable.

UUIDs are fine for hard brains, like computers have, but not so good for soft brains, like us humans have. There are alternatives to using /dev/sdc1 and UUID=. The best one for me is LABEL=. I think it would be for you too. Assuming your external 8G is plugged in and ready, do:
Code:
sudo tune2fs -L 8tbBackup1 /dev/sdc1
Next, modify /etc/fstab to read like so:
Code:
LABEL=8tbBackup1 /home/PUBLIC/BU-1 ext4 users,noauto,exec 0 0
The LABEL you select can be anything your brain can cope with, subject to a length limit that depends on filesystem type, which is 16 for EXT4.
 
Old 06-07-2022, 12:12 AM   #13
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,033

Rep: Reputation: 7344Reputation: 7344Reputation: 7344Reputation: 7344Reputation: 7344Reputation: 7344Reputation: 7344Reputation: 7344Reputation: 7344Reputation: 7344Reputation: 7344
uuid is unique, so you can name your device. Or you can set a label which will be unique too and can be used to identify your device.
But without that the system will give it a random name, like sda, sdb, sdc or similar. In general you cannot be sure if you will get the same identifier at every boot, so the fstab entry may or may not be valid. That's why we suggest to use label or uuid.
 
Old 06-07-2022, 05:31 AM   #14
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,679
Blog Entries: 19

Rep: Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492
Quote:
Originally Posted by pan64 View Post
But without that the system will give it a random name, like sda, sdb, sdc or similar. In general you cannot be sure if you will get the same identifier at every boot, so the fstab entry may or may not be valid. That's why we suggest to use label or uuid.
Don't all modern distros use udev rules to ensure consistent naming of drives?
 
Old 06-07-2022, 06:38 AM   #15
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,033

Rep: Reputation: 7344Reputation: 7344Reputation: 7344Reputation: 7344Reputation: 7344Reputation: 7344Reputation: 7344Reputation: 7344Reputation: 7344Reputation: 7344Reputation: 7344
Quote:
Originally Posted by hazel View Post
Don't all modern distros use udev rules to ensure consistent naming of drives?
https://wiki.archlinux.org/title/per..._device_naming

As far as I know
Quote:
The letters a, b, c in the names sda, sdb, sdc are in the same order according to the order in which they are physically connected to the controller. - sometimes. They're ordered in whichever order the kernel detects them first (same as the network devices) which can change on each boot.
Using multithreaded kernel can cause surprises, the order of the detection is unpredictable. Also removable devices can affect the order devices. That's why better to use those persistent names.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] UUID booting: tune2fs cannot set uuid of flash thumb? creates virtual box issue X-LFS-2010 Linux - Newbie 6 06-20-2018 09:28 PM
[SOLVED] /dev/disk/by-uuid/<uuid here> does not exist and initramfs shell Mitt Green Linux - Kernel 4 08-03-2015 11:56 AM
[SOLVED] How to mount by-uuid if the device won't show in /dev/disk/by-uuid untill after blkid /dev/sd* ? masmddr Linux - General 4 01-10-2011 07:38 PM
Change UUID - Edit UUID using the dd command GMHilltop Linux - Newbie 10 10-28-2010 07:39 PM
Volume has problems including no uuid in /dev/disk/by-uuid abejarano Linux - Hardware 3 12-31-2008 08:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration