Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Renaming a Hard Drive

I have a secondary internal HDD to store auxiliary data. I want to give it a better name. How do I do it?

Newb's user avatar

  • 1 I assume you want to change the label of the file system. If it's an ext file system you can use e2label <device> label or gparted if you want a GUI. –  Marco Oct 12, 2013 at 21:33
  • I'd prefer to just do it with the command line. It's a FAT32 filesystem. –  Newb Oct 12, 2013 at 22:11
  • Use dosfslabel <device> label . –  Marco Oct 12, 2013 at 22:18

For FAT16 and FAT32 partitions, use mlabel from the mtools package or dosfslabel

Method 1# using dosfslabel ( As @Macro suggested )

Umount Partition

Set Label using :

Method 2# using mtools

Install package using

unmount the external drive, Partitions generally need to be unmounted before you can fiddle with them, so unmount the partition of the device you want to change the label for:

where device name can be /dev/sdbx , you can find in sudo fdisk -l

Check the current label

Note that we're using the special "::" drive which allows us to specify the device descriptor on the command line; otherwise we'd have to edit ~/.mtoolsrc to assign a drive letter.

Change the label

Reference Link

Rahul Patil's user avatar

You must log in to answer this question.

Not the answer you're looking for browse other questions tagged terminal hard-disk ..

  • The Overflow Blog
  • What it’s like being a professional workplace bestie (Ep. 603)
  • Journey to the cloud part I: Migrating Stack Overflow Teams to Azure
  • Featured on Meta
  • Moderation strike: Results of negotiations
  • Our Design Vision for Stack Overflow and the Stack Exchange network

Hot Network Questions

  • Why do oil kaleidoscopes only have floating items at the end?
  • Did Einstein say "Do not worry about your difficulties in mathematics, I assure you that mine are greater"?
  • Can you represent a language with a group with a small/simple generator set?
  • Why do the Nordics have a low birth rate despite their government providing all parents with free childcare and parental leave?
  • How much does choice of PhD typically matter for a future career in academia?
  • Should I send an email to African American colleagues given a recent nearby targeted crime?
  • Feasibility of “invisible” orbital bombs
  • Idiom for being watched after your bad actions
  • What movie is this avocado-like monster from?
  • Determining circumference of a graph
  • Prefix code generator
  • Reward flight cancelled and denied rerouting
  • What is the purpose of 192.168.1.0?
  • Haunted std::vector construction
  • Visualizing gravity warping the fabric of spacetime
  • Entire Perimeter of FPGA Getting Hot - Why?
  • Is a Schmitt-trigger output’s rise time affected by input pulse’s rise time?
  • Is it true that people willingly provide their articles that were published in journals?
  • Probability generating function and binomial coefficients
  • Someone I don't know contributed to my program on GitHub. Can I still present that program as my Bachelor thesis?
  • Indispensable, Essential, "Tool of the trade", "Staple item"
  • Has anyone been charged with a crime committed in space?
  • Are PCIe and USB 3.0 the same interface?
  • Extend ethernet cable

how to change drive letter in linux

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy .

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

How to edit label of USB drive?

How to edit label of USB drive easily without formatting it? I tried right clicking the device and go to the properties but cannot find anything to edit.

αғsнιη's user avatar

  • You did not specify if this USB drive is Linux only (ie. ext formatted). –  Rinzwind Sep 29, 2012 at 18:05
  • Specify the file system. –  Zignd Sep 29, 2012 at 18:07
  • See also: askubuntu.com/a/53469/3940 and askubuntu.com/a/49296/3940 –  Takkat Sep 29, 2012 at 19:17
  • Possible duplicate of How to rename partitions? –  Dan Dascalescu Aug 10, 2016 at 4:50

6 Answers 6

From terminal.

You have to use the mlabel command.

First type the mount command to find out the device location of you pen drive. Find the line which goes like “/dev/sdc1 on /media/disk …”.

This means the device sdc1 which is my pen drive is mounted on /media/disk.

Next unmount the device.

sudo umount /media/disk

Next use this command.

sudo mlabel -i /dev/sdc1 ::<new_label>

If you get a message like:

Total number of sectors (7831520) not a multiple of sectors per track (63)! You can easily ignore the check by running this command:

echo mtools_skip_check=1 >> ~/.mtoolsrc

Try again and it should work.

  • The name of the USB should have changed. Unplug and Plug the pen drive back in and it will be mounted with the new label name.

The GUI way

For this you need the Gparted software. Install it if you don’t have it already.

Open the software as a super user, and select the pen drive from GParted>Devices>

Unmount the device if it hasn’t been, by right clicking on it.

After unmounting, right click on it and select “Label” and change it to whatever you want it to be. And then Apply it, by clicking the Edit>Apply All Operations.

Your pendrives label should be changed now.

Original Source

guntbert's user avatar

  • 1 I am using sudo mlabel -i /dev/sde1 ::<Namshum> but getting the error bash: syntax error near unexpected token `newline' –  Namshum Sep 30, 2012 at 7:59
  • 2 The GUI way works out as per the steps you mentioned. Thanks! –  Namshum Sep 30, 2012 at 8:27
  • Note that if you are using the command line technique, you may need to enclose the mount point in quotes to unmount it, viz: sudo umount "/media/STORE N GO" –  K. P. MacGregor Apr 2, 2014 at 23:40
  • 1 In my case, I had to add MTOOLS_SKIP_CHECK=1 to the /etc/mtools.conf to get it working (~/.mtoolsrc din't exist). Good answer anyway. It works fine. –  cabreracanal May 8, 2014 at 14:30
  • ~/.mtoolsrc doesn't work here since it goes to the users home directory. you have to edit /root/.mtoolsrc (or the config) –  relascope May 28, 2015 at 14:49

You got several options (some require installation). Out of these e2label should be the easiest.

Gparted can do this. Rightclick the device and choose label. Needs installation of gparted though.

There are several command line methods:

tune2fs - Adjust tunable filesystem parameters on ext2/ext3/ext4 filesystems

Example: sudo tune2fs -L {label} {devicename}

e2label - Change the label on an ext2/ext3/ext4 filesystem

Example: sudo e2label {device} {label}

There is also the Windows method:

mlabel - make an MSDOS volume label

Add a line in the /etc/mtools.conf file like this drive {letter}: file="{device}" . Example: drive p: file="/dev/sdb1". Note that the drive letter can be replaced by any letter that is not present in the mtools.conf file.

Example to set the label: sudo mlabel {letter}:{label}

Rinzwind's user avatar

  • 1 What does it mean when the "Label" right-menu option is disabled in gparted ? –  Pointy Apr 18, 2014 at 23:10

As well as the other answers, the more ubiquitous tool dosfslabel is well suited to this task;

where /dev/sdd1 is the partition you wish to label.

Riot's user avatar

I did a little research and I found this official tutorial from Ubuntu Documentation which will teach you step by step how to rename drives with different file systems ( FAT16, FAT32, NTFS, ext2, ext3, ext4, JFS, ReiserFS (v3) and XFS ).

The title is "RenameUSBDrive", but it is not only for USB drives, it covers a lot of file systems supported by Ubuntu.

Here is the link : https://help.ubuntu.com/community/RenameUSBDrive

Bernmeister's user avatar

Gparted and Mlabel did not work on Ubuntu 18.04 renaming a FAT USB drive. However, you can use fatlabel instead :

Eliah Kagan's user avatar

Another GUI way if you're using Gnome.

run gnome-disks or search for "Disks" in the app search

Choose the device

choose the partition, click the gear icon

enter image description here

Modify the Display Name field

enter image description here

You must log in to answer this question.

Not the answer you're looking for browse other questions tagged usb usb-drive ..

  • The Overflow Blog
  • What it’s like being a professional workplace bestie (Ep. 603)
  • Journey to the cloud part I: Migrating Stack Overflow Teams to Azure
  • Featured on Meta
  • Moderation strike: Results of negotiations
  • Our Design Vision for Stack Overflow and the Stack Exchange network
  • AI-generated content is not permitted on Ask Ubuntu

Hot Network Questions

  • Why are Hollywood studios permitted to collectively bargain with employees, and what are the limits of this apparent antitrust exemption?
  • Are PCIe and USB 3.0 the same interface?
  • Meaning of "How you get any work done is beyond me"
  • Can a 650 nm 250 mW diode laser remove the first layer of a PCB?
  • How Do Parking Brakes Wear Out?
  • Am I considered a non-resident of California?
  • Visualizing gravity warping the fabric of spacetime
  • Pre-2000 sci-fi book with FTL travel, conventional guns, and one alien species
  • Prism: full spectrum including UV + IR
  • Drawing a maths protractor
  • I've been invited to a free 2-day conference. What's the catch?
  • How in Bash to test a name/string is an executable
  • Why do programming languages use delimiters (quotes) for strings?
  • Are there question that science can't answer, but which philosophy can?
  • Indispensable, Essential, "Tool of the trade", "Staple item"
  • Can the neutrons in a nuclear reactor be collimated?
  • Can a company with very large valuation still be hold privately?
  • How can a country force an ambassador to leave?
  • What is the purpose of 192.168.1.0?
  • Is a Schmitt-trigger output’s rise time affected by input pulse’s rise time?
  • Stretching left, "inside" and right delimiters
  • Were there attempts to support triggering accessors on modifying subelements of properties?
  • Idiom for being watched after your bad actions
  • Has Arnold Schwarzenegger's accent ever been acknowledged in-universe in a movie?

how to change drive letter in linux

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy .

Ubuntu Documentation

  • Official Documentation
  • Community Help Wiki
  • Page History
  • Login to edit

RenameUSBDrive

IconsPage/tip.png

Using the Partition Editor

Using the command line, identify your partition.

IconsPage/terminal.png

Install the Labeling Program

  • sudo apt-get install mtools sudo apt-get install ntfsprogs sudo apt-get install e2fsprogs sudo apt-get install jfsutils sudo apt-get install reiserfsprogs sudo apt-get install xfsprogs

Unmount the Partition

  • sudo umount /dev/sdb1

Changing the Label

Filesystems, fat16 and fat32, check the current label.

  • sudo mlabel -i /dev/sdb1 -s ::

Change the label

  • sudo mlabel -i /dev/sdb1 ::my_external
  • drive p: file="/dev/sdb1" drive q: file="/dev/sdb2"
  • sudo mlabel p:30GB_FAT32

Error message

  • sudo ntfslabel /dev/sdb1
  • sudo ntfslabel /dev/sdb1 my_external

ext2, ext3, and ext4

  • sudo e2label /dev/sdb1
  • sudo e2label /dev/sdb1 my_external
  • sudo jfs_tune /dev/sdb1
  • sudo jfs_tune -L my_external /dev/sdb1

ReiserFS (v3)

  • sudo reiserfstune -l my_external /dev/sdb1
  • xfs_admin -l /dev/sdb1
  • xfs_admin -l my_external /dev/sdb1

Verify the Change

Other resources.

IconsPage/resources.png

RenameUSBDrive (last edited 2013-12-14 11:20:15 by knome )

The material on this wiki is available under a free license, see Copyright / License for details You can contribute to this wiki, see Wiki Guide for details

IMAGES

  1. Change Drive Letter And Paths

    how to change drive letter in linux

  2. Les Problèmes Liés à La Modification De La Lettre De Livraison C

    how to change drive letter in linux

  3. Install Linux from a USB Drive

    how to change drive letter in linux

  4. Solution: Accessing Linux files (partitions) from Windows!

    how to change drive letter in linux

  5. filesystems

    how to change drive letter in linux

  6. How to Format a Drive in Linux

    how to change drive letter in linux

VIDEO

  1. Change drive letter and paths

  2. How to Restore Linux File Ownership #linuxtips #linux_tutorial

  3. How To Change My PC Drive Letter And Paths D,E,F,G,H

  4. How To Check File Type In Linux 🐧🐧 #shorts

  5. Linux Redirection to Write or Edit in a File

  6. How to Find a File in Linux

COMMENTS

  1. What is the equivalent for switching drives in terminal on Linux?

    If you have a directory named /mnt/drive2 (/mnt is commonly used, but it can be in your home directory if you want), and your drive is /dev/sdb, with a single partition, then the simplest command is: sudo mount -t type /dev/sdb1 /mnt/drive2. where "type" is the type shown in the blkid command, such as ntfs, ext4, etc.

  2. terminal

    1 Answer Sorted by: 3 For FAT16 and FAT32 partitions, use mlabel from the mtools package or dosfslabel Method 1# using dosfslabel ( As @Macro suggested ) Umount Partition sudo umount <device> Set Label using : sudo dosfslabel <device> label

  3. server

    1 Answer Sorted by: 3 The standard way to fix this is to not use the device name (/dev/sdb) to mount it but instead use the UUID. Check /dev/disk/by*/ for your drive's uuid. (There are several other ways to get it as well.) Then instead of the device name, use UUID= followed by what you find. Share Improve this answer Follow

  4. What is the Linux drive naming scheme?

    Ask Question Asked 12 years ago Modified 4 years, 6 months ago Viewed 46k times 30 In Windows; you have the C:\ drive. This is the primary drive upon which Windows is installed. However, Linux uses a different naming scheme: sda, sdb [1-4], etc.

  5. RenameUSBDrive

    Note that we're using the special "::" drive which allows us to specify the device descriptor on the command line; otherwise we'd have to edit ~/.mtoolsrc to assign a drive letter (see Option 2 under "Change the label"). Change the label. Option 1. After unmounting and checking the current label (above), use sudo mlabel -i <device> ::<label> ex: