You are not logged in.

#1 2018-02-21 18:59:36

senorsmile
Member
Registered: 2010-12-12
Posts: 72

genfstab with partlabel on gpt partitioned disk?

When using gpt partitioned disk,

genfstab -L /dev/sda >> /mnt/etc/fstab

just uses /dev/sda1, /dev/sda2 etc.

Is there any way to get it to use the partlabels?

Offline

#2 2018-02-21 19:09:42

Scimmia
Bug Wrangler
Registered: 2012-09-01
Posts: 7,086

Re: genfstab with partlabel on gpt partitioned disk?

Do you actually have labels on the filesystems? Labels are different than partlabels.

The file will also list the /dev/sda1 notation in a comment, but that's nothing.

Offline

#3 2018-02-21 19:16:06

senorsmile
Member
Registered: 2010-12-12
Posts: 72

Re: genfstab with partlabel on gpt partitioned disk?

using
          parted -s -- /dev/sda name 1 boot
          parted -s -- /dev/sda name 2 root
only gives me partlabels. 

I can't remember, but I think on an msdos partitioning scheme, that would give me regular labels that show up under /dev/disk/by-label. 

I assume I cannot get those to be replaced by /dev/disk/by-partlabel, so I'm already working on a little Perl script to part blkid and replace each e.g.
          /dev/sda1
with
          /dev/disk/by-partlabel/boot
etc.

Perhaps I'm missing something though?

Offline

#4 2018-02-21 19:59:38

senorsmile
Member
Registered: 2010-12-12
Posts: 72

Re: genfstab with partlabel on gpt partitioned disk?

Here's my solution... note that this is being run from Ansible in a loop, so the {{ item.1.name }} is replaced with each desired partition.

https://pastebin.com/CnuQ51xj

Offline

#5 2018-02-21 20:30:36

frostschutz
Member
Registered: 2013-11-15
Posts: 648

Re: genfstab with partlabel on gpt partitioned disk?

parted does partlabels

for labels, you have to look to the filesystem. In case of ext234 you can change the label with tune2fs.

Offline

#6 2018-03-01 11:04:18

Chryslerfc
Member
From: Navarra , Spain
Registered: 2014-05-30
Posts: 8
Website

Re: genfstab with partlabel on gpt partitioned disk?

senorsmile wrote:

When using gpt partitioned disk,

genfstab -L /dev/sda >> /mnt/etc/fstab

just uses /dev/sda1, /dev/sda2 etc.

Is there any way to get it to use the partlabels?


Hi:

genfstab  -U  -p /dev/sda   >>   /mnt/etc/fstab


-U use UUID , by default genfstab use label.

Cheers


La verdad está dormida en la mente de cada Hombre

Offline

#7 2018-03-02 08:19:41

nl6720
Wiki Maintainer
Registered: 2016-07-02
Posts: 101

Re: genfstab with partlabel on gpt partitioned disk?

To use PARTLABEL:

# genfstab -t PARTLABEL /mnt >> /mnt/etc/fstab

Offline

Board footer

Powered by FluxBB