LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-26-2020, 06:10 AM   #1
GPGAgent
Senior Member
 
Registered: Oct 2018
Location: Surrey UK
Distribution: Mint 20 xfce 64bit
Posts: 1,026
Blog Entries: 3

Rep: Reputation: 133Reputation: 133
Re Label partition/drive?


I've successfully repartitioned an old 1Tb hdd from an old machine to use as an external drive for backups.


I have an internal 2Tb drive in my machine and it has uses the UUID as it's label
Code:
jonke@charlie:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb5       1.8T  1.6T  156G  92% /media/jonke/6e725920-1c32-4931-bab9-fc8c12d01128
jonke@charlie:~$
See screenshot as well.


Now I've used e2label in the past on usb sticks and I'm 99.9% sure it's non-destructive, but before I risk it on a 2Tb drive with loads of files I want to keep, and too big to backup am I okay to do this
Code:
sudo e2label /dev/sdb5 TWOTBDRIVE
cheers
Attached Thumbnails
Click image for larger version

Name:	NewLabel.png
Views:	24
Size:	196.1 KB
ID:	35034  
 
Old 12-26-2020, 06:56 AM   #2
auge
Member
 
Registered: May 2002
Location: Germany
Distribution: CentOS, Debian, LFS
Posts: 100
Blog Entries: 1

Rep: Reputation: Disabled
The label is uncorrelated to the data that you store on the partition. It is just an additional "convenience-name" you can assign to any partition and change it as you like.

You can mount a drive with mapping by UUID, dev-path, lvm, disk-id. Changing the label-string does not mean anything when you don't mount the partition by using its label automatically.

So when you don't use a fixed config like "LABEL=TWOTBDRIVE" instead of "/dev/sdb5" in your fstab the label is not relevant anyways and even if you change it to something different you can still change it again or adjust your configuration.

Last edited by auge; 12-26-2020 at 06:57 AM. Reason: typo
 
1 members found this post helpful.
Old 12-26-2020, 10:16 AM   #3
remmilou
Member
 
Registered: Mar 2010
Location: Amsterdam
Distribution: MX Linux (21)/ XFCE
Posts: 211

Rep: Reputation: 69
Auge is right.
But be aware of the used terms, when searching for this:
You can indeed always label your volume, or filesystem.
On de GPT disk you can also name your partition. Even if it contains no filesystem at all.
For mounting (like in fstab) you can use the volume label, but not the partition name.
What's the use of a partition name then? Well, not so much... If you have an encrypted filesystem like veracrypt on it, you will not see any label without mounting. But you can read the partition name though.
Perhaps others see more use for it...?
If you use "gnome-disks", you see both options very clearly. And you can change both of them from there. Even on a mounted volume!
You can lists all volume names with the command blkid (as root).
But as Auge says: be aware, if you use a fixed config like "LABEL=TWOTBDRIVE" instead of "/dev/sdb5" in fstab.
 
Old 12-26-2020, 12:02 PM   #4
auge
Member
 
Registered: May 2002
Location: Germany
Distribution: CentOS, Debian, LFS
Posts: 100
Blog Entries: 1

Rep: Reputation: Disabled
The partition name is the GPT-partition-label and was not part of the question. Here we talked about filesystem-labels for ext modified by the OP with "e2label".


For remmilou and because this place is meant to help people learn something: There is no definition that "name" is always used for the partition-label and "label" is for the filesystem-label. For example on your debian10: systemd and udev use the term "filesystem-label" to populate "/dev/disk/by-partlabel/" according to rules in "/lib/udev/rules.d/60-persistent-storage.rules". There the partition-name, that is the gpt-partition-label is called ID_FS_LABEL, although it is the external "GPT-PARTITION-NAME" defined as the last 72 Bytes of "GUID partition entry format".

I like to use this partition-label on multiboot-workstations with different OS that understand gpt but may not have support for the filesystems of their neighbours.

I try to show what I mean using the debian10 I have here myself:

Quote:
# cat /lib/udev/rules.d/60-persistent-storage.rules |grep ID_FS_LABEL && ls -l /dev/disk/by-partlabel/ |grep deb && /sbin/blkid |grep deb && /sbin/e2label /dev/nvme0n1p4 && echo "^^ no e2fs-label line empty"
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
lrwxrwxrwx 1 root root 15 Dez 6 11:40 deb -> ../../nvme0n1p4
/dev/nvme0n1p4: UUID="340e9003-f1e7-4be8-9aab-a1d7c69a55d9" TYPE="ext4" PARTLABEL="deb" PARTUUID="bb5e7786-5f28-4fe6-96f8-f219cfe94927"

^^ no e2fs-label line empty
There is a lot of use in these names, because you can have a custom external label for partitions without needing to open the fs on that partition. When I change disks from one controller/port to another in the same system the os has no problem with that because of using the UUID in fstab and I have no problem to find/change something because my custom-names are there and in our case: we can even mount them by partition-name with the symlink to the device provided by the udev-rule, in my case the Debian-Root-Partition with /dev/disk/by-partlabel/deb
 
Old 12-26-2020, 04:18 PM   #5
sgosnell
Senior Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian Stable and Unstable
Posts: 1,943

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
If the disk is not listed in fstab, most systems will automount the drive at /media/username/disklabel, if automount is enabled. That makes most things more convenient, and I assume that's what the OP wants.
 
Old 12-27-2020, 07:34 AM   #6
GPGAgent
Senior Member
 
Registered: Oct 2018
Location: Surrey UK
Distribution: Mint 20 xfce 64bit
Posts: 1,026

Original Poster
Blog Entries: 3

Rep: Reputation: 133Reputation: 133
Quote:
Originally Posted by sgosnell View Post
If the disk is not listed in fstab, most systems will automount the drive at /media/username/disklabel, if automount is enabled. That makes most things more convenient, and I assume that's what the OP wants.
It's not listed in /etc/fstab
Code:
charlie:~$ more /etc/fstab 
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda5 during installation
UUID=92c6eff1-78fc-4faa-8389-c88454e80d11 /               ext4 noatime,errors=remount-ro 0 1
# /boot/efi was on /dev/sda1 during installation
UUID=EB15-5510  /boot/efi       vfat    umask=0077      0       1
/swapfile
Attached Thumbnails
Click image for larger version

Name:	ETC-FSTAB.png
Views:	6
Size:	221.0 KB
ID:	35042  
 
Old 12-27-2020, 02:29 PM   #7
sgosnell
Senior Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian Stable and Unstable
Posts: 1,943

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
That's what I was assuming. If there is no label, the drive will be automounted using the UUID. If there is a label, it will be mounted using the label. At least for the DEs I've used. No idea about Gnome, I avoid that at all cost.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Linux CUPS, Zebra label printer LP2844 -- printing text is low on label ajnabi Linux - Hardware 3 03-05-2019 03:07 PM
LABEL=/1 vs LABEL=/ in linux !! shipon_97 Linux - Newbie 1 06-02-2010 08:33 AM
trouble umounting with LABEL=label in fstab JosephS Debian 3 02-01-2010 06:25 AM
very strange swap partition label and empty text console whencat Fedora 4 08-07-2005 09:16 AM
change partition label w/o format gjo Linux - General 5 06-28-2005 12:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration