Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > alt.os.linux > #54372 > unrolled thread

mounting disks by label instead of UUID

Started byconrrrod@gmail.com
First post2019-03-09 00:31 -0800
Last post2019-03-09 13:11 +0100
Articles 15 — 9 participants

Back to article view | Back to alt.os.linux


Contents

  mounting disks by label instead of UUID conrrrod@gmail.com - 2019-03-09 00:31 -0800
    Re: mounting disks by label instead of UUID Bit Twister <BitTwister@mouse-potato.com> - 2019-03-09 03:43 -0600
      Re: mounting disks by label instead of UUID Chris Elvidge <chris@mshome.net> - 2019-03-09 10:20 +0000
        Re: mounting disks by label instead of UUID Pascal Hambourg <pascal@plouf.fr.eu.org> - 2019-03-11 21:40 +0100
          Re: mounting disks by label instead of UUID "Carlos E.R." <robin_listas@es.invalid> - 2019-03-11 22:02 +0100
            Re: mounting disks by label instead of UUID Jasen Betts <jasen@xnet.co.nz> - 2019-03-12 08:14 +0000
          Re: mounting disks by label instead of UUID "J.O. Aho" <user@example.net> - 2019-03-11 22:17 +0100
            Re: mounting disks by label instead of UUID Pascal Hambourg <pascal@plouf.fr.eu.org> - 2019-03-11 22:39 +0100
              Re: mounting disks by label instead of UUID "J.O. Aho" <user@example.net> - 2019-03-11 23:26 +0100
          Re: mounting disks by label instead of UUID "David W. Hodgins" <dwhodgins@nomail.afraid.org> - 2019-03-11 18:45 -0400
    Re: mounting disks by label instead of UUID "J.O. Aho" <user@example.net> - 2019-03-09 12:21 +0100
      Re: mounting disks by label instead of UUID Pascal Hambourg <pascal@plouf.fr.eu.org> - 2019-03-11 21:50 +0100
        Re: mounting disks by label instead of UUID "J.O. Aho" <user@example.net> - 2019-03-11 22:12 +0100
          Re: mounting disks by label instead of UUID Eric Pozharski <whynot@pozharski.name> - 2019-03-12 13:30 +0200
    Re: mounting disks by label instead of UUID "Carlos E.R." <robin_listas@es.invalid> - 2019-03-09 13:11 +0100

#54372 — mounting disks by label instead of UUID

Fromconrrrod@gmail.com
Date2019-03-09 00:31 -0800
Subjectmounting disks by label instead of UUID
Message-ID<d3e5603c-4550-4b5b-917c-544cc006efce@googlegroups.com>
I like to use labelled partitions, so I can clone disks. So when I install
linux, I have to drill down to the options to label them, otherwise one
gets the UUID crap or even worse the by-id model_serial in Suse Enterprise.
So if linux was not installed with the label option, do you only have to
edit /etc/fstab and /boot/grub.conf to use the labels?
Second issue: when you update and get a new kernel, grub.conf will be
modified, and does that revert back to the UUID method?

[toc] | [next] | [standalone]


#54373

FromBit Twister <BitTwister@mouse-potato.com>
Date2019-03-09 03:43 -0600
Message-ID<slrnq872lo.55k.BitTwister@wb.home.test>
In reply to#54372
On Sat, 9 Mar 2019 00:31:24 -0800 (PST), conrrrod@gmail.com wrote:
> I like to use labelled partitions, so I can clone disks.

Yup, I use them, even swap.
Works great as long as no two partitions have the same label.
I have a usb hard drive I use for off system backup.
I had the same partition names and as soon as the drive came up the
current / partition was mounted on top of the system /.  :-(

Had to shutdown the system, boot a rescue cd, added _bkup to partitions
on usb drive then could go back to having both system and usb drive
mounted when I do backups.

> So when I install
> linux, I have to drill down to the options to label them, otherwise one
> gets the UUID crap or even worse the by-id model_serial in Suse Enterprise.

Sounds like Mageia Linux which I use. During install I have to do custom
partitioning, then set label on each partition.

> So if linux was not installed with the label option, do you only have to
> edit /etc/fstab and /boot/grub.conf to use the labels?

Yes. Just not sure if you would need to run dracut -f to rebuild
initrd/vmlinuz files.

> Second issue: when you update and get a new kernel, grub.conf will be
> modified, and does that revert back to the UUID method?

Do not know about Suse, but I guess you will have to do it one way
or another.

Since I do not enter all my partitions during install, I wrote a script
to automagically change all UUIDs to LABEL in /etc/fstab.

As for grub2, I dropped my own script into /etc/grub.d which creates
menu selections and boot selections which use partition labels.

[toc] | [prev] | [next] | [standalone]


#54374

FromChris Elvidge <chris@mshome.net>
Date2019-03-09 10:20 +0000
Message-ID<q6041j$kms$1@dont-email.me>
In reply to#54373
On 09/03/2019 09:43, Bit Twister wrote:
> On Sat, 9 Mar 2019 00:31:24 -0800 (PST), conrrrod@gmail.com wrote:
>> I like to use labelled partitions, so I can clone disks.
> 
> Yup, I use them, even swap.
> Works great as long as no two partitions have the same label.
> I have a usb hard drive I use for off system backup.
> I had the same partition names and as soon as the drive came up the
> current / partition was mounted on top of the system /.  :-(
> 
> Had to shutdown the system, boot a rescue cd, added _bkup to partitions
> on usb drive then could go back to having both system and usb drive
> mounted when I do backups.
> 
>> So when I install
>> linux, I have to drill down to the options to label them, otherwise one
>> gets the UUID crap or even worse the by-id model_serial in Suse Enterprise.
> 
> Sounds like Mageia Linux which I use. During install I have to do custom
> partitioning, then set label on each partition.
> 
>> So if linux was not installed with the label option, do you only have to
>> edit /etc/fstab and /boot/grub.conf to use the labels?
> 
> Yes. Just not sure if you would need to run dracut -f to rebuild
> initrd/vmlinuz files.
> 
>> Second issue: when you update and get a new kernel, grub.conf will be
>> modified, and does that revert back to the UUID method?
> 
> Do not know about Suse, but I guess you will have to do it one way
> or another.
> 
> Since I do not enter all my partitions during install, I wrote a script
> to automagically change all UUIDs to LABEL in /etc/fstab.
> 
> As for grub2, I dropped my own script into /etc/grub.d which creates
> menu selections and boot selections which use partition labels.
> 

While you might find using labels easier for fstab (I do, too), you 
should leave grub to use UUIDs - they are unique after all. And 
actually, why do you care what grub-mkconfig puts in grub.cfg? Two 
partitions with the same label can confuse things, especially at boot.

OP: Why do you think using labels makes it easier to clone disks?

-- 

Chris Elvidge, England

[toc] | [prev] | [next] | [standalone]


#54378

FromPascal Hambourg <pascal@plouf.fr.eu.org>
Date2019-03-11 21:40 +0100
Message-ID<q66h3n$18ur$1@saria.nerim.net>
In reply to#54374
Le 09/03/2019 à 11:20, Chris Elvidge a écrit :
> On 09/03/2019 09:43, Bit Twister wrote:
>> On Sat, 9 Mar 2019 00:31:24 -0800 (PST), conrrrod@gmail.com wrote:
>>> I like to use labelled partitions, so I can clone disks.
> 
> While you might find using labels easier for fstab (I do, too), you 
> should leave grub to use UUIDs - they are unique after all.

Not if you have cloned disks.

> actually, why do you care what grub-mkconfig puts in grub.cfg?

Because you have cloned disks with the same UUIDs.

> OP: Why do you think using labels makes it easier to clone disks?

Because you can change labels more easily than UUIDs. Not all 
filesystems seem to have a tool allowing to change the UUID, e.g. FAT 
and btrfs.

[toc] | [prev] | [next] | [standalone]


#54380

From"Carlos E.R." <robin_listas@es.invalid>
Date2019-03-11 22:02 +0100
Message-ID<ovuilf-pqh.ln1@Telcontar.valinor>
In reply to#54378
On 11/03/2019 21.40, Pascal Hambourg wrote:
> Le 09/03/2019 à 11:20, Chris Elvidge a écrit :


>> OP: Why do you think using labels makes it easier to clone disks?
> 
> Because you can change labels more easily than UUIDs. Not all
> filesystems seem to have a tool allowing to change the UUID, e.g. FAT
> and btrfs.

I recall reading that the uuid may be replicated in metadata across the
entire filesystem. Was it XFS?  Changing the UUID means rewriting all
that, if possible.

I'm unsure I got it correct, though, so take the above with care.

-- 
Cheers, Carlos.

[toc] | [prev] | [next] | [standalone]


#54389

FromJasen Betts <jasen@xnet.co.nz>
Date2019-03-12 08:14 +0000
Message-ID<q67pok$mt8$3@gonzo.revmaps.no-ip.org>
In reply to#54380
On 2019-03-11, Carlos E.R. <robin_listas@es.invalid> wrote:
> On 11/03/2019 21.40, Pascal Hambourg wrote:
>> Le 09/03/2019 à 11:20, Chris Elvidge a écrit :
>
>
>>> OP: Why do you think using labels makes it easier to clone disks?
>> 
>> Because you can change labels more easily than UUIDs. Not all
>> filesystems seem to have a tool allowing to change the UUID, e.g. FAT
>> and btrfs.
>
> I recall reading that the uuid may be replicated in metadata across the
> entire filesystem. Was it XFS?  Changing the UUID means rewriting all
> that, if possible.

ext2 puts a copy of the superblock in several places it prints a list

the seem to be multiples of 3 and 5

let's formating /dev/null :)

$ mkfs.ext3 -b 1024 /dev/null 1000000000 
mke2fs 1.42.9 (4-Feb-2014)
/dev/null is not a block special device.
Proceed anyway? (y,n) y
mkfs.ext3: Filesystem larger than apparent device size.
Proceed anyway? (y,n) y
warning: Unable to get device geometry for /dev/null
Warning: could not erase sector 2: No such device
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
62500352 inodes, 1000000000 blocks
50000000 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=1067188224
122071 block groups
8192 blocks per group, 8192 fragments per group
512 inodes per group
Superblock backups stored on blocks: 
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409, 663553, 
1024001, 1990657, 2809857, 5120001, 5971969, 17915905, 19668993, 
25600001, 53747713, 128000001, 137682945, 161243137, 483729409, 
640000001, 963780609

seems to be one above 8192 of a power of 3,5 or 7

-- 
  When I tried casting out nines I made a hash of it.

[toc] | [prev] | [next] | [standalone]


#54382

From"J.O. Aho" <user@example.net>
Date2019-03-11 22:17 +0100
Message-ID<geo1iiF4kmfU1@mid.individual.net>
In reply to#54378
On 3/11/19 9:40 PM, Pascal Hambourg wrote:
> Le 09/03/2019 à 11:20, Chris Elvidge a écrit :
>> On 09/03/2019 09:43, Bit Twister wrote:
>>> On Sat, 9 Mar 2019 00:31:24 -0800 (PST), conrrrod@gmail.com wrote:
>>>> I like to use labelled partitions, so I can clone disks.
>>
>> While you might find using labels easier for fstab (I do, too), you 
>> should leave grub to use UUIDs - they are unique after all.
> 
> Not if you have cloned disks.

If it's for cloning for another machine, then no need to change 
anything, if it's for having a security copy, just don't leave it 
connected to the machine or else you may damage it when you get a surge.

>> actually, why do you care what grub-mkconfig puts in grub.cfg?
> 
> Because you have cloned disks with the same UUIDs.
> 
>> OP: Why do you think using labels makes it easier to clone disks?
> 
> Because you can change labels more easily than UUIDs. Not all 
> filesystems seem to have a tool allowing to change the UUID, e.g. FAT 
> and btrfs.

FAT not really a Linux file system, so no tool made but there is script 
that does the same thing and btrfs has support for chaining UUID and a 
far better way of cloning than using dd (dd ain't recommended for 
cloning btrfs).

-- 

  //Aho

[toc] | [prev] | [next] | [standalone]


#54383

FromPascal Hambourg <pascal@plouf.fr.eu.org>
Date2019-03-11 22:39 +0100
Message-ID<q66khu$19r1$1@saria.nerim.net>
In reply to#54382
Le 11/03/2019 à 22:17, J.O. Aho a écrit :
> 
> btrfs has support for chaining UUID
What do you mean by "chaining UUID" ?

(sorry for the private reply)

[toc] | [prev] | [next] | [standalone]


#54385

From"J.O. Aho" <user@example.net>
Date2019-03-11 23:26 +0100
Message-ID<geo5jvF5frbU1@mid.individual.net>
In reply to#54383
On 3/11/19 10:39 PM, Pascal Hambourg wrote:
> Le 11/03/2019 à 22:17, J.O. Aho a écrit :
>>
>> btrfs has support for chaining UUID
> What do you mean by "chaining UUID" ?


a minor misspelling , should have been changing as in change the UUID.

-- 

  //Aho

[toc] | [prev] | [next] | [standalone]


#54386

From"David W. Hodgins" <dwhodgins@nomail.afraid.org>
Date2019-03-11 18:45 -0400
Message-ID<op.zyiet1k1a3w0dxdave@hodgins.homeip.net>
In reply to#54378
On Mon, 11 Mar 2019 16:40:23 -0400, Pascal Hambourg <pascal@plouf.fr.eu.org> wrote:

> Because you can change labels more easily than UUIDs. Not all
> filesystems seem to have a tool allowing to change the UUID, e.g. FAT
> and btrfs.

While I agree that cloned disks will have duplicate uuids and labels,
and prefer to use labels in my fstab entries, I've yet to see a partition
type that does not support changing both it's uuid and label. When I
clone a disk, I make sure I change both the uuid and the label for every
partition on the new copy.

For changing the uuid, fat has "mlabel -N serial device" (the serial
is used
as the uuid). For btrfs it's done with "btrfstune -u device" or
"btrfstune -U newuuid device".

Regards, Dave Hodgins

-- 
Change dwhodgins@nomail.afraid.org to davidwhodgins@teksavvy.com for
email replies.

[toc] | [prev] | [next] | [standalone]


#54375

From"J.O. Aho" <user@example.net>
Date2019-03-09 12:21 +0100
Message-ID<gehlteFmto9U1@mid.individual.net>
In reply to#54372
On 3/9/19 9:31 AM, conrrrod@gmail.com wrote:
> I like to use labelled partitions, so I can clone disks.

The label will also be cloned, you will need to change the label of the 
clone or else that one may be mounted instead of the original.

So why not change the UUID on the clone?
After you cloned the partition just run

tune2fs /dev/sdYX -U random

where Y is the letter your or drive and X is the partition number, keep 
in mind to have your clone unmounted during this process.

To figure out UUID you can use blkid:

blkid | grep UUID | grep sdYX



> So if linux was not installed with the label option, do you only have to
> edit /etc/fstab and /boot/grub.conf to use the labels?

In some cases (specially older versions of Linux distributions) grub may 
not have support for LABEL/UUID, which could make booting to fail.

Of course you have to ensure that you have a label on the disk before 
you change fstab or grub.conf.



Don't forget to regenerate your initramfs image after you changed your 
fstab, regardless if you use LABEL or UUID.


> Second issue: when you update and get a new kernel, grub.conf will be
> modified, and does that revert back to the UUID method?

Depends on your /etc/default/grub and your distributions script in 
/etc/grub.d/ for generating boot options for Linux (most often 10_linux).


-- 

  //Aho

[toc] | [prev] | [next] | [standalone]


#54379

FromPascal Hambourg <pascal@plouf.fr.eu.org>
Date2019-03-11 21:50 +0100
Message-ID<q66hni$194l$1@saria.nerim.net>
In reply to#54375
Le 09/03/2019 à 12:21, J.O. Aho a écrit :
> 
> So why not change the UUID on the clone?

Because this is not always possible or easy.

> After you cloned the partition just run
> 
> tune2fs /dev/sdYX -U random

How do you do with a FAT or btrfs filesystem ?

> blkid | grep UUID | grep sdYX

How an ugly UUoG. What about this instead ?

blkid -s UUID /dev/sdYX

>> Second issue: when you update and get a new kernel, grub.conf will be
>> modified, and does that revert back to the UUID method?
> 
> Depends on your /etc/default/grub and your distributions script in 
> /etc/grub.d/ for generating boot options for Linux (most often 10_linux).

The only available option is GRUB_DISABLE_LINUX_UUID which allows to 
disable use of UUIDs and use device names instead in the root= kernel 
command line parameter only. There is no option to tell grub-mkconfig to 
use labels instead of UUIDs.

[toc] | [prev] | [next] | [standalone]


#54381

From"J.O. Aho" <user@example.net>
Date2019-03-11 22:12 +0100
Message-ID<geo19aF4ipcU1@mid.individual.net>
In reply to#54379
On 3/11/19 9:50 PM, Pascal Hambourg wrote:
> Le 09/03/2019 à 12:21, J.O. Aho a écrit :
>>
>> So why not change the UUID on the clone?
> 
> Because this is not always possible or easy.
> 
>> After you cloned the partition just run
>>
>> tune2fs /dev/sdYX -U random
> 
> How do you do with a FAT or btrfs filesystem ?

btrfs: btrfstune -u /dev/sdYX

but on the other hand, btrfs has an excellent way to sync data to 
another device, so you rarely would need to regenerate the UUID.

vfat is a bit more complicated, but still possible to change the serial 
number:

UUID="1234-ABCD"
printf "\x${UUID:7:2}\x${UUID:5:2}\x${UUID:2:2}\x${UUID:0:2}" \
| dd bs=1 seek=67 count=4 conv=notrunc of=/dev/sdYX


> The only available option is GRUB_DISABLE_LINUX_UUID which allows to 
> disable use of UUIDs and use device names instead in the root= kernel 
> command line parameter only. There is no option to tell grub-mkconfig to 
> use labels instead of UUIDs.

As far as I can remember, grub2 do generate the UUID based on the root 
partition in fstab, so in normal cases no issue.

if need to use labels by default, then edit your grub-mkconfig_lib and 
change the --target=fs_uuid to --target=fs_label and next time you 
generate the new configuration you should have the label instead.

-- 

  //Aho

[toc] | [prev] | [next] | [standalone]


#54393

FromEric Pozharski <whynot@pozharski.name>
Date2019-03-12 13:30 +0200
Message-ID<slrnq8f61q.54e.whynot@orphan.zombinet>
In reply to#54381
with <geo19aF4ipcU1@mid.individual.net> J.O. Aho wrote:

*SKIP*
> vfat is a bit more complicated, but still possible to change the serial 
> number:
>
> UUID="1234-ABCD"
> printf "\x${UUID:7:2}\x${UUID:5:2}\x${UUID:2:2}\x${UUID:0:2}" \
>| dd bs=1 seek=67 count=4 conv=notrunc of=/dev/sdYX

or

	mlabel -i /dev/sdYX -N 1234ABCD ::

*CUT*

-- 
Torvalds' goal for Linux is very simple: World Domination
Stallman's goal for GNU is even simpler: Freedom

[toc] | [prev] | [next] | [standalone]


#54376

From"Carlos E.R." <robin_listas@es.invalid>
Date2019-03-09 13:11 +0100
Message-ID<c5nclf-2td.ln1@Telcontar.valinor>
In reply to#54372
On 09/03/2019 09.31, conrrrod@gmail.com wrote:
> I like to use labelled partitions, so I can clone disks. So when I install
> linux, I have to drill down to the options to label them, otherwise one
> gets the UUID crap or even worse the by-id model_serial in Suse Enterprise.
> So if linux was not installed with the label option, do you only have to
> edit /etc/fstab and /boot/grub.conf to use the labels?

After you create the labels somehow, you edit /etc/fstab, yes. That's
the manual way.

Or you can use the YaST partitioner module.


But you don't edit "/boot/grub.conf" manually. Well, in openSUSE it
doesn't even exist. There is "/boot/grub2/grub.cfg", and you never edit
it manually because changes are lost on next update.

What we do is edit "/etc/default/grub", and then do what the comment in
it says:

# If you change this file, run 'grub2-mkconfig -o /boot/grub2/grub.cfg'
afterwards to update
# /boot/grub2/grub.cfg.

You also need to run "mkinitrd" to apply changes in fstab.

> Second issue: when you update and get a new kernel, grub.conf will be
> modified, and does that revert back to the UUID method?

See my above comment.


Isengard:~ # locate grub.conf
Isengard:~ #


-- 
Cheers, Carlos.

[toc] | [prev] | [standalone]


Back to top | Article view | alt.os.linux


csiph-web