个人工具

“UbuntuHelp:RenameUSBDrive”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
 
(未显示同一用户的4个中间版本)
第1行: 第1行:
 
{{From|https://help.ubuntu.com/community/RenameUSBDrive}}
 
{{From|https://help.ubuntu.com/community/RenameUSBDrive}}
 
{{Languages|UbuntuHelp:RenameUSBDrive}}
 
{{Languages|UbuntuHelp:RenameUSBDrive}}
== Editing ext2/ext3/JFS/ReiserFS/XFS/FAT32/NTFS Partition Labels ==
+
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=IconDisks.png  This guide is for editing partition labels (disk names) for FAT16/FAT32, NTFS, ext2/ext3, JFS, ReiserFS, and XFS filesystems.
There are 6 programs you use to label a drive. The program used depends on the partition type.
+
== Partition Editor ==
*For '''FAT32''' Partitions you use '''Mtools'''.
+
Nautilus currently [https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/68924/ does not support renaming partitions], but Gnome's Partition Editor ([[UbuntuHelp:GParted|GParted]]) does.  To change a partition's label, follow these directions.  (Be careful using Partition Editor, as it's capable of making your computer completely unusable if you do the wrong thing.)
*For '''NTFS''' Partitions you use '''ntfsprogs'''.
+
<ol><li>Open the '''System''' > '''Administration''' menu and see if there's an entry for '''[[UbuntuHelp:GParted|GParted]]''' (previously '''Partition Editor''').
*For '''ext2''' or '''ext3''' Partitions you use '''e2label'''.
+
</li><li>If there is, launch it.  If there isn't, [[UbuntuHelp:apt:gparted|install the "gparted" package]] and it should now appear in the menu.  Enter your password when prompted.
*For '''JFS''' partitions you use '''jfs_tune'''.
+
</li><li>Disk drives are divided up into partitions.  To find the partition you want to re-label, you first have to find the disk drive that contains it, using the drop-down menu in the upper right.  It will show a device name like `/dev/sdb` and the drive's total size in parentheses. After selecting a drive, you will see a list of all partitions on that drive.
*For '''ReiserFS''' (v3) partitions you can use '''reiserfstune'''.
+
</li><li>If the partition is mounted (has a key icon next to it), right-click on the partition and select '''Unmount'''.
*For '''XFS''' partitions you use '''xfs_admin'''
+
</li><li>With the key icon gone, right-click on the partition and select '''Label'''. If you can't select it, [[UbuntuHelp:apt:ntfsprogs|install the ntfsprogs package]].
Instructions for all are given below.
+
</li><li>Enter the new partition name and press '''Ok'''.
=== Identify your partition ===
+
</li><li>The label change is now pending, but has not been completed.  Press the '''Apply''' button near the top of the window.  After confirming, it should say "All operations successfully completed".  The drive now has a new label.</li></ol>
Plug in your USB device and list your partitions with :
+
 
 +
== Command line ==
 +
There are at least 6 separate command line tools used to label a partition - the program used depends on the partition's [[UbuntuHelp:LinuxFilesystemsExplained| filesystem]] type:
 +
* For '''FAT16''' and '''FAT32''' partitions, use '''mtools'''.
 +
* For '''NTFS''' partitions, use '''ntfsprogs'''.
 +
* For '''ext2''', '''ext3''', or '''ext4''' partitions, use '''e2label'''.
 +
* For '''JFS''' partitions, use '''jfs_tune'''.
 +
* For '''ReiserFS''' (v3) partitions, use '''reiserfstune'''.
 +
* For '''XFS''' partitions, use '''xfs_admin'''
 +
By default, external drives automount at <code><nowiki>/media/disk</nowiki></code> then <code><nowiki>/media/disk-1</nowiki></code> and so on.  This is not very helpful when trying to find the drive you are looking for, especially if you have multiple devices plugged in.
 +
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=IconTip.png Labeled devices that automount will be mounted in the ''/media'' directory using their label as the mount point, <code><nowiki>/media/<label></nowiki></code>.  ex: <code><nowiki>/media/my_external</nowiki></code> .
 +
<<BR>>https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=warning.png When creating labels, be sure that the new mount point (based on the label) does not already exist since hal's automount function creates the directory when it mounts the device.
 +
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=important.png This guide is primarily for '''external drives''' such as USB hard drives, USB flash drives, and flash memory cards.  You can label internal disks, but to change their mount points, use [[UbuntuHelp:MoveMountpointHowto|MoveMountpointHowto]] which uses the file called [[UbuntuHelp:Fstab|Fstab]].
 +
== Identify your Partition ==
 +
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=IconGNOMETerminal.png For help with the terminal, see [[UbuntuHelp:UsingTheTerminal|UsingTheTerminal]].
 +
Plug in your USB device and list your partitions with:
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo fdisk -l
 
sudo fdisk -l
 
</nowiki></pre>
 
</nowiki></pre>
Alternately, list your mounted devices with :
+
You can also list your mounted devices and their descriptions with:
 
<pre><nowiki>
 
<pre><nowiki>
 
mount
 
mount
 
</nowiki></pre>
 
</nowiki></pre>
Devices that auto mount will be mounted in /media using their label as a mount point (name).
+
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=example.png For the rest of this tutorial we will use the following:
=== Editing FAT32 Partition Labels using mtools ===
+
* <device> = your device /dev/sdxy, ex: ''/dev/sdb1''
I wanted to rename the fat32 partitions that get automounted when they are plugged in to the USB drive. Two were exactly similar external hard disk drives, and one was an iPod. The exactly similar hard disk drives (one each at home and work) were both getting mounted at /media/sda1 or sda2 etc, and it was impossible to distinguish one from the other easily. Also, I found that it wasn’t that easy to edit the partition labels for FAT32 partitions. So I thought I would summarize how I named my fat32 partitions to have consistent names. This has the benefit that when these drives are automounted, they will be at the location /media/partition-label, where partition-label is the label that you give the partition.
+
* <label> = your desired (new) label, ex: ''my_external''
Step by step instructions to re-label FAT partitions follow:
+
== Install the Labeling Program ==
<device> = your device /dev/sdxy (Identified as above).
+
Based on the package names listed above for each filesystem type, install the correct package for your partition:
<Label> = your desired (new) Label.
+
==== Instructions: ====
+
==== 1) Install mtools: ====
+
 
<pre><nowiki>
 
<pre><nowiki>
sudo apt-get install mtools
+
sudo apt-get install <package>
 
</nowiki></pre>
 
</nowiki></pre>
==== 2) After the usb drive is automounted after plugging in, find out the device descriptor using: ====
+
Here are all the different ones:
 
<pre><nowiki>
 
<pre><nowiki>
mount
+
sudo apt-get install mtools
</nowiki></pre>
+
sudo apt-get install ntfsprogs
and Note down where it says “sda2″ or similar
+
sudo apt-get install e2fsprogs
==== 3) Check what the label for the drive is currently: ====
+
sudo apt-get install jfsutils
 +
sudo apt-get install reiserfsprogs
 +
sudo apt-get install xfsprogs</nowiki></pre>
 +
or install the appropriate package from [[UbuntuHelp:SynapticHowto| Synaptic]].
 +
== Unmount the Partition ==
 +
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:
 
<pre><nowiki>
 
<pre><nowiki>
sudo mlabel -i /dev/sda2 -s ::
+
sudo umount <device>
 
</nowiki></pre>
 
</nowiki></pre>
You may have to change sda2 to something else depending on what you got in step 2 above.
+
ex:
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.
+
==== 4) Change the label to something pretty: ====
+
 
<pre><nowiki>
 
<pre><nowiki>
sudo mlabel -i /dev/sda2 ::my-ipod
+
sudo umount /dev/sdb1</nowiki></pre>
 +
If it was automounted, you can also unmount the drive by right clicking the desktop icon and clicking '''Unmount''' (or '''Eject''' in some cases).
 +
== Changing the Label ==
 +
After you complete the appropriate porition for your filesystem, jump to the next section to verify the change.
 +
=== FAT16 and FAT32 ===
 +
These filesystems are most often found on USB thumb drives, flash cards (like for a camera or cell phone), and older external USB hard drives.
 +
==== Check the current label ====
 +
<pre><nowiki>
 +
sudo mlabel -i <device> -s ::
 
</nowiki></pre>
 
</nowiki></pre>
replace my-ipod with what you would like to name the usb drive
+
ex:
Note: You may need to create a file named ".mtoolsrc" in your home directory that has the fallowing line in it:
+
mtools_skip_check=1
+
 
<pre><nowiki>
 
<pre><nowiki>
gedit ~/.mtoolsrc
+
sudo mlabel -i /dev/sdb1 -s ::</nowiki></pre>
 +
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 <code><nowiki>~/.mtoolsrc</nowiki></code> 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
 +
<pre><nowiki>
 +
sudo mlabel -i <device> ::<label>
 
</nowiki></pre>
 
</nowiki></pre>
==== 5) Check if the label has changed: ====
+
ex:
 +
<pre><nowiki>
 +
sudo mlabel -i /dev/sdb1 ::my_external</nowiki></pre>
 +
Ignore the "Volume label is XYZ" output as this is the ''old'' label.  Jump to the Verify the Change section below.
 +
===== Option 2 =====
 +
For Ubuntu 8.10 and up, edit mtools.conf as sudo
 
<pre><nowiki>
 
<pre><nowiki>
sudo mlabel -i /dev/sda2 -s ::
+
sudo nano /etc/mtools.conf
 
</nowiki></pre>
 
</nowiki></pre>
I got the following output –
+
add something like for each drive:
Volume label is MY-IPOD
+
You’re all set!! The next time that partition gets automounted, it will be at /media/MY-IPOD
+
=== Editing NTFS Partition Labels using ntfsprogs ===
+
==== Instructions: ====
+
==== 1) Install ntfsprogs: ====
+
 
<pre><nowiki>
 
<pre><nowiki>
sudo apt-get install ntfsprogs
+
drive p: file="/dev/sdb1"
 +
drive q: file="/dev/sdb2"</nowiki></pre>
 +
etc.
 +
Then use
 +
<pre><nowiki>
 +
sudo mlabel p:new_label
 
</nowiki></pre>
 
</nowiki></pre>
==== 2) After the drive is automounted after plugging in, find out the device descriptor using: ====
+
ex:
 
<pre><nowiki>
 
<pre><nowiki>
mount
+
sudo mlabel p:30GB_FAT32</nowiki></pre>
 +
(note the underscore _ should be used, as spaces are not allowed)
 +
http://ubuntuforums.org/showpost.php?p=6356016&postcount=9
 +
===== Error message =====
 +
If you get a message like this:
 +
<pre><nowiki>
 +
Total number of sectors (7831520) not a multiple of sectors per track (63)!
 
</nowiki></pre>
 
</nowiki></pre>
and Note down where it says “sda1″ or similar
+
You can easily ignore the check by running this command:
==== 3) Change the label to something pretty: ====
+
 
<pre><nowiki>
 
<pre><nowiki>
sudo ntfslabel /dev/sda1 newlabel
+
echo mtools_skip_check=1 >> ~/.mtoolsrc
 
</nowiki></pre>
 
</nowiki></pre>
replace '''newlabel''' with what you would like to name the usb drive / Harddisk
+
=== NTFS ===
you may have to unmount the drive for this to work (system-> administration-> disks -> then under partitions for the hard disk hit disable).
+
This filesystem is most often found on external USB and firewire hard drives or other Windows formatted disks.
==== 3) Check if the label has changed: ====
+
==== Check the current label ====
Restart your computer to see the label change if your harddrive is internal, and for usb just unplug/plug in USB again
+
=== Editing ext2 or ext3 Partition Labels using e2label ===
+
==== Instructions: ====
+
==== 1) After the drive is automounted after plugging in, find out the device descriptor using: ====
+
 
<pre><nowiki>
 
<pre><nowiki>
mount
+
sudo ntfslabel <device>
 
</nowiki></pre>
 
</nowiki></pre>
and Note down where it says “sda1″ or similar
+
ex:
==== 2) Change the label to something pretty: ====
+
 
<pre><nowiki>
 
<pre><nowiki>
sudo e2label /dev/sda1 newlabel
+
sudo ntfslabel /dev/sdb1</nowiki></pre>
 +
==== Change the label ====
 +
Note: 128 characters maximum.
 +
<pre><nowiki>
 +
sudo ntfslabel <device> <label>
 
</nowiki></pre>
 
</nowiki></pre>
replace '''newlabel''' with what you would like to name the usb drive / Harddisk
+
ex:
you may have to unmount the drive for this to work (system-> administration-> disks -> then under partitions for the hard disk hit disable).
+
<pre><nowiki>
==== 3) Check if the label has changed: ====
+
sudo ntfslabel /dev/sdb1 my_external</nowiki></pre>
Restart your computer to see the label change if your harddrive is internal, and for usb just unplug/plug in USB again
+
Ubuntu caches the drive's label so to see full affects of the change it is not enough just to umount and mount it again, the you should umount, remove, put back, mount again.
=== Editing JFS partition labels using jfs_tune ===
+
=== ext2, ext3, and ext4 ===
==== Instructions: ====
+
These filesystems are most often found on linux formatted drives.
Show label :
+
==== Check the current label ====
 
<pre><nowiki>
 
<pre><nowiki>
jfs_tune -l <device>
+
sudo e2label <device>
 
</nowiki></pre>
 
</nowiki></pre>
Set a new label :
+
ex:
 
<pre><nowiki>
 
<pre><nowiki>
jfs_tune -L <Label> <device>
+
sudo e2label /dev/sdb1</nowiki></pre>
 +
==== Change the label ====
 +
Note: 16 characters maximum.
 +
<pre><nowiki>
 +
sudo e2label <device> <label>
 
</nowiki></pre>
 
</nowiki></pre>
<device> = your device /dev/sdxy
+
ex:
<Label>  = your desired (new) Label
+
=== Editing ReiserFS v3 partition labels using reiserfstune ===
+
Note: this could work with ReiserFS 4 too, I have not tried.
+
==== 1) After the drive is automounted after plugging in, find out the device descriptor using:  ====
+
 
<pre><nowiki>
 
<pre><nowiki>
mount
+
sudo e2label /dev/sdb1 my_external</nowiki></pre>
 +
=== JFS ===
 +
These filesystems are most often found on IBM and some linux formatted disks.
 +
==== Check the current label ====
 +
<pre><nowiki>
 +
sudo jfs_tune -l <device>
 
</nowiki></pre>
 
</nowiki></pre>
and Note down where it says “sda1″ or similar; Or you could simply open '''gnome-system-monitor''' and take note of the mount point of the partitions you want to label.
+
ex:
==== 2) Unmount the partitions you want to label ====
+
<pre><nowiki>
For example:
+
sudo jfs_tune /dev/sdb1</nowiki></pre>
 +
==== Change the label ====
 +
Note: 16 characters maximum.
 
<pre><nowiki>
 
<pre><nowiki>
sudo umount /dev/sda1
+
sudo jfs_tune -L <label> <device>
 
</nowiki></pre>
 
</nowiki></pre>
==== 3) Change the label to something pretty ====
+
ex:
(note: 16 characters maximum)
+
 
<pre><nowiki>
 
<pre><nowiki>
sudo reiserfstune -l 'johnny' /dev/sda1
+
sudo jfs_tune -L my_external /dev/sdb1</nowiki></pre>
 +
=== ReiserFS (v3) ===
 +
This filesystem is most often found on linux formatted disks.
 +
Note: this could work with ReiserFS 4 too, I have not tried.
 +
==== Change the label ====
 +
Note: 16 characters maximum.
 +
<pre><nowiki>
 +
sudo reiserfstune -l <label> <device>
 
</nowiki></pre>
 
</nowiki></pre>
=== Editing XFS partition labels using xfs_admin ===
+
ex:
==== Instructions: ====
+
<pre><nowiki>
Show label :
+
sudo reiserfstune -l my_external /dev/sdb1</nowiki></pre>
 +
=== XFS ===
 +
This filesystem is most often found on UNIX formatted disks.
 +
==== Check the current label ====
 
<pre><nowiki>
 
<pre><nowiki>
 
xfs_admin -l <device>
 
xfs_admin -l <device>
 
</nowiki></pre>
 
</nowiki></pre>
Set a new label :
+
ex:
 +
<pre><nowiki>
 +
xfs_admin -l /dev/sdb1</nowiki></pre>
 +
==== Change the label ====
 +
Note: 12 characters maximum.
 +
<pre><nowiki>
 +
sudo xfs_admin -L <label> <device>
 +
</nowiki></pre>
 +
ex:
 +
<pre><nowiki>
 +
xfs_admin -l my_external /dev/sdb1</nowiki></pre>
 +
== Verify the Change ==
 +
Now for the easiest part: unplug the drive, wait a second, then plug it back in.  It should appear on your desktop with the new label and have its new mount point.
 +
Without unplugging and having the device remount, you can also just run:
 
<pre><nowiki>
 
<pre><nowiki>
sudo xfs_admin -L <Label> <device>
+
sudo blkid
 
</nowiki></pre>
 
</nowiki></pre>
<device> = your device /dev/sdxy
+
== Other Resources ==
<Label>  = your desired (new) Label
+
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=IconBook-small.png Some other related material:
 +
* [[UbuntuHelp:MoveMountpointHowto|MoveMountpointHowto]]
 +
* [[UbuntuHelp:LinuxFilesystemsExplained|LinuxFilesystemsExplained]]
 +
* [[UbuntuHelp:Fstab|Fstab]]
 +
* [[UbuntuHelp:MountingWindowsPartitions|MountingWindowsPartitions]]
 
----
 
----
=== Credits ===
+
[[category:CategoryUsb]]
The information on this page was originally copied from http://ubuntu.wordpress.com/, and i believe it deserves to be in the wiki because the wiki is where i looked  when i first had this problem.
+
==== ReiserFS part by Jeff ====
+
Just added this from my knowledge (which came from various forum posts and bug reports)
+
== Comments ==
+
* There's no GUI method (Nautilus?) to rename partitions?
+
[[category:CategoryDocumentation]] [[category:CategoryCleanup]]
+
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2010年5月20日 (四) 00:02的最新版本

IconsPage?action=AttachFile&do=get&target=IconDisks.png This guide is for editing partition labels (disk names) for FAT16/FAT32, NTFS, ext2/ext3, JFS, ReiserFS, and XFS filesystems.

Partition Editor

Nautilus currently does not support renaming partitions, but Gnome's Partition Editor (GParted) does. To change a partition's label, follow these directions. (Be careful using Partition Editor, as it's capable of making your computer completely unusable if you do the wrong thing.)

  1. Open the System > Administration menu and see if there's an entry for GParted (previously Partition Editor).
  2. If there is, launch it. If there isn't, install the "gparted" package and it should now appear in the menu. Enter your password when prompted.
  3. Disk drives are divided up into partitions. To find the partition you want to re-label, you first have to find the disk drive that contains it, using the drop-down menu in the upper right. It will show a device name like `/dev/sdb` and the drive's total size in parentheses. After selecting a drive, you will see a list of all partitions on that drive.
  4. If the partition is mounted (has a key icon next to it), right-click on the partition and select Unmount.
  5. With the key icon gone, right-click on the partition and select Label. If you can't select it, install the ntfsprogs package.
  6. Enter the new partition name and press Ok.
  7. The label change is now pending, but has not been completed. Press the Apply button near the top of the window. After confirming, it should say "All operations successfully completed". The drive now has a new label.

Command line

There are at least 6 separate command line tools used to label a partition - the program used depends on the partition's filesystem type:

  • For FAT16 and FAT32 partitions, use mtools.
  • For NTFS partitions, use ntfsprogs.
  • For ext2, ext3, or ext4 partitions, use e2label.
  • For JFS partitions, use jfs_tune.
  • For ReiserFS (v3) partitions, use reiserfstune.
  • For XFS partitions, use xfs_admin

By default, external drives automount at /media/disk then /media/disk-1 and so on. This is not very helpful when trying to find the drive you are looking for, especially if you have multiple devices plugged in. IconsPage?action=AttachFile&do=get&target=IconTip.png Labeled devices that automount will be mounted in the /media directory using their label as the mount point, /media/<label>. ex: /media/my_external . <
>IconsPage?action=AttachFile&do=get&target=warning.png When creating labels, be sure that the new mount point (based on the label) does not already exist since hal's automount function creates the directory when it mounts the device. IconsPage?action=AttachFile&do=get&target=important.png This guide is primarily for external drives such as USB hard drives, USB flash drives, and flash memory cards. You can label internal disks, but to change their mount points, use MoveMountpointHowto which uses the file called Fstab.

Identify your Partition

IconsPage?action=AttachFile&do=get&target=IconGNOMETerminal.png For help with the terminal, see UsingTheTerminal. Plug in your USB device and list your partitions with:

sudo fdisk -l

You can also list your mounted devices and their descriptions with:

mount

IconsPage?action=AttachFile&do=get&target=example.png For the rest of this tutorial we will use the following:

  • <device> = your device /dev/sdxy, ex: /dev/sdb1
  • <label> = your desired (new) label, ex: my_external

Install the Labeling Program

Based on the package names listed above for each filesystem type, install the correct package for your partition:

sudo apt-get install <package>

Here are all the different ones:

 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

or install the appropriate package from Synaptic.

Unmount the Partition

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:

sudo umount <device>

ex:

 sudo umount /dev/sdb1

If it was automounted, you can also unmount the drive by right clicking the desktop icon and clicking Unmount (or Eject in some cases).

Changing the Label

After you complete the appropriate porition for your filesystem, jump to the next section to verify the change.

FAT16 and FAT32

These filesystems are most often found on USB thumb drives, flash cards (like for a camera or cell phone), and older external USB hard drives.

Check the current label

sudo mlabel -i <device> -s ::

ex:

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

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:

 sudo mlabel -i /dev/sdb1 ::my_external

Ignore the "Volume label is XYZ" output as this is the old label. Jump to the Verify the Change section below.

Option 2

For Ubuntu 8.10 and up, edit mtools.conf as sudo

sudo nano /etc/mtools.conf 

add something like for each drive:

 drive p: file="/dev/sdb1"
 drive q: file="/dev/sdb2"

etc. Then use

sudo mlabel p:new_label

ex:

 sudo mlabel p:30GB_FAT32

(note the underscore _ should be used, as spaces are not allowed) http://ubuntuforums.org/showpost.php?p=6356016&postcount=9

Error message

If you get a message like this:

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

NTFS

This filesystem is most often found on external USB and firewire hard drives or other Windows formatted disks.

Check the current label

sudo ntfslabel <device>

ex:

 sudo ntfslabel /dev/sdb1

Change the label

Note: 128 characters maximum.

sudo ntfslabel <device> <label>

ex:

 sudo ntfslabel /dev/sdb1 my_external

Ubuntu caches the drive's label so to see full affects of the change it is not enough just to umount and mount it again, the you should umount, remove, put back, mount again.

ext2, ext3, and ext4

These filesystems are most often found on linux formatted drives.

Check the current label

sudo e2label <device>

ex:

 sudo e2label /dev/sdb1

Change the label

Note: 16 characters maximum.

sudo e2label <device> <label>

ex:

 sudo e2label /dev/sdb1 my_external

JFS

These filesystems are most often found on IBM and some linux formatted disks.

Check the current label

sudo jfs_tune -l <device>

ex:

 sudo jfs_tune /dev/sdb1

Change the label

Note: 16 characters maximum.

sudo jfs_tune -L <label> <device>

ex:

 sudo jfs_tune -L my_external /dev/sdb1

ReiserFS (v3)

This filesystem is most often found on linux formatted disks. Note: this could work with ReiserFS 4 too, I have not tried.

Change the label

Note: 16 characters maximum.

sudo reiserfstune -l <label> <device>

ex:

 sudo reiserfstune -l my_external /dev/sdb1

XFS

This filesystem is most often found on UNIX formatted disks.

Check the current label

xfs_admin -l <device>

ex:

 xfs_admin -l /dev/sdb1

Change the label

Note: 12 characters maximum.

sudo xfs_admin -L <label> <device>

ex:

 xfs_admin -l my_external /dev/sdb1

Verify the Change

Now for the easiest part: unplug the drive, wait a second, then plug it back in. It should appear on your desktop with the new label and have its new mount point. Without unplugging and having the device remount, you can also just run:

sudo blkid

Other Resources

IconsPage?action=AttachFile&do=get&target=IconBook-small.png Some other related material: