Linux下安装第二块新硬盘 - 详细步骤

来源:互联网 发布:防网络诈骗作文1000字 编辑:程序博客网 时间:2024/05/07 03:32

问题:新买了一块1 TB的希捷硬盘(为SATA II型,或二代串口),准备挂在红旗RedFlag Linux 6系统下,以存储海量的CCD images。

 

一、步骤总结

1、把新硬盘连接起来

2、在CMOS里配置新硬盘

3、查看硬盘代号

4、用 fdisk 对硬盘进行分区

5、格式化分区

6、创建挂载点

7、设置/dev/fstab 以便开机时自动挂载分区

8、设置新硬盘分区的读写权限

 

二、过程细节

 

1、把新硬盘连接起来

     打开机箱,发现联想(开天M4600, P4 3.0GHz)计算机机箱内没有提供额外的硬盘数据线,原来的硬盘是SATA I 型80GB (日立产),即有传统的电源和新式SATA盘的专用电源接口,以及SATA的新式数据线接口(不同于以前的并口硬盘很宽的线)。SATA硬盘都采用统一的硬塑皮外包的窄条红色电源及数据线了(手感硬硬的)。找来一根未拆包装的数据线,SATA II型新硬盘只有新式的电源线接口,不再象原来机器里的还有一个传统的电源接口,因没有找到单独的电源线,就交换一下:拔出SATA专用电源线留给新硬盘,在备用的一堆传统电源线里抽出一根接旧的硬盘。电脑主板上预留有SATA 2接口,即接第二个SATA硬盘的地方,如此很方便就完成硬连接。

 

2、在CMOS里配置新硬盘

启动计算机,并进入CMOS,让机器找到新硬盘。

IDE Channel 0Master:  none (没有盘)

IDE Channel 0Slave:    none   (没有盘)

IDE Channel 1Master:    是DVD-ROM

IDE Channel 1Slave:    none (没有盘)

IDE Channel 2Master:  HDS728080PLA380  (原来的80GBSATA I 硬盘)

IDE Channel 3Master:  none (没有盘)

 

在none 的Channels一个一个地让计算机自动寻找硬盘。最后发现了:

 

IDE Channel 3Master:  ST31000528AS   (新的1000GB SATA II型硬盘)

 

3 查看硬盘代号

   $ df 

发现:

         /dev/sda1     /C_disk   15GB     7   (reserved for Windows XP, my PC is adual-system)

         /dev/sda2    /               15GB   83  (Linux)

         /dev/sda3         LinuxLVM      8e   (Linux)

         /dev/sda4         extended

         /dev/sda5                                82  (Linux Swap, 512MB, twice of the momoey)

         /dev/sda6       /data                 83  (Linux, mounted on /data, 45.5GB)

注意:  SATA (通常称串口盘) 在Linux下被视为SCSI 盘(一种早期用在Sun工作站上和服务器的高速硬盘,那时很贵!)。

 

可以判定: 新的硬盘应该就是/dev/sdb 了。

 

进入超级用户:

$ su -l

password: yoursecrets

 

[root@Lenovo~]#

[root@Lenovo~] fdisk -l

 

出现类似下面的信息(以下提示信息仅供参考,有的并非本人实际操作时的屏幕显示,但意思是一样的):

Disk/dev/sda: 10.7 GB, 10737418240 bytes

255heads, 63 sectors/track, 1305 cylinders

Units= cylinders of 16065 * 512 = 8225280 bytes

Diskidentifier: 0x0007d856

 

   DeviceBoot      Start         End      Blocks   Id  System

/dev/sda1   *           1          25      200781   83  Linux

/dev/sda2              26        1305    10281600   8e  LinuxLVM

 

Disk /dev/sdb: 2147 MB, 2147483648 bytes <=新硬盘

 

255heads, 63 sectors/track, 261 cylinders

Units= cylinders of 16065 * 512 = 8225280 bytes

Diskidentifier: 0x00000000

 

Disk /dev/sdb doesn't contain a validpartition table

 

 4、 用 fdisk 对硬盘进行分区

[root@Lenovo~]#fdisk  /dev/sdb

Devicecontains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Buildinga new DOS disklabel with disk identifier 0x623223a1.

Changeswill remain in memory only, until you decide to write them.

Afterthat, of course, the previous content won't be recoverable.

 

Warning: invalid flag 0x0000 ofpartition table 4 will be corrected by w(rite)

 

Command (m for help): p  <=显示信息

 

Disk /dev/sdb: 1002.2 GB, 10*** bytes

255heads, 63 sectors/track, 121601 cylinders

Units= cylinders of 16065 * 512 = 8225280 bytes

Diskidentifier: 0x623223a1

 

   DeviceBoot      Start         End      Blocks   Id  System

 

Command (m for help): n  <=新建分区

Commandaction

   e   extended

   p   primarypartition (1-4)

p  <=新建主分区

Partitionnumber (1-4): 1  <=分区号为1,即/dev/sdb1

Firstcylinder (1-261, default 1):       回车取默认值

Usingdefault value 1

Lastcylinder or +size or +sizeM or +sizeK (1-261, default 261):   回车取默认值

Usingdefault value 261

 

Command (m for help): p  <=显示分区信息

 

Disk /dev/sdb: 2147 MB, 2147483648 bytes

255heads, 63 sectors/track, 261 cylinders

Units= cylinders of 16065 * 512 = 8225280 bytes

Diskidentifier: 0x623223a1

 

   DeviceBoot      Start         End       Blocks      Id    System

/dev/sdb1               1           261     2096451    83    Linux

 

Command (m for help): w  <=保存退出

Thepartition table has been altered!

 

Callingioctl() to re-read partition table.

Syncingdisks.

 

5格式化分区

# mkfs.ext3 -L /disk2/dev/sdb1   --格式化的同时给新硬盘加标签为disk2

或者 mkfs.ext3 /dev/sdb1  --只格式化但不加标签

单独加标签的命令是: # e2label  /dev/sdb1   /disk2

 

 

6、创建挂载点

[root@Lenovo~]# mkdir  /disk2

 

 

7、设置/dev/fstab 以便开机时自动挂载分区:

[root@Lenovo~]# vi /etc/fstab

 添加一行:

/dev/sdb1       /disk2        ext3       auto      1   2

若一次性手动挂载分区 ,使用命令: #mount /dev/sdb1 /disk2/

 

 

8、设置新硬盘或分区的读写权限:

# chmod  a+w   /disk2

这样所有计算机的用户都可以读写该分区,即/disk2盘了。 【完】

0 0
原创粉丝点击