linux+系统的硬盘分区格式化,linux系统将硬盘分区格式化成ext4分区挂载
1.将硬盘分区(这里就分一个区)fdisk /dev/cciss/c0d1交互信息:Command (m for help): nCommand actione extendedp primary partition (1-4)pPartition number (1-4): 1First cylinder (1-71798, default 1):Using default value 1Las
1.将硬盘分区(这里就分一个区)
fdisk /dev/cciss/c0d1
交互信息:
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-71798, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-71798, default 71798):
Using default value 71798
Command (m for help): v
315 unallocated sectors
Command (m for help): p
Disk /dev/cciss/c0d2: 299.9 GB, 299966445568 bytes
255 heads, 32 sectors/track, 71798 cylinders
Units = cylinders of 8160 * 512 = 4177920 bytes
Device Boot Start End Blocks Id System
/dev/cciss/c0d2p1 1 71798 292935824 83 Linux
Command (m for help): w
The partition table has been
2. 格式化分区(mke4fs命令所在rpm包是e4fsprogs,yum install e4fsprogs* 就能找到了)。
mke4fs -L /opt1 /dev/cciss/c0d1p1
如果忘记加卷标,格式化完成后使用如下命令加上卷标。
e4label /dev/cciss/c0d1p1 /opt1
查看分区信息
tune4fs -l /dev/cciss/c0d0p1
3. 修改/etc/fstab 结果如下
head -3 /etc/fstab
LABEL=/ / ext3 defaults 1 1
LABEL=/opt /opt ext4 defaults 0 0
LABEL=/opt1 /opt1 ext4 defaults 0 0
www.it165.net
4. 创建挂载文件夹
mkdir /opt1
5.挂载
mount -a
6.查看挂载情况
mount
结果如下:
/dev/cciss/c0d1p1 on /opt1 type ext4 (rw)
题外话:如果要将ext3转成ext4的话先将目标ext3分区卸载。
更多推荐
所有评论(0)