个人工具

UbuntuHelp:RenameUSBDrive

来自Ubuntu中文

Oneleaf讨论 | 贡献2007年5月13日 (日) 11:36的版本 (New page: {{From|https://help.ubuntu.com/community/RenameUSBDrive}} {{Languages|php5}} == Editing ext2/ext3/ReiserFS/FAT32/NTFS Partition Labels == There are 4 programs you use to label a drive. The...)

(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航, 搜索

Editing ext2/ext3/ReiserFS/FAT32/NTFS Partition Labels

There are 4 programs you use to label a drive. The program used depends on the partition type.

  • For FAT32 Partitions you use Mtools.
  • For NTFS Partitions you use ntfsprogs.
  • For ext2 or ext3 Partitions you use e2label.
  • For ReiserFS (v3) partitions you can use reiserfstune.

Instructions for all are given below.

Editing FAT32 Partition Labels using mtools

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.

Step by step instructions to re-label FAT partitions follow:


Instructions:

1) Install mtools:

sudo apt-get install mtools
</code>

==== 2) After the usb drive is automounted after plugging in, find out the device descriptor using: ====
<pre>
mount
</code>
and Note down where it says “sda2″ or similar

==== 3) Check what the label for the drive is currently: ====
<pre>
sudo mlabel -i /dev/sda2 -s ::
</code>
You may have to change sda2 to something else depending on what you got in step 2 above.

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>
sudo mlabel -i /dev/sda2 ::my-ipod
</code>
replace my-ipod with what you would like to name the usb drive

==== 5) Check if the label has changed: ====
<pre>
sudo mlabel -i /dev/sda2 -s ::
</code>

I got the following output –
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>
sudo apt-get install ntfsprogs
</code>

==== 2) After the drive is automounted after plugging in, find out the device descriptor using: ====
<pre>
mount
</code>
and Note down where it says “sda1″ or similar

==== 3) Change the label to something pretty: ====
<pre>
sudo ntfslabel /dev/sda1 newlabel
</code>

replace '''newlabel''' with what you would like to name the usb drive / Harddisk

you may have to unmount the drive for this to work (system-> administration-> disks -> then under partitions for the hard disk hit disable).

==== 3) Check if the label has changed: ====

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>
mount
</code>
and Note down where it says “sda1″ or similar

==== 2) Change the label to something pretty: ====
<pre>
sudo e2label /dev/sda1 newlabel
</code>

replace '''newlabel''' with what you would like to name the usb drive / Harddisk

you may have to unmount the drive for this to work (system-> administration-> disks -> then under partitions for the hard disk hit disable).

==== 3) Check if the label has changed: ====

Restart your computer to see the label change if your harddrive is internal, and for usb just unplug/plug in USB again



=== 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>
mount
</code>
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.

==== 2) Unmount the partitions you want to label ====

For example:

<pre>
sudo umount /dev/sda1
</code>

==== 3) Change the label to something pretty ====

(note: 16 characters maximum)

<pre>
sudo reiserfstune -l 'johnny' /dev/sda1
</code>



----


=== Credits ===

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)

CategoryDocumentation CategoryCleanup

[[category:UbuntuHelp]]