0

Ubuntu 22.04 running Xfce4 and gparted.

Have a USB harddrive that automounts under /media/[my login name]/21D3FB6E-1D96-4A40-B790-7AE74F0F465D

I know how to change the label from gparted but want to change it from command line.

I've read mounting it in /etc/fstab, but it's automounted. (No idea where to change automount name btw).

Looking to just change the label so it mounts as /media/USBdrive

2 Answers2

1

for ext2/ext3/ext4 you can use e2label.

sudo e2label /dev/sdxy label-name

for /dev/sdxy you have to adapt it to your situation.

sudo lsblk -f

will give you an overview for your devices that are in the moment connected. For btrfs

this I can not test, I never use it. For all changes on filesystems backup your data on it first.

nobody
  • 5,437
  • +1; Yes, according to the original question the mountpoint seems to use the UUID of an ext file system, so your answer should apply in this case. I have no own experience of BTRFS. – sudodus May 19 '22 at 15:18
0

You can do that with GNOME's Disks Utility. It comes preinstalled on Ubuntu systems and you can run it with gnome-disks from the terminal or you can open it from the GUI

With the disk plugged in, select it in Disks, and then click on the "cogs" icon, and select "Edit Mount Options". enter image description here

That will bring you to this screen:

enter image description here

After unchecking "User Session Defaults", you can then manually change the mount point under the "Mount Point" box to whatever you please. Click "OK" then enter your password and the program will add the entry to fstab automatically.

Hope this helps!

  • 1
    Thank you Azi-a for your answer! I don't run gnome desktop but that would've helped for sure! Did find GParted does that graphically get it done too. My goal is to do it from command line only still. :) – Shannon Saylors May 04 '22 at 20:55