Change Name of Mounted Hard Drive
Solution 1
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).
Solution 2
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.
Related videos on Youtube
![boy](https://i.stack.imgur.com/pT8hU.png?s=256&g=1)
boy
Updated on September 18, 2022Comments
-
boy almost 2 years
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?
-
boy about 8 yearsI'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.
-
meuh about 8 yearssorry, 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
orsudo 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. -
boy about 8 yearsIf 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 about 8 yearsAhh, okay. Do you know how I can remove the label I just made then, since it's not being used for anything?
-
meuh about 8 yearsUse 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. -
boy about 8 yearsActually I went to the Disks app and was able to Edit Mount Options, and under Identify As, I was able to choose the label you told me to make. Now I can access the hard drive from terminal by just doing /mnt/volume, which is perfect. Thanks for replying to my comments!