您现在位于:  首页  → 计算机  → linux  → Linux硬盘安装
Linux硬盘安装 (原创)
汤锡文 2006.05.03

1. 检查所有硬盘分区
[root@web home]# fdisk -l

Disk /dev/hdc: 81.9 GB, 81964302336 bytes
255 heads, 63 sectors/track, 9964 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hdc1 * 1 3921 31495401 7 HPFS/NTFS
/dev/hdc2 3922 9964 48540397+ f Win95 Ext'd (LBA)
/dev/hdc5 3922 7840 31479336 7 HPFS/NTFS
/dev/hdc6 7841 9964 17060998+ 7 HPFS/NTFS

Disk /dev/hda: 60.0 GB, 60022480896 bytes
255 heads, 63 sectors/track, 7297 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 7043 56468475 83 Linux
/dev/hda3 7044 7297 2040255 82 Linux swap

2. 检查新硬盘分区
[root@web root]# fdisk /dev/hdc

The number of cylinders for this disk is set to 9964.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

3. 删除老硬盘分区(hdc1,hdc2,hdc5,hdc6)
Command (m for help): d
Partition number (1-6): 6

4. 保存修改信息
Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

5. 检查保存情况,直到所有老分区都删除
[root@web root]# fdisk -l /dev/hdc

Disk /dev/hdc: 81.9 GB, 81964302336 bytes
255 heads, 63 sectors/track, 9964 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hdc2 3922 9964 48540397+ f Win95 Ext'd (LBA)
/dev/hdc5 3922 7840 31479336 7 HPFS/NTFS

6. 重新创建硬盘分区
[root@web root]# fdisk -l /dev/hdc

Disk /dev/hdc: 81.9 GB, 81964302336 bytes
255 heads, 63 sectors/track, 9964 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

Command (m for help): d
No partition is defined yet!

Command (m for help): n
Command action
e extended
p primary partition (1-4)

7. 选择主分区(?)
p

8. 选择硬盘分区号(hdc1中的1)
Partition number (1-4): 1

9. 选择硬盘分区的第一柱面(从第2个开始,从1开始不安全(?))
First cylinder (1-9964, default 1): 2

10. 选择硬盘分区结束柱面
Last cylinder or +size or +sizeM or +sizeK (2-9964, default 9964): 5000

11. 保存修改信息
Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

12. 创建hdc2
[root@web root]# fdisk /dev/hdc

The number of cylinders for this disk is set to 9964.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (1-9964, default 1): 5001
Last cylinder or +size or +sizeM or +sizeK (5001-9964, default 9964):
Using default value 9964

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

13. 检查新硬盘创建信息
[root@web root]# fdisk -l

Disk /dev/hdc: 81.9 GB, 81964302336 bytes
255 heads, 63 sectors/track, 9964 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hdc1 2 5000 40154467+ 83 Linux
/dev/hdc2 5001 9964 39873330 83 Linux

Disk /dev/hda: 60.0 GB, 60022480896 bytes
255 heads, 63 sectors/track, 7297 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 7043 56468475 83 Linux
/dev/hda3 7044 7297 2040255 82 Linux swap

14. 建立新硬盘映射目录
[root@web root]# mkdir -pv /disk1
[root@web root]# mkdir -pv /disk2

15. 格式化新硬盘分区
[root@web root]# mkfs.ext3 /dev/hdc1
mke2fs 1.32 (09-Nov-2002)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
5020064 inodes, 10038616 blocks
501930 blocks (5.00%) reserved for the super user
First data block=0
307 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 28 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

[root@web root]# mkfs.ext3 /dev/hdc2
mke2fs 1.32 (09-Nov-2002)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
4987360 inodes, 9968332 blocks
498416 blocks (5.00%) reserved for the super user
First data block=0
305 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 29 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

16. 增加新硬盘分区表信息
[root@web root]# vi /etc/fstab

LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
/dev/hda3 swap swap defaults 0 0
/dev/hdc1 /disk1 ext3 defaults 1 1
/dev/hdc2 /disk2 ext3 defaults 1 1

17. 挂上硬盘
[root@web root]# mount -a

18. 检查所有硬盘mount情况
[root@web root]# df -h
/dev/hda2 54G 1.4G 49G 3% /
/dev/hda1 99M 15M 80M 16% /boot
none 1008M 0 1008M 0% /dev/shm
/dev/hdc1 38G 33M 36G 1% /disk1
/dev/hdc2 38G 33M 36G 1% /disk2

对“Linux硬盘安装”发表评论  


您是否还没有 注册 或还没有 登陆 本站?!
 
CopyRight by tangtang.org 2004-2005┋ 菜子园 ┋ TOP