个人工具

RenameUSBDrive

来自Ubuntu中文

跳转至: 导航, 搜索

Editing ext2/ext3/FAT32/NTFS Partition Labels

编辑ext2/ext3/FAT32/NTFS磁盘分区卷标

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

根据不同的磁盘分区类型,分别有3个程序可供选用.

  • For FAT32 Partitions you use Mtools.
  • Mtools 适用于 FAT32 格式分区.
  • For NTFS Partitions you use ntfsprogs.
  • ntfsprogs 适用于 NTFS 格式分区.
  • For ext2 or ext3 Partitions you use e2label.
  • e2label适用于 ext2ext3 型格式分区.

Instructions for all are given below.

以上程序的具体使用说明分别如下:

Editing FAT32 Partition Labels using mtools

使用mtools编辑FAT32磁盘分区卷标

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.

我想更改由系统自动挂载的USB设备中的FAT32分区卷标.我有两个外接硬盘驱动器(一个日常家用,一个公司工作用),其中一个是iPod.这两个驱动器都被系统以”sda1”或”sda2”等名称挂载于”/media”目录下,在电脑里我很难通过这些名字辨认出哪个文件夹是对应哪个驱动器.后来,我发现更改这些驱动器上的FAT32分区卷标不是件容易事.所以我觉得有必要将我是如何修改这些FAT32分区卷标的过程写下来.方便那些遇到同样问题的人.讲解之前首先明白:系统会将外接的驱动器自动挂载到”/media/”目录下,以”sda1”类似的卷标名命名分区,为了容易区别各分区,我们需要修改默认的卷标

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

按如下步骤一步一步操作即可更改FAT分区卷标:

Instructions: 操作指导

1) Install mtools:安装mtools 软件包

sudo apt-get install mtools 

2) After the usb drive is automounted after plugging in, find out the device descriptor using:

系统自动装载插入的USB设备后,可以用如下命令查看新设备相关信息:

mount

and Note down where it says “sda1″ or similar

显示信息中”sda1”或与之相似的字段即是系统分配给设备的名字。

3) copy the mtools.conf to ~/.mtoolsrc

复制”/etc”目录下mtools.conf文件为新文件"~/.mtoolsrc"

cp /etc/mtools.conf ~/.mtoolsrc 

4) Edit ~/.mtoolsrc to add one line at the very end:

编辑刚复制的”~/.mtoolsrc”文件,在最后一行加入如下命令行:

drive i: file="/dev/sda2"

you may have to change sda2 to something else depending on what you got in step 2 above.

  • 上面命令行中字段”sda2”应根据实际情况更改为你在第二步操作中所看到的新设备名称。

5) Change to the “drive” i:

更改命令提示符路径到”i:”盘:

mcd i: 

6) Check what the label for the drive is currently:

查看”i:”当前的卷标

sudo mlabel -s i: 

7) Change the label to something pretty:

更改”i:”盘原始卷标为你喜欢的新卷标名:

sudo mlabel i:my-ipod

replace my-ipod with what you would like to name the usb drive

你可以将上述命令行操作中的”my-ipod”字段替换为你喜欢的名字,用以代表插入的USB设备。

8) Check if the label has changed:

检查更改是否成功

sudo mlabel -s i:

I got the following output – Volume label is MY-IPOD

经过以上操作,电脑显示如下信息: Volume label is MY-IPODYou’re

all set!! The next time that partition gets automounted, it will be at /media/MY-IPOD

恭喜!卷标修改已经成功.下次插入USB设备后,你可以在目录” /media/MY-IPOD”下找到你USB设备上的文件。

Editing NTFS Partition Labels using ntfsprogs

使用ntfsprogs 修改NTFS分区卷标

Instructions:操作指导

1) Install ntfsprogs: 安装ntfsprogs软件包

sudo apt-get install ntfsprogs 

2) After the drive is automounted after plugging in, find out the device descriptor using:

NTFS分区驱动器插入后被自动装载,可以用如下命令查看此新设备相关信息:

mount

and Note down where it says “sda1″ or similar

显示信息中”sda1”或与之相似的字段即是系统分配给新设备的名字。

3) Change the label to something pretty:

更改原始卷标为你喜欢的新卷标名:

sudo ntfslabel /dev/sda1 newlabel

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

用你喜欢的卷标名替换此命令中的单词”newlabel” 。

you may have to unmount the drive for this to work (system-> administration-> disks -> then under partitions for the hard disk hit disable). 和FAT分区不同,更改NTFS分区卷标后你必须卸下此设备(卸载步骤:系统->管理->磁盘管理->硬盘分区下面的”禁用”按钮)

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 .

重启电脑后查看相应NTFS分区卷标是否改变.如果你更改的是USB设备卷标,你需要重新插入设备。

Editing ext2 or ext3 Partition Labels using e2label

使用e2label更改 ext2 或ext3 分区卷标

Instructions: 操作指南

1) After the drive is automounted after plugging in, find out the device descriptor using:

设备被自动加载后,可以用如下命令查看此新设备相关信息:

mount

and Note down where it says “sda1″ or similar

显示信息中”sda1”或与之相似的字段即是系统分配给新设备的名字。

2) Change the label to something pretty:

更改原始卷标为你喜欢的新卷标名:

sudo e2label /dev/sda1 newlabel

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

用你喜欢的卷标名替换此命令中的单词”newlabel

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

重启电脑后查看相应分区卷标是否改变.如果你更改的是USB设备卷标,你需要重新插入设备。


  • 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.

以上内容来源于http://ubuntu.wordpress.com/,个人认为值得加入到wiki中,因为这是使用中遇到的问题[1] [2]


  • 文章来源:官方WIKI
    翻译人员:CaoXiaoboBUAA
    校对人员:purewind
    文章状态:完成