Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
labeling (naming) partitions before install
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
cwc
Veteran
Veteran


Joined: 20 Mar 2006
Posts: 1386
Location: Tri-Cities, WA USA

PostPosted: Thu Nov 07, 2024 9:23 pm    Post subject: labeling (naming) partitions before install Reply with quote

I read the docs https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/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:

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:)
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1252
Location: Richmond Hill, Canada

PostPosted: Thu Nov 07, 2024 9:56 pm    Post subject: Re: labeling (naming) partitions before install Reply with quote

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,
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3442

PostPosted: Thu Nov 07, 2024 10:20 pm    Post subject: Reply with quote

Code:
mkfs.<chosen type> -L <LABEL> /dev/device

_________________
Make Computing Fun Again
Back to top
View user's profile Send private message
ali3nx
l33t
l33t


Joined: 21 Sep 2003
Posts: 731
Location: Winnipeg, Canada

PostPosted: Thu Nov 07, 2024 11:10 pm    Post subject: Reply with quote

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

Code:
name # 'Secret Documents'


# = the partition id from

Code:
parted /dev/device print


https://www.gnu.org/software/parted/manual/html_node/name.html
_________________
Compiling Gentoo since version 1.4
Thousands of Gentoo Installs Completed
Emerged on every continent but Antarctica
Compile long and Prosper!
Back to top
View user's profile Send private message
cwc
Veteran
Veteran


Joined: 20 Mar 2006
Posts: 1386
Location: Tri-Cities, WA USA

PostPosted: Thu Nov 07, 2024 11:11 pm    Post subject: thank you Reply with quote

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:)
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22694

PostPosted: Fri Nov 08, 2024 12:03 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5121
Location: Bavaria

PostPosted: Fri Nov 08, 2024 12:16 am    Post subject: Reply with quote

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:
# 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:
# 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:
# parted /dev/sda
> name 1 ESP
> name 2 Swap
> name 3 Root
> q

-OR (without going into CLI parted) -
Code:
# 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:
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
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5121
Location: Bavaria

PostPosted: Fri Nov 08, 2024 12:28 am    Post subject: Reply with quote

P.S.: Try ->
Code:
# lsblk -o name,size,parttypename,fstype,partlabel,partuuid,label,uuid

;-)
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
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