Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Installing Gentoo
  • Search

labeling (naming) partitions before install

Having problems with the Gentoo Handbook? If you're still working your way through it, or just need some info before you start your install, this is the place. All other questions go elsewhere.
Post Reply
Advanced search
8 posts • Page 1 of 1
Author
Message
cwc
Veteran
Veteran
User avatar
Posts: 1491
Joined: Mon Mar 20, 2006 10:36 pm
Location: Tri-Cities, WA USA
Contact:
Contact cwc
Website

labeling (naming) partitions before install

  • Quote

Post by cwc » Thu Nov 07, 2024 9:23 pm

I read the docs https://wiki.gentoo.org/wiki/Handbook:A ... tion/Disks
and Father time has got me. In other words I forgot.

I have partitioned my drive. /boot swap root /.
How or do I need to label them?

Code: Select all

Device        Start       End   Sectors   Size Type
/dev/sda1      2048   2099199   2097152     1G Linux filesystem
/dev/sda2   2099200  69208063  67108864    32G Linux filesystem
/dev/sda3  69208064 500117503 430909440 205.5G Linux filesystem

Without diversity there can be no evolution:)
Top
pingtoo
Advocate
Advocate
User avatar
Posts: 2186
Joined: Fri Sep 10, 2021 8:37 pm
Location: Richmond Hill, Canada

Re: labeling (naming) partitions before install

  • Quote

Post by pingtoo » Thu Nov 07, 2024 9:56 pm

cwc wrote:How or do I need to label them?
No, you don't "need" to label them.

However it is good to have label because a label usually came from human which carry meaning human can understand.

labelling usually very important in a share storage environment, it can help identify given storage which node it belong. but also give administrator opportunity when in emergency hint of recovery.

So extent the above idea, label is good to have even on single computer, because should you wish to change storage, it mean easy to switch without change configuration file (i.e. /etc/fstab)

I am not sure if fdisk can or cannot change, but I think sys-app/gotfdisk can change existing partition.

Beware, Not only storage/partition have label, File system also can have label,
Top
szatox
Advocate
Advocate
Posts: 3858
Joined: Tue Aug 27, 2013 12:35 pm

  • Quote

Post by szatox » Thu Nov 07, 2024 10:20 pm

Code: Select all

mkfs.<chosen type> -L <LABEL> /dev/device
Make Pipewire a system service
Top
ali3nx
l33t
l33t
User avatar
Posts: 732
Joined: Sun Sep 21, 2003 4:28 am
Location: Winnipeg, Canada
Contact:
Contact ali3nx
Website

  • Quote

Post by ali3nx » Thu Nov 07, 2024 11:10 pm

If you use cli parted the partition name label can be configured from parted cli shell

Code: Select all

name # 'Secret Documents'


# = the partition id from

Code: Select all

parted /dev/device print
https://www.gnu.org/software/parted/man ... /name.html
Compiling Gentoo since version 1.4
Thousands of Gentoo Installs Completed
Emerged on every continent but Antarctica
Compile long and Prosper!
Top
cwc
Veteran
Veteran
User avatar
Posts: 1491
Joined: Mon Mar 20, 2006 10:36 pm
Location: Tri-Cities, WA USA
Contact:
Contact cwc
Website

thank you

  • Quote

Post by cwc » Thu Nov 07, 2024 11:11 pm

thank you

I ask a simple question and I get a professional answer.
This is the worlds greatest forum! . {period}
Without diversity there can be no evolution:)
Top
Hu
Administrator
Administrator
Posts: 24403
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Fri Nov 08, 2024 12:03 am

szatox's answer addresses setting a label on a filesystem when you create the filesystem. ali3nx's answer addresses editing a partition label, which you could do at creation time or later. Some (maybe all?) filesystems can have their filesystem label updated after creation. The mechanism varies. For swap, use swaplabel. For ext4, use tune2fs. For other filesystems, consult their documentation (or ask here, and maybe a reader will know it).

As a recap on usage: LABEL= is implicitly about filesystem labels. PARTLABEL= is explicitly about partition labels. You can, if you wish, assign the same name as both a filesystem label and a partition label. You cannot use LABEL= to find a partition label, nor use PARTLABEL= to find a filesystem label. You must use the key=value type appropriate to the type of label you want. Additionally, the Linux kernel's root= command line parameter can natively process PARTLABEL=. If you want to use root=LABEL=my-root-label, you need an initramfs that can read that and locate a device to tell the kernel to mount. (findfs in the initramfs can make this easy.) Finally, note that when searching by label, the system may need to read all devices that might match. If some of these devices are very slow (such as optical media that must be spun up to be read, even if it isn't the label you seek), searching by label might be slow. You can use blkid to print (among other things) the label and partition label of all devices that blkid scans. This can also be abused as a quick check to see if you have slow devices that will make searching by label unpleasantly slow, since blkid will be slow when it reaches those slow devices.
Top
pietinger
Administrator
Administrator
Posts: 6639
Joined: Tue Oct 17, 2006 5:11 pm
Location: Bavaria

  • Quote

Post by pietinger » Fri Nov 08, 2024 12:16 am

cwc,

there exists two kinds of Labels: A label for the file-system (LABEL) or a label for the partition (PARTLABEL). A PARTLABEL has an advantage: It will not change if you format a partition. (mkfs.<chosen type> -L <LABEL> /dev/device gives you a filesystem-label). Therefore I recommend always a PARTLABEL (if possible -> you need a GPT disk).

You can give the name of the Partlabel when creating the partitions:

Code: Select all

# parted -a optimal /dev/sda
> mklabel gpt
> unit mib
> mkpart primary ESP 1 1024
> set 1 boot on
> mkpart primary Swap 1024 3072
> mkpart primary Root 3072 -1
> q
- OR (the same in two commands) -

Code: Select all

# parted -a optimal /dev/sda
> mklabel gpt
> unit mib
> mkpart primary 1 1024
> name 1 ESP
> set 1 boot on
> mkpart primary 1024 3072
> name 2 Swap
> mkpart primary 3072 -1
> name 3 Root
> q
You can give the name of the Partlabel also later:

Code: Select all

# parted /dev/sda
> name 1 ESP
> name 2 Swap
> name 3 Root
> q
-OR (without going into CLI parted) -

Code: Select all

# parted /dev/sda name 1 ESP
# parted /dev/sda name 2 Swap
# parted /dev/sda name 2 Root
and my /etc/fstab looks like:

Code: Select all

PARTLABEL=ESP           /efi                    vfat    noauto,noatime                          1 2
PARTLABEL=Root          /                       ext4    noatime,iversion                        0 1
PARTLABEL=Swap          none                    swap    sw                                      0 0
The same is also true for UUID (Unique Id of filesystem) and PARTUUID (of partiton) ... PARTUUID will not change when formatting a partition.
https://wiki.gentoo.org/wiki/User:Pietinger --> New at Gentoo
Top
pietinger
Administrator
Administrator
Posts: 6639
Joined: Tue Oct 17, 2006 5:11 pm
Location: Bavaria

  • Quote

Post by pietinger » Fri Nov 08, 2024 12:28 am

P.S.: Try ->

Code: Select all

# lsblk -o name,size,parttypename,fstype,partlabel,partuuid,label,uuid
;-)
https://wiki.gentoo.org/wiki/User:Pietinger --> New at Gentoo
Top
Post Reply

8 posts • Page 1 of 1

Return to “Installing Gentoo”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic