Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 496562 - fstab: default should recommend mounting by LABEL/UUID rather than /dev/name
Summary: fstab: default should recommend mounting by LABEL/UUID rather than /dev/name
Status: IN_PROGRESS
Alias: None
Product: Gentoo Release Media
Classification: Unclassified
Component: Stages (show other bugs)
Hardware: AMD64 Linux
: Normal minor
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-31 07:34 UTC by Sergey S. Starikoff
Modified: 2016-10-14 09:57 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey S. Starikoff 2013-12-31 07:34:53 UTC
Now (stage3-amd64-20131226) default /ets/fstab is:
grep -v ^# fstab 
/dev/BOOT		/boot		ext2		noauto,noatime	1 2
/dev/ROOT		/		ext3		noatime		0 1
/dev/SWAP		none		swap		sw		0 0
/dev/cdrom		/mnt/cdrom	auto		noauto,ro	0 0
/dev/fd0		/mnt/floppy	auto		noauto		0 0

Connecting additional hdd (or removing an existing one) could change disk name, making fstab inoprable.

So, it is a time to change it to something like:
UUID=		/boot		ext2		noauto,noatime	1 2
UUID=		/		ext3		noatime		0 1
UUID=		none		swap		sw		0 0
/dev/cdrom	/mnt/cdrom	auto		noauto,ro	0 0
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info

Or even switch to providing real (operable and human-readable) fstab file:
LABEL=BOOT	/boot		ext2		noauto,noatime	1 2
LABEL=ROOT	/		ext3		noatime		0 1
LABEL=SWAP	none		swap		sw		0 0
LABEL=HOME	/home		ext2		noatime		0 1
#/dev/cdrom		/mnt/cdrom	auto		noauto,ro	0 0
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info

Also:
I think that floppy disk device is enough outdated to be removed from default config.
Expecting user want to use auto (udev) mounting means, that cdrom string should be commented by default.
Remind about separate /home partition for most users is more useful, than separate /boot partition.
Comment 1 David Heidelberg (okias) 2013-12-31 15:22:33 UTC
yes, floppy is outdated, root partition is rather ext4 than 3. Not sure about /dev/cdrom, as I recall - mostly it's used sr0 (not sure about that).

using LABEL isn't much reliable, but could be nicely managed readable.

If we add UUID=, we should in comment provide some "blkid /dev/sdaX" or "ls -l /dev/disk/by-uuid", because I think people much often doesn't use UUIDs in normal use (at least from my POV).

Home partition. YES, I'm 100% for preparing that item in fstab.
Comment 2 dwfreed 2014-01-01 02:10:24 UTC
The default /etc/fstab you find in stage3s is created by baselayout, which is maintained by the base-system herd.  Of note, this fstab is just a template, to illustrate proper syntax and format of the file.  It's ultimately up to the person doing the installation to customize it to their particular needs, how they'd like to do it.  Some people prefer using dev names, some people prefer using labels, and some people prefer using UUIDs.  Same goes for filesystems.  As for the existence of /dev/cdrom and /dev/fd0, again, it's a template; having those there shows how you'd do mounting for those, and provides a useful reference.

@base-system:
I've added you to CC as I do not yet have privileges to edit bugs.
Comment 3 Jorge Manuel B. S. Vicetto (RETIRED) gentoo-dev 2014-01-01 04:33:45 UTC
(In reply to Sergey S. Starikoff from comment #0)
> Now (stage3-amd64-20131226) default /ets/fstab is:
> grep -v ^# fstab 
> /dev/BOOT		/boot		ext2		noauto,noatime	1 2
> /dev/ROOT		/		ext3		noatime		0 1
> /dev/SWAP		none		swap		sw		0 0
> /dev/cdrom		/mnt/cdrom	auto		noauto,ro	0 0
> /dev/fd0		/mnt/floppy	auto		noauto		0 0
> 
> Connecting additional hdd (or removing an existing one) could change disk
> name, making fstab inoprable.

The name of a disk as always been subject to the way it was connected to a system, so this isn't a "new thing".

> So, it is a time to change it to something like:
> UUID=		/boot		ext2		noauto,noatime	1 2
> UUID=		/		ext3		noatime		0 1
> UUID=		none		swap		sw		0 0
> /dev/cdrom	/mnt/cdrom	auto		noauto,ro	0 0

I'm assigning to base-system as they maintain this file in the baselayout package, so I'll leave any decision up to them. However, I am personally not convinced that UUID labelling is better.

> # Accessible filesystems, by reference, are maintained under '/dev/disk'
> # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
> 
> Or even switch to providing real (operable and human-readable) fstab file:
> LABEL=BOOT	/boot		ext2		noauto,noatime	1 2
> LABEL=ROOT	/		ext3		noatime		0 1
> LABEL=SWAP	none		swap		sw		0 0
> LABEL=HOME	/home		ext2		noatime		0 1
> #/dev/cdrom		/mnt/cdrom	auto		noauto,ro	0 0
> #
> # Accessible filesystems, by reference, are maintained under '/dev/disk'
> # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info

Does the use of LABEL require a GPT partition table?

> Also:
> I think that floppy disk device is enough outdated to be removed from
> default config.
> Expecting user want to use auto (udev) mounting means, that cdrom string
> should be commented by default.
> Remind about separate /home partition for most users is more useful, than
> separate /boot partition.

Something else for the baselayout team to address.
Comment 4 Jorge Manuel B. S. Vicetto (RETIRED) gentoo-dev 2014-01-01 04:48:39 UTC
@base-system:

sorry for the "double spam", but I missed dwfreed had already cc'ed you.
Comment 5 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2014-01-02 00:22:29 UTC
I think this in general should be tackled in two parts, and I've CC'd the docs team.
1. The install guide should explain between using straight devices, UUID, LABEL and mention that other options are possible (/dev/disk/by-*/). It should also warn about symlinks that might be created too late.
2. The fstab should contain examples of each.
3. If they want to use UUID/LABEL, in early boot, they need to make sure their initramfs has disk label support.

(In reply to Jorge Manuel B. S. Vicetto from comment #3)
> (In reply to Sergey S. Starikoff from comment #0)
> > Now (stage3-amd64-20131226) default /ets/fstab is:
> > grep -v ^# fstab 
> > /dev/BOOT		/boot		ext2		noauto,noatime	1 2
..
> > Connecting additional hdd (or removing an existing one) could change disk
> > name, making fstab inoprable.
> The name of a disk as always been subject to the way it was connected to a
> system, so this isn't a "new thing".
Agreed, it's NOT new.

> > So, it is a time to change it to something like:
> > UUID=		/boot		ext2		noauto,noatime	1 2
> > UUID=		/		ext3		noatime		0 1
> > UUID=		none		swap		sw		0 0
> > /dev/cdrom	/mnt/cdrom	auto		noauto,ro	0 0
> I'm assigning to base-system as they maintain this file in the baselayout
> package, so I'll leave any decision up to them. However, I am personally not
> convinced that UUID labelling is better.
When I'm quickly installing a system, typing out a long UUID is a pain. Sure it's a useful in keeping the system more operational, but not useful beyond that.

> > Or even switch to providing real (operable and human-readable) fstab file:
> > LABEL=BOOT	/boot		ext2		noauto,noatime	1 2
...
> > # Accessible filesystems, by reference, are maintained under '/dev/disk'
> > # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
> Does the use of LABEL require a GPT partition table?
No, it does not require GPT, however not all filesystems support useful labels.
You're thinking of PARTLABEL= and PARTUUID=, which both require GPT (they are available in some other partitioning schemes as well actually).

> > Also:
> > I think that floppy disk device is enough outdated to be removed from
> > default config.
+1 on removing floppy

> > Expecting user want to use auto (udev) mounting means, that cdrom string
> > should be commented by default.
Even with automount, you should still have the line present, they are useful and don't harm automount (some automount stuff without sudo can use them too).

> > Remind about separate /home partition for most users is more useful, than
> > separate /boot partition.
> Something else for the baselayout team to address.
- Separate /boot is required for many setups (pretty much anything other than root-on-real-partition and root-on-MD-RAID1).
- Separate /home is required far less often.

My system likes to shuffle disks a lot, and I have a scratch partition that I reformat often, so using UUID or label would be terrible. Instead I have a very consistent name provided by udev:
/dev/disk/by-id/wwn-0x600050e073376b00615e00004d1f0000-part1

I also have SD card readers in my monitors (via USB), and the ordering of them can be maddening, and udev saves me there too:
/dev/disk/by-id/usb-Generic-_SD_MMC_MS_MSPRO_F131C0004C45-0:0
/dev/disk/by-id/usb-Generic_Ultra_HS-SD_MMC_000000264001-0:0
Comment 6 SpanKY gentoo-dev 2014-01-05 22:44:05 UTC
i've updated fstab like so:
http://sources.gentoo.org/baselayout/trunk/share.Linux/fstab?r1=3211&r2=3212

i'll leave docs updating to the docs team.  probably want to add more discussion there than just fstab examples.
Comment 7 Sergey S. Starikoff 2014-01-09 12:26:39 UTC
(In reply to Robin Johnson from comment #5)
> > > Expecting user want to use auto (udev) mounting means, that cdrom string
> > > should be commented by default.
> Even with automount, you should still have the line present, they are useful
> and don't harm automount (some automount stuff without sudo can use them
> too).

At least in my current particular case (I use Xfce-4.10 with native file manager Thunar ar interface for dynamic mount subsystem, currently only for USB devices) you are not right.

My production config (CD-drive is configured for manual mount by user):
$ grep cdrom /etc/fstab 
/dev/sr0		/mnt/cdrom	iso9660		noauto,user,mode=0444	0 0

Inserted disk could be mounted and umounted via terminal or panel plugin.
But it cannot be mounted using thunar, inserted disk doesn't appear on device list (devices, listed in /etc/fstab aren't included in it).
Comment 8 Sergey S. Starikoff 2014-01-26 13:02:21 UTC
(In reply to Jorge Manuel B. S. Vicetto from comment #3)
> (In reply to Sergey S. Starikoff from comment #0)
> > Now (stage3-amd64-20131226) default /ets/fstab is:
> > grep -v ^# fstab 
> > /dev/BOOT		/boot		ext2		noauto,noatime	1 2
> > /dev/ROOT		/		ext3		noatime		0 1
> > /dev/SWAP		none		swap		sw		0 0
> > /dev/cdrom		/mnt/cdrom	auto		noauto,ro	0 0
> > /dev/fd0		/mnt/floppy	auto		noauto		0 0
> > 
> > Connecting additional hdd (or removing an existing one) could change disk
> > name, making fstab inoprable.
> 
> The name of a disk as always been subject to the way it was connected to a
> system, so this isn't a "new thing".

Not only.
On my current system the same device connected to the same port name changed from /dev/sdf (with my first 2.6.37 kernel on this hardware) to /dev/sdb with my current kernel 3.10.25.
Using LABEL mounting I've missed when and how it happened.
Comment 9 Jorge Manuel B. S. Vicetto (RETIRED) gentoo-dev 2015-02-17 03:00:33 UTC
Is there anything left to do here?
Comment 10 SpanKY gentoo-dev 2015-02-17 04:07:36 UTC
i imagine the docs still need updating

as time marches on though, we probably want to suggest people use PARTUUID with their bootloader to find the root on the kernel command line.  that doesn't require an initramfs to work :).
Comment 11 Jorge Manuel B. S. Vicetto (RETIRED) gentoo-dev 2015-10-18 02:31:53 UTC
As I believe there's nothing left here for releng, I'm removing us from CC.
If you need us or I missed anything, feel free to add us back.
Comment 12 Nikos Chantziaras 2016-10-08 05:58:10 UTC
When following the Gentoo Handbook to the letter, it resulted in a system that doesn't boot correctly since it randomly fails to mount filesystems:

https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/System#Creating_the_fstab_file

"Users can also opt to use the symbolic links in the /dev/disk/by-id/ or /dev/disk/by-uuid/ locations."

This is false information. The system will fail to boot if you use "/dev/disk/by-*" locations.
Comment 13 Matthew Marchese Gentoo Infrastructure gentoo-dev 2016-10-11 01:15:54 UTC
I'm on it.
Comment 14 Matthew Marchese Gentoo Infrastructure gentoo-dev 2016-10-14 01:01:42 UTC
This is my initial work to include at least the mentioning of partition labels and UUIDs: http://wiki.gentoo.org/index.php?diff=554720&oldid=552684&rcid=567840

At least the broken part has been removed. I will continue efforts to include PARTUUID and PARTLABEL as time permits.
Comment 15 Nikos Chantziaras 2016-10-14 09:57:17 UTC
The broken part has been removed but re-introduced:

"Users who have gone the GTP route have a couple more 'robust' options available to define partitions in /etc/fstab. Partition labels (/dev/disk/by-partlabel/ and partition UUIDs (/dev/disk/by-uuid/ can be used on GPT formatted devices to uniquely identify the block device's partition(s)."

So it still claims that you can use "/dev/disk/by-*".