翻译完毕

This commit is contained in:
Luny 2013-09-16 22:29:18 +08:00
parent e4e4c24457
commit e4bcf6210d

View File

@ -1,98 +1,88 @@
如何添加或编辑文件系统卷标(Luny正在翻译...)
=======================
如何添加或修改文件系统标签
==========================
File system labels are not something you need to have in order to have a functioning Linux operating system, but they can make your computer easier to navigate when you have several disk partitions. In this post I'll show how to add or **edit a Linux file system label** for ext2, ext3, and ext4 disk partitions.
为了有一个正常运作的Linux操作系统文件系统标签不是必须的但当你有几个磁盘分区时文件系统标签可以使你的电脑更容易去定位。在这篇文章中我将展示如何在ext2,ext3和ext4磁盘分区中添加或**修改Linux文件系统标签**。
My netbook has 3 OS's installed; Windows XP, Linux Mint, and Xubuntu. Sometimes I want to view files located on one file system from one of the other operating systems. It's convenient to have these [file systems labeled][1], so I know which one to open to find the desired files.
我的上网本装有3个操作系统;Windows XP, Linux Mint, 和Xubuntu。有时我想要在其它操作系统上去查看一个文件系统的文件位置这时候[文件系统标签][1]是非常方便的,因此我可以知道去那个文件系统上找到和打开我想要的文件。
###View Linux File System Labels
###查看Linux文件系统标签
It might be handy to first take a look at what file systems already have a label and which ones don't. You can view information about your files systems with the **blkid** command. You may need to run the command as root to see all of the information.
首先来查看一个文件系统是否有标签可能是非常方便的。你可以用**blkid**命令来查看你的文件系统信息。运行这个命令去查看你的文件系统全部信息可能需要root权限。
sudo blkid -c /dev/null
On my netbook, the output looks like this.
在我的上网本里输出的信息看起来像这样。
/dev/sda1: LABEL="WINRE" UUID="80AE-9D55" TYPE="vfat"
/dev/sda2: LABEL="OS_Install" UUID="E468676968673A06" TYPE="ntfs"
/dev/sda3: UUID="012ff341-f854-4c4f-8bbd-bbc810121fe6" TYPE="ext4"
/dev/sda5: UUID="ec0fe4d1-e21c-407d-8374-aa4b470519da" TYPE="ext3"
/dev/sda1: LABEL="WINRE" UUID="80AE-9D55" TYPE="vfat"
/dev/sda2: LABEL="OS_Install" UUID="E468676968673A06" TYPE="ntfs"
/dev/sda3: UUID="012ff341-f854-4c4f-8bbd-bbc810121fe6" TYPE="ext4"
/dev/sda5: UUID="ec0fe4d1-e21c-407d-8374-aa4b470519da" TYPE="ext3"
/dev/sda6: UUID="ee275431-64b2-4f55-b958-4055147cdf4e" TYPE="swap"
/dev/sda7: UUID="99feb5c5-25a6-47a3-aa2c-6d466c0094ab" TYPE="ext4"
Now I can also check where certain file systems are mounted on my current system with **lsblk**.
现在我用**lsblk**命令同样可以检查挂载在我当前系统上的某一个文件系统。
lsblk
The output from my Linux Mint OS looks like this.
在我的Linux Mint 系统上输出看起来像这样。
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 149.1G 0 disk
|-sda1 8:1 0 3.9G 0 part
|-sda2 8:2 0 39.1G 0 part
|-sda3 8:3 0 9.3G 0 part /
|-sda4 8:4 0 1K 0 part
|-sda5 8:5 0 86G 0 part /home
|-sda6 8:6 0 1.4G 0 part [SWAP]
|-sda7 8:7 0 9.3G 0 part
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 149.1G 0 disk
|-sda1 8:1 0 3.9G 0 part
|-sda2 8:2 0 39.1G 0 part
|-sda3 8:3 0 9.3G 0 part /
|-sda4 8:4 0 1K 0 part
|-sda5 8:5 0 86G 0 part /home
|-sda6 8:6 0 1.4G 0 part [SWAP]
|-sda7 8:7 0 9.3G 0 part
As you can see from the output from **blkid** and **lsblk**, only my Windows partitions have labels. Looking at my file manager I see a generic title for one of the partitions.
正如你看到的,在**blkid**和**lsblk**命令输出信息上只有我的Windows分区是有标签的浏览我的文件管理器可以看到每一个分区都有一个通用的名称。
Need to edit linux file system label
需要修改linux文件系统标签
Unlabeled partition
无标签的分区
###Edit a Linux File System Label with e2label
###用e2label修改Linux文件系统标签
Looking at the output from **lsblk** I can see that my Linux Mint installation is on /dev/sda3, my home partition is on /dev/sda5, and my Xubuntu installation is on /dev/sda7. I'm going to use [e2label][2] as root to assign labels to these partitions.
查找**lsblk**命令的输出我可以看到我的Linux Mint安装在/dev/sda3分区上我的/home分区是在/dev/sda5分区上和我的Xubuntu安装在/dev/sda7分区上。我在root权限下用[e2label][2]命令给在这些分区分配标签。
sudo e2label /dev/sda3 Mint
sudo e2label /dev/sda5 Home
sudo e2label /dev/sda7 Xubuntu
sudo e2label /dev/sda3 Mint
sudo e2label /dev/sda5 Home
sudo e2label /dev/sda7 Xubuntu
Now if I look at the output of **blkid**,
如果我现在查看**blkid**命令的输出,
sudo blkid -c /dev/null
/dev/sda1: LABEL="WINRE" UUID="80AE-9D55" TYPE="vfat"
/dev/sda2: LABEL="OS_Install" UUID="E468676968673A06" TYPE="ntfs"
/dev/sda3: UUID="012ff341-f854-4c4f-8bbd-bbc810121fe6" TYPE="ext4" LABEL="Mint"
/dev/sda5: UUID="ec0fe4d1-e21c-407d-8374-aa4b470519da" TYPE="ext3" LABEL="Home"
/dev/sda6: UUID="ee275431-64b2-4f55-b958-4055147cdf4e" TYPE="swap"
/dev/sda7: UUID="99feb5c5-25a6-47a3-aa2c-6d466c0094ab" TYPE="ext4" LABEL="Xubuntu"
/dev/sda1: LABEL="WINRE" UUID="80AE-9D55" TYPE="vfat"
/dev/sda2: LABEL="OS_Install" UUID="E468676968673A06" TYPE="ntfs"
/dev/sda3: UUID="012ff341-f854-4c4f-8bbd-bbc810121fe6" TYPE="ext4" LABEL="Mint"
/dev/sda5: UUID="ec0fe4d1-e21c-407d-8374-aa4b470519da" TYPE="ext3" LABEL="Home"
/dev/sda6: UUID="ee275431-64b2-4f55-b958-4055147cdf4e" TYPE="swap"
/dev/sda7: UUID="99feb5c5-25a6-47a3-aa2c-6d466c0094ab" TYPE="ext4" LABEL="Xubuntu"
I can see that the labels have been applied. Checking my file manager I also see that my 10.0 GB partition is now shown with the Xubuntu label.
我可以看到标签已经被应用了。检查我的文件管理器我同样可以看到我10.0GB的分区现在显示的是Xubuntu标签。
After editing Linux file system label
###提示
File system with label
###Tips
You can also view the label of an individual partition with **e2label** like this for partition 5.
你同样可以用**e2label**命令来查看单独的分区标签如查看分区5.
sudo e2label /dev/sda5
To remove the label from partition 5:
删除分区5的标签
sudo e2label /dev/sda5 ""
This tutorial was written by [Linerd][3] and originally appeared on [Tux Tweaks][4] at http://tuxtweaks.com/2013/08/edit-a-linux-file-system-label/.
这个教程写自[Linerd][3]和最初发表在[Tux Tweaks][4]上http://tuxtweaks.com/2013/08/edit-a-linux-file-system-label/
via: http://tuxtweaks.com/2013/08/edit-a-linux-file-system-label/
本文由 [LCTT][] 原创翻译,[Linux中国][] 荣誉推出
译者:[译者ID][] 校对:[校对者ID][]
译者:[Luny][] 校对:[校对者ID][]
[LCTT]:https://github.com/LCTT/TranslateProject
[Linux中国]:http://linux.cn/portal.php
[译者ID]:http://linux.cn/space/译者ID
[Luny]:http://linux.cn/space/14455/
[校对者ID]:http://linux.cn/space/校对者ID
[1]:https://wiki.archlinux.org/index.php/Persistent_block_device_naming
[2]:http://linux.die.net/man/8/e2label
[3]:http://tuxtweaks.com/author/Linerd/
[4]:http://tuxtweaks.com/