Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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
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.
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
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.
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
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.