linux+系统的硬盘分区格式化,linux系统将硬盘分区格式化成ext4分区挂载

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
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值