个人工具

安装新硬盘

来自Ubuntu中文

Oneleaf讨论 | 贡献2007年5月23日 (三) 09:11的版本 (New page: == 安装新硬盘 == 原文出处:官方WIKI 原文作者: 授权许可: * [http://creativecommons.org/licenses/by-sa/2.0/ 创作共用协议Attribution-ShareAlike 2.0] * [http:/...)

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

安装新硬盘

原文出处:官方WIKI

原文作者:

授权许可:

翻译人员:sanebaby

校正人员:purewind

贡献人员:

适用版本: 文章状态:翻译完成



Introduction(说明)

本文将说明在添加了新的磁盘后如何配置Ubuntu使其可以访问。我们假定磁盘已经被物理安装,且已经被BIOS检测到。

这里需要了解基本的命令行的用法。

Find drive info(找到硬盘信息)

找出系统标示的磁盘的 盘符/编号:

sudo lshw -C disk

IconsPage?action=AttachFile&do=get&target=IconExample48.png

这有一个输出样本:

**-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(设置硬盘)

如果你的磁盘上已经有数据存在,请跳至"Set mount point"(设定加载点) 。否则您需要决定把该硬盘作为一个大分区使用还是分为几个小的分区。您将用 fdisk 来完成这项工作。例如我将使用/dev/hdd1;

sudo fdisk /dev/hdd

这个磁盘的柱面数为77557。这没有任何错误,但是大于1024可能会在一些特定的设置中引起问题:

  • 启动过程中运行的软件(如:老版本的LILO)
  • 其它操作系统中的引导和分区软件(如:DOS FDISK,OS/2 FDISK)
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(格式化磁盘)

您可以像这样格式化磁盘(我将磁盘格式化为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)(修改保留空间-可选)

当您格式化磁盘时,为了保证操作系统在磁盘己满的情况下仍能写入数据,5%的磁盘空间将保留给管理员。然而,对于只用来存放数据的磁盘并不需要。您可以用“tune2fs”命令调整保留空间的百分比,像这样:

sudo tune2fs -m 1 /dev/hdd1

上面的例子保留了1%的空间--如果需要您可以修改此数字。

{i} 使用这条命令不会影响磁盘上的数据。您可以在任何含有数据的磁盘上使用该命令。

Set mount point(设定挂载点)

接下来设定您的挂载点:

sudo mkdir /backup

and mount it:
挂载:

sudo mount /dev/hdd1 /backup

Set to mount at boot(设定为启动挂载)

接下来添加一条内容到 /etc/fstab ,用已存在的内容作为参照。现在您可以使用如下命令来挂载或缷载您的新磁盘:

sudo mount /backup

{i} 这里有一个针对fstab的好指南。

缷载磁盘

sudo umount /backup <enter>

好了 :)

Need help?(需要帮助? )

IconsPage?action=AttachFile&do=get&target=IconHelp.png

如果您在运行过程中遇到了问题或需要更多的帮助,请在wiki中搜索或到 http://ubuntuforums.org 寻求帮助。