特殊:Badtitle/NS100:RenamingExt3Partitions

来自Ubuntu中文
Oneleaf留言 | 贡献2007年5月13日 (日) 11:36的版本 (New page: {{From|https://help.ubuntu.com/community/RenamingExt3Partitions}} {{Languages|php5}} == Renaming Ext3 Partitions on External Hard Drives == Usually you wouldn't have to rename a partition,...)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳到导航跳到搜索

{{#ifexist: :RenamingExt3Partitions/zh | | {{#ifexist: RenamingExt3Partitions/zh | | {{#ifeq: {{#titleparts:RenamingExt3Partitions|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:RenamingExt3Partitions|1|-1|}} | zh | | }}

Renaming Ext3 Partitions on External Hard Drives

Usually you wouldn't have to rename a partition, just because all you would have to do was to change what folder it got mounted to, and whatever that folder's name was, that was the name of the partition. But with external drives it's different, mostly because stuff like usb drives are automounted, so you can't specify what folder to mount it to easily.

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!