3

I just mounted and formatted an extra hard drive to Xubuntu, and the name is way too long for access from the terminal:

boy@boy:~$ cd /mnt/d1b2aa11-a3e4-434b-b71c-47a8ac23ac23/
boy@boy:/mnt/d1b2aa11-a3e4-434b-b71c-47a8ac23ac23$ 

How can I change the name?

2 Answers 2

3

You can use GParted to rename partition.

To install GParted use,

$ sudo apt-get install gparted

Launch GParted -> Unmount the drive -> Rename by setting new label.

For more info visit this website.

2

The easiest thing to do is to for a permanent result is to give the filesystem a label. The way you do this depends on what filesystem you formatted it as. First find the device it is on:

$ findmnt /mnt/d1b2aa11-a3e4-434b-b71c-47a8ac23ac23
TARGET SOURCE    FSTYPE OPTIONS
... /dev/sdc1    vfat   ...

For example, above it is on /dev/sdc1 (check this isn't your primary disc!) and of type vfat. So unmount the device and use

$ sudo dosfslabel /dev/sdc1 MYLABEL

Then remove the device and add it again, and (depending on your system) it should be automounted under /mnt/MYLABEL. For ext3/4, reiserfs, and xfs filesystems respectively use

$ sudo e2label /dev/sdc1 MYLABEL
$ sudo reiserfstune -l MYLABEL /dev/sdc1
$ sudo xfs_admin -L MYLABEL /dev/sdc1

For permanently connected hard disks, you can usually find a mount entry for the partition in /etc/fstab (see man fstab). The first word on a line is the device to mount: this is a name like /dev/sdx1, or a uuid like UUID=e7522030-f6e3..., or a label like LABEL=volume. The 2nd word is the directory to use as a mount point (dir must exist). If an entry doesn't exist for your disk, add it using preferable the UUID or LABEL in the first field, and your desired mount point, then ext4 defaults (for an ext4 filesystem).

7
  • 1
    I'm slightly confused by your instructions. You say to unmount the device and use "sudo dosfslabel /dev/sdc1 MYLABEL" then remove the device. Remove the device twice in a row? I guessed and unmounted the drive, did "sudo dosfslabel /dev blahblah" then mounted it again. When I mounted it, I could access that drive under the label I had just made. However, once I restarted my computer it was back to the label in my original post.
    – boy
    Jun 10, 2016 at 17:37
  • 1
    sorry, in fact you dont need to unmount the device to set a label on the filesystem. I dont see how it could work once only. You could check the label is still there with lsblk -f or sudo dosfslabel /dev/sdc1 (without the label arg at the end). Normally, the system should prefer to use a LABEL rather than a UUID if the filesystem has one.
    – meuh
    Jun 10, 2016 at 17:45
  • If you wouldn't mind looking at this screenshot of my desktop: i.imgur.com/mET6krV.png The label still exists, but the drive isn't associated it. Not really sure what I did wrong.
    – boy
    Jun 10, 2016 at 18:31
  • 1
    oops, I was thinking you had a hotplug device, not another hard disk as you said in your post. I'm not sure what is mounting it by default, but look in file /etc/fstab. I updated my answer.
    – meuh
    Jun 10, 2016 at 19:33
  • 1
    Use an empty string '' as a label to remove it. But it can be useful to label partitions to ensure you are not confusing them, as a uuid is a bit less readable. This is obviously most useful for removable media.
    – meuh
    Jun 10, 2016 at 19:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.