CentOS系统只需6步添加新硬盘并分区格式化的方法
2013-06-15 16:20:15 来源:WEB开发网 1.先用Fdisk -l 来查看当前状态下磁盘情况
[root@linux1 ~]# fdisk -l
Disk /dev/hda: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 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 652 5132767 8e Linux LVM
Disk /dev/hdb: 2147 MB, 2147483648 bytes
16 heads, 63 sectors/track, 4161 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Disk /dev/hdb doesn't contain a valid partition table
上面红色标识行可以看出,我添加了一块新硬盘/dev/hdb,大小为2G,未分区格式化状态。
2.用Fdisk /dev/hdb来进行分区操作。
[root@linux1 ~]# fdisk /dev/hdb
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 4161.
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)
Command (m for help): n //输入N表示新建一个分区
Command action
e extended
p primary partition (1-4)
p //p 表示建立一个原始分区
Partition number (1-4): 1 //1 表示此分区编号为1.
First cylinder (1-4161, default 1): 1 //1表示使用默认起始柱面号.如果要分多个区的话,先盘算好要多大,再输入数字
Last cylinder or size or sizeM or sizeK (1-4161, default 4161): // 输入: 回车 表示使用默认结束柱面号.即此分区使用整个硬盘空间
Using default value 4161
Command (m for help): w //保存分区
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
3.再次查看当前分区状态:
[root@linux1 ~]# fdisk -l
Disk /dev/hda: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 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 652 5132767 8e Linux LVM
Disk /dev/hdb: 2147 MB, 2147483648 bytes
16 heads, 63 sectors/track, 4161 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 1 4161 2097112 83 Linux
可以看出,已经出来了一个/dev/hdb1的新分区。下一步将其格式化,再使用
4.用mkfs.ext3格式化新分区
[root@linux1 ~]# mkfs.ext3 /dev/hdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
262144 inodes, 524278 blocks
26213 blocks (5.00%) reserved for the super user
- ››CentOS系统只需6步添加新硬盘并分区格式化的方法
- ››Centos6.0 64位下 MySQL 5.6.11 CMake 安装部署
- ››CentOS下配置超级终端minicom
- ››Centos6.2_x86_64环境下puppet-dashboard安装配置...
- ››CentOS下建立本地YUM源并自动更新
- ››添加休眠命令在Win8关机电源按钮选项
- ››CentOS 安装 PostgreSQL 9.2
- ››CentOS 6.3 安装 Oracle 11gR2 依赖库检查失败处理...
- ››CentOS 6.X 系统初始化生产脚本
- ››CentOS 6下安装nodejs 0.9.0教程
- ››CentOS使用Screen管理会话选项
- ››CentOS+JDK+Tomcat+MySql&JDBCDriver 开发环境搭建...
赞助商链接