个人工具

UbuntuHelp:RenamingExt3Partitions/zh

来自Ubuntu中文

Fideas讨论 | 贡献2007年5月18日 (五) 23:42的版本 (New page: {{Copyedit translation|from=https://help.ubuntu.com/community/RenamingExt3Partitions}} {{From|https://help.ubuntu.com/community/RenamingExt3Partitions}} {{Translator|雕啸长空 Fideas}} ...)

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


重命名移动存储设备上的Ext3分区

通常情况下我们无需特意为某个分区指定名称,因为一般你作为挂载点的文件夹名称就会被指定为该设备的名称,但当被挂载的为移动设备上的某个分区时情况有所不同,主要是因为这类USB设备通常都是由系统自动挂载的,所以你不能为它指定具体的挂载点(这里说的不能只是指更改起来比较烦杂一些).

This command is to specify the name for the partiton, so whenever you plug it in to your computer (or any linux computer for that matter) it should show up as whatever you name it, in a folder of the same name located in /media/.

To rename an ext3 partiton, type this command in (after filling out the correct information, described below)

  tune2fs -L NewLabel /dev/XXX
  

Where you replace 'NewLabel' With the desired name of your hard drive, and you replace '/dev/XXX' with the correct path to your hard drive, like /dev/sda1 or something. To find this, you can usually use a partition editor (like qtparted or gparted) and choose your drive you want to rename and look at the path there. Or you could open up the terminal, and type "fdisk -l" and it will show all the hard drives attached to your system (it will only show drives that you are the owner of, and if it doesn't show up with this command, try running it with sudo. Same thing goes for the partition editor...) and then you can just type in the correct path.

Once you have replaced NewLabel and /dev/xxx then press enter and it should write the new name to your drive. I found that it only changes after you restart, so once you restart your computer, your new hard drive (like my usb hard drive) will mount in /media/drivename, where drivename is the name you named it as (duh) and it should now appear on the desktop and elsewhere in the file manager as whatever you named it as. Enjoy.

Renaming Ext3 Partitions on Internal or Non-Portable Hard Drives

To do this, you simply just have to change what folder it mounts to. Think of a good name, and then once you have thought of a new name that you want your drive or partiton to show up as, type this in the terminal: (substituting DRIVENAME for the name that you thought of)

  sudo mkdir /media/DRIVENAME
  

Then, after that command, type this in the terminal:

  sudo cp /etc/fstab /etc/fstab_backup
  gksudo gedit /etc/fstab
  

If you dont have or dont like gedit, substitute that command for your favorite text editor. Anyway, once it's open, look through the file and find the drive you want to rename (you should be able to find it by what path each drive is mounted to. Example, if you see "/dev/hde4 /home" , then you should be able to tell that /dev/hde4 is your /home partition)

Then, change the mount point to the folder that you just created. So, if you have /dev/hda2 mounted at /media/windows, you would delete "windows" and then type in the name that you thought of earlier so it would be /media/whatevernameyouthoughtof

Click save, then close the window. Reboot, and hopefully all went well and your partition should of mounted in the new folder and will now show up on your desktop with the name you specified.

If all did NOT go well, then you can restore the backup of the fstab file that i made you make. Simply type in the terminal:

  sudo cp /etc/fstab_backup /etc/fstab
  

then you should have the original fstab file that you had before you started any of this, and you should be able to try again.

Good Luck!