悲伤的不能自己怎么读:安装新硬盘

来源:百度文库 编辑:偶看新闻 时间:2024/04/28 16:09:53

安装新硬盘

目录

[隐藏]
  • 1 安装新硬盘
    • 1.1 Introduction(说明)
    • 1.2 Find drive info(找到硬盘信息)
    • 1.3 Set up drive(设置硬盘)
    • 1.4 Format disk(格式化磁盘)
    • 1.5 Modify reserved space (optional)(修改保留空间-可选)
    • 1.6 Set mount point(设定挂载点)
    • 1.7 Set to mount at boot(设定为启动挂载)
    • 1.8 Need help?(需要帮助? )

[编辑] 安装新硬盘

原文出处:官方WIKI

原文作者:

授权许可:

  • 创作共用协议Attribution-ShareAlike 2.0
  • GNU自由文档许可证

翻译人员:sanebaby

校正人员:purewind

贡献人员:

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



[编辑] Introduction(说明)

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

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

[编辑] Find drive info(找到硬盘信息)

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

sudo lshw -C disk

这有一个输出样本:

**-diskdescription: ATA Diskproduct: IC25N040ATCS04-0vendor: Hitachiphysical id: 0bus info: ide@0.0logical name: /dev/hdaversion: CA4OA71Aserial: CSH405DCLSHK6Bsize: 37GBcapacity: 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 Command actiona   toggle a bootable flagb   edit bsd disklabelc   toggle the dos compatibility flagd   delete a partitionl   list known partition typesm   print this menun   add a new partitiono   create a new empty DOS partition tablep   print the partition tableq   quit without saving changess   create a new empty Sun disklabelt   change a partition's system idu   change display/entry unitsv   verify the partition tablew   write table to disk and exitx   extra functionality (experts only)Command (m for help):n Command actione   extendedp   primary partition (1-4)p Partition number (1-4):1 Command (m for help):wThe partition table has been altered!Calling ioctl() to re-read partition table.Syncing disks.user@myubuntubox:~ $

[编辑] Format disk(格式化磁盘)

您可以像这样格式化磁盘(我将磁盘格式化为ext3格式)

sudo mke2fs -j /dev/hdd1mke2fs 1.35 (28-Feb-2004)Filesystem label=OS type: LinuxBlock size=4096 (log=2)Fragment size=4096 (log=2)4889248 inodes, 9772174 blocks488608 blocks (5.00%) reserved for the super userFirst data block=0299 block groups32768 blocks per group, 32768 fragments per group16352 inodes per groupSuperblock backups stored on blocks:32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632,2654208, 4096000, 7962624Writing inode tables: doneCreating journal (8192 blocks): doneWriting superblocks and filesystem accounting information: doneThis filesystem will be automatically checked every 27 mounts or180 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 

好了 :)

[编辑] Need help?(需要帮助? )