InstallingANewHardDrive
安装新硬盘
原文出处:官方WIKI
原文作者:
授权许可:
翻译人员:sanebaby
校正人员:purewind
贡献人员:
适用版本: 文章状态:翻译完成
Introduction(说明)
This howto explains how to configure Ubuntu so that an additional hard disk is accessible. We assume that the hard drive is physically mounted and detected by the BIOS.
本文将说明在添加了新的磁盘后如何配置Ubuntu使其可以访问。我们假定磁盘已经被物理安装,且已经被BIOS检测到。
Understanding basic command line usage is needed for this.
这里需要了解基本的命令行的用法。
Find drive info(找到硬盘信息)
To find out what the system sees as the drive letter/number:
找出系统标示的磁盘的 盘符/编号:
sudo lshw -C disk
attachment:IconsPage/IconExample48.png
Here is sample output:
这有一个输出样本:
**-disk description: ATA Disk product: IC25N040ATCS04-0 vendor: Hitachi physical id: 0 bus info: [email protected] logical name: /dev/hda version: CA4OA71A serial: CSH405DCLSHK6B size: 37GB capacity: 37GB
Set up drive(设置硬盘)
Skip to "Set mount point" if the drive already has data on it. Otherwise, you need to decide if you want to make one big partition on the drive or several smaller ones. You would use fdisk to accomplish this. For illustration I'll use /dev/hdd1:
如果你的磁盘上已经有数据存在,请跳至"Set mount point"(设定加载点) 。否则您需要决定把该硬盘作为一个大分区使用还是分为几个小的分区。您将用 fdisk 来完成这项工作。例如我将使用/dev/hdd1;
sudo fdisk /dev/hdd
The number of cylinders for this disk is set to 77557. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with:
这个磁盘的柱面数为77557。这没有任何错误,但是大于1024可能会在一些特定的设置中引起问题:
- software that runs at boot time (e.g., old versions of LILO)
启动过程中运行的软件(如:老版本的LILO) - booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK)
其它操作系统中的引导和分区软件(如:DOS FDISK,OS/2 FDISK)
- software that runs at boot time (e.g., old versions of LILO)
Command (m for help): m <enter> Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only) Command (m for help):n <enter> Command action e extended p primary partition (1-4) p <enter> Partition number (1-4): 1 <enter> Command (m for help):w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. user@myubuntubox:~ $
Format disk(格式化磁盘)
Then you format the disc like this (I'll make it an ext3 partition)
您可以像这样格式化磁盘(我将磁盘格式化为ext3格式)
sudo mke2fs -j /dev/hdd1 mke2fs 1.35 (28-Feb-2004) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 4889248 inodes, 9772174 blocks 488608 blocks (5.00%) reserved for the super user First data block=0 299 block groups 32768 blocks per group, 32768 fragments per group 16352 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624 Writing inode tables: done Creating journal (8192 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 27 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. user@myubuntubox:~ $
Modify reserved space (optional)(修改保留空间-可选)
When formatting the drive, 5% of the drive space is reserved for the super user so that the operating system can still write to the disk even if it is full. However, for disks that only contains data this is not necessary. You can ajust the percentage of reserved space with the "tune2fs" command, like this:
当您格式化磁盘时,为了保证操作系统在磁盘己满的情况下仍能写入数据,5%的磁盘空间将保留给管理员。然而,对于只用来存放数据的磁盘并不需要。您可以用“tune2fs”命令调整保留空间的百分比,像这样:
sudo tune2fs -m 1 /dev/hdd1
This example reserves 1% of space - change this number if you want.
上面的例子保留了1%的空间--如果需要您可以修改此数字。
{i} Using this command does not change any existing data on the drive. You can use it on a drive which already contains data.
{i} 使用这条命令不会影响磁盘上的数据。您可以在任何含有数据的磁盘上使用该命令。
Set mount point(设定挂载点)
Next make your mount point:
接下来设定您的挂载点:
sudo mkdir /backup
and mount it:
挂载:
sudo mount /dev/hdd1 /backup
Set to mount at boot(设定为启动挂载)
Next add an entry in /etc/fstab using existing entries as a guide and you can then mount and/or unmount your new drive as you see fit by using the command:
接下来添加一条内容到 /etc/fstab ,用已存在的内容作为参照。现在您可以使用如下命令来挂载或缷载您的新磁盘:
sudo mount /backup
{i} A good guide to fstab can be found here
{i} 这里有一个针对fstab的好指南。
To unmount the drive:
缷载磁盘
sudo umount /backup <enter>
That's it :)
好了 :)
Need help?(需要帮助? )
attachment:IconsPage/IconHelp.png
If you run into problems or need more help; search here in the wiki or go to http://ubuntuforums.org and ask for help.
如果您在运行过程中遇到了问题或需要更多的帮助,请在wiki中搜索或到 http://ubuntuforums.org 寻求帮助。