View previous topic :: View next topic |
Author |
Message |
decuser n00b
Joined: 23 Jan 2003 Posts: 60 Location: Godley, Texas
|
Posted: Sat Jan 13, 2024 10:50 pm Post subject: fstab choices |
|
|
So, my fstab has:
Code: | /dev/sda1 /efi vfat defaults 0 2
/dev/sda2 none swap sw 0 0
/dev/vg0/lv0 / ext4 defaults,noatime |
The problem is, sometimes, it's /dev/sdb1 and /dev/sdb2... I've been using unixy systems for years and occasionally this rears its head. I tend to ignore it or just edit the file to suit the new configuration. Primarily, because UUIDs seem overly complex. Now, I'm a little savvier that I used to be and I think, what's the right way to do this? I like the lvm way, I can totally understand why I need to mount /dev/vg0/lv0 as root and how that will always be appropriate (I created the volume group and added the logical volume, so it could be root). I don't think linux will get confused about it down the road. The same would be true if I were to create a zpool and zfs dataset, but the efi partition and swap partitions are old-school. Is the UUID stuff, the correct, best practice for ensuring that fstab does it's thing correctly with these older schemes? Or, is there a simpler, label the drive thusly when you partition it and refer to the label way that's easier and "just about" as good. Obviously UUIDs become a heck of a lot more interesting with vast numbers of drives, but about the most I can have, even on my desktop is 8 and I don't need 128 bit numbers to hold eight, last I did the math.
Help and thanks!
Will[/code] |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54577 Location: 56N 3W
|
Posted: Sat Jan 13, 2024 11:01 pm Post subject: |
|
|
decuser,
Use PARTUUID or UUID. Both will be unique unless you use dd, then you get to keep the pieces.
A LVM snapshot preserves the filesystem UUID so that can bite you in the bum too.
PARTUUID has one advantage for some users.
The kernel understands root=PARTUUID= without an initrd.
Filesystem UUID, requires the userspace mount command, which compels the use of an initrd.
Once root is mounted, both work equally well.
LABELS ore like UUIDS, except its your problem to make them unique.
Hmm maybe 12 LVs on my Pi5 is a bit excessive :)
Code: | UUID=9e14507f-8e1a-4938-8b8b-3d5afc23c9b3 / ext4 noatime 0 1
UUID=b79fc1ee-8329-42d2-9f7d-74909685619f /usr ext4 noatime 0 0
UUID=8d8c0306-07d1-442e-93f4-64eef426b8aa /home ext4 noatime 0 0
UUID=630e1ef3-8a9b-4fa1-80b2-b1622f314b76 /var ext4 noatime 0 0
UUID=9a6e39d1-5f83-4c56-9389-717912c8e264 /opt ext4 noatime 0 0
UUID=9C91-DBF7 /boot vfat noauto,noatime 0 0
UUID=a8afebbf-7551-4c0f-b862-f670bb05a011 /var/cache/binpkgs ext4 noatime 0 0
UUID=abcbe072-5ab6-4314-846e-cad2f0f5e26e /var/cache/distfiles ext4 noatime 0 0
UUID=6ec5dd99-ab11-4a2a-8ad4-0b79a986b5a7 /var/tmp/portage ext4 noatime 0 0
UUID=bdd5a502-534d-4f50-81dd-5a8960f98254 /var/db/repos ext4 noatime 0 0
UUID=00b96473-0f60-47c8-972d-3d2d8627ca18 /usr/src ext4 noatime 0 0
UUID=54ee040b-9e5a-4ae8-a4f9-6dc3669e7e8d none swap sw 0 0 |
I need to sprinke some nodev,noexec,nosuid optinos there too, which is why there are so many filesystems. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22634
|
Posted: Sat Jan 13, 2024 11:08 pm Post subject: |
|
|
As an alternative to PARTUUID, you may be able to use PARTLABEL, if you labeled your partitions properly. These are human-chosen and generally short, unlike UUIDs.
There is also LABEL (for a filesystem label), but not all filesystems can be labeled. Swap can be labeled at creation time with --label. I don't know about vfat.
The output of blkid should give you UUIDs and, if present, LABELs, so you can determine what options are available without the need to make further changes. |
|
Back to top |
|
|
decuser n00b
Joined: 23 Jan 2003 Posts: 60 Location: Godley, Texas
|
Posted: Sat Jan 13, 2024 11:32 pm Post subject: |
|
|
Well, that was easy. I guess once you get what's what, it just isn't a big deal. Go figure:
Code: | PARTUUID=95907e97-9f28-4a48-b21a-8e67ec3b2929 /efi vfat defaults 0 2
PARTUUID=c2a6217c-f15d-c84c-8ff1-7fcb80e0728f none swap sw 0 0
/dev/vg0/lv0 / ext4 defaults,noatime |
sheesh, what was I thinking? |
|
Back to top |
|
|
decuser n00b
Joined: 23 Jan 2003 Posts: 60 Location: Godley, Texas
|
Posted: Sat Jan 13, 2024 11:36 pm Post subject: |
|
|
NeddySeagoon wrote: | decuser,
Use PARTUUID or UUID. Both will be unique unless you use dd, then you get to keep the pieces.
A LVM snapshot preserves the filesystem UUID so that can bite you in the bum too.
PARTUUID has one advantage for some users.
The kernel understands root=PARTUUID= without an initrd.
Filesystem UUID, requires the userspace mount command, which compels the use of an initrd.
Once root is mounted, both work equally well. |
I'm using LVM until I feel like I'm not gonna hose the system with stoopid changes, so I have to have initrd for that. Once I get the hang of gentoo and settle down, I'll prolly switch back to basic partitions and this info'll come in handy. Thanks! |
|
Back to top |
|
|
decuser n00b
Joined: 23 Jan 2003 Posts: 60 Location: Godley, Texas
|
Posted: Sat Jan 13, 2024 11:38 pm Post subject: |
|
|
Hu wrote: | As an alternative to PARTUUID, you may be able to use PARTLABEL, if you labeled your partitions properly. These are human-chosen and generally short, unlike UUIDs.
There is also LABEL (for a filesystem label), but not all filesystems can be labeled. Swap can be labeled at creation time with --label. I don't know about vfat.
The output of blkid should give you UUIDs and, if present, LABELs, so you can determine what options are available without the need to make further changes. |
blkid is the ticket. Thanks for that. Saved me having to google it. Is it weird that it prints with quotes, but fstab doesn't do quotes, or am I nit picking? |
|
Back to top |
|
|
jb1277976_ n00b
Joined: 30 Oct 2023 Posts: 29
|
Posted: Sun Jan 14, 2024 6:58 am Post subject: |
|
|
decuser wrote: | Hu wrote: | As an alternative to PARTUUID, you may be able to use PARTLABEL, if you labeled your partitions properly. These are human-chosen and generally short, unlike UUIDs.
There is also LABEL (for a filesystem label), but not all filesystems can be labeled. Swap can be labeled at creation time with --label. I don't know about vfat.
The output of blkid should give you UUIDs and, if present, LABELs, so you can determine what options are available without the need to make further changes. |
blkid is the ticket. Thanks for that. Saved me having to google it. Is it weird that it prints with quotes, but fstab doesn't do quotes, or am I nit picking? |
Gentoo has a tool that is borrowed from archlinux. its called genfstab it basically puts all the mount points in fstab for you without you doing it by hand. Code: | genfstab -U / >> /etc/fstab |
Look at fstab after that and you see everything is perfect.
~ Joe B |
|
Back to top |
|
|
decuser n00b
Joined: 23 Jan 2003 Posts: 60 Location: Godley, Texas
|
Posted: Sun Jan 14, 2024 4:19 pm Post subject: |
|
|
jb1277976_ wrote: | Gentoo has a tool that is borrowed from archlinux. its called genfstab it basically puts all the mount points in fstab for you without you doing it by hand. Code: | genfstab -U / >> /etc/fstab |
Look at fstab after that and you see everything is perfect.
~ Joe B |
I've added it to the handful of packages I install in my chroot. With LVM hosting root and EFI, it doesn't seem to matter much about the /EFI and swap partitions when things go wrong, but using a sys-gen'd fstab seems like a good idea to me. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|