linux 新加硬盘操作步骤

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

如何为Linux操作系统添加硬盘
Linux学习2010-06-11 10:26:25 阅读71 评论0 字号:大中小订阅
如果你安装完Linux后,用过一段时间,觉得硬盘不够用了,要加装一块新硬盘,该怎么办呢?笔者以自己添加一个SCSI硬盘为例。

1.首先进行RAID设置;
2.进入linux系统,fdisk,mke2fs命令。

fdisk命令详解如下图:
新安装的硬盘没有任何分区,我得操作如下:
(1).fdisk /dev/sdc //输入fdisk命令,格式化第三个SCSI硬盘,原有2块。

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous content won't be recoverable.
The number of cylinders for this disk is set to 121534.
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)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by
w(rite)
(2).Command (m for help): n //输入n,创建一个新的分区
Command action
e extended
p primary partition (1-4)
p //选择p,并输入1,创建sdc1分区
Partition number (1-4): 1
First cylinder (1-121534, default 1): //输入该分区开始扇区
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-121534, default 121534): 40178 // //输入该分区结束扇区
(3).重复(2)依次创建sdc2,sdc3
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (40179-121534, default 40179):
Using default value 40179
Last cylinder or +size or +sizeM or +sizeK (40179-121534, default 121534): 80356
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (80357-121534, default 80357):
Using default value 80357
Last cylinder or +size or +sizeM or +sizeK (80357-121534, default 121534): Using default value 121534
(4)Command (m for help): p //显示分区情况
Disk /dev/sdc: 999.6 GB, 999653638144 bytes
255 heads, 63 sectors/track, 121534 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 1 40178 322729753+ 83 Linux
/dev/sdc2 40179 80356 322729785 83 Linux
/dev/sdc3 80357 121534 330762285 83 Linux
(5).Command (m for help): w //将分区情况写入磁盘,即保存分区信息The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
(6).依次格式化三个分区
mke2fs /dev/sdc1 (格式化为ext2格式)
(mke2fs -j /dev/sdc1 (格式化为ext2格式),mkfs.ext3 格式化为ext3格式mkfs -t ext3 )
tune2fs -j ***** 将ext2转换成ext3
df -T 查看时ext2格式还是ext3
可以参考:/main/?q=node/83
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
40353792 inodes, 80682438 blocks
4034121 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
2463 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 23 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
*********************************
mke2fs /dev/sdc2
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
40353792 inodes, 80682446 blocks
4034122 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
2463 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968
Writing inode tables: done
Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 38 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.
***********************************************************
mke2fs /dev/sdc3
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
41353216 inodes, 82690571 blocks
4134528 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
2524 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968
Writing inode tables: done
Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 33 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.
再用df -h 命令查看下系统下所有分区情况,结果发现没有刚建立的分区,用fdisk -l 或者cat /proc/partitions 命令查看硬盘详细信息,发现有刚分区信息。

WHy?????? 稍加思考下linux和windows的硬件管理方式就明白,原来没有挂载(mount),立即运行mount /dev/sdc1 /genome ; mount /dev/sdc2
/data_backup ; mount /dev/sdc3 /soft 一切OK!
重启电脑看看??结果还是没有新加的分区?why?不能自动mount!怎么办?
方法一:将mount命令行直接写入/etc/rc.d/rc.local
方法二:修改/etc/fstab 即可
/dev/sdc3 /data_backup ext3 defaults 1 2。

相关文档
最新文档