近日,要做一下ext4文件系统中使用rm命令误删除文件恢复的测试,需要将一块硬盘格式化成ext4文件系统,结果报错了:
[root@server ~]# mkfs.ext4 /dev/sdb1 -bash: mkfs.ext4: command not found |
PS:CentOS 5.x里面是有ext4模块的,只是没加载,需要手动把模块加入系统。
[root@server ~]# cd /lib/modules/2.6.18-194.el5/kernel/fs/ext4/ [root@server ext4]# ll 总计 288 -rwxr–r– 1 root root 285684 2010-04-03 ext4.ko |
[root@server ext4]# modprobe ext4 //注意:这里只能写模块名,不能写成 ext4.ko |
[root@server ext4]# lsmod | grep ext4 ext4 243693 0 jbd2 58329 1 ext4 crc16 6209 1 ext4 |
[root@server ext4]# yum -y install e4fsprogs |
[root@server ext4]# cd ~ [root@server ~]# mkfs.ext4 /dev/sdb1 mke4fs 1.41.12 (17-May-2010) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 655360 inodes, 2620595 blocks 131029 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=2684354560 80 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632 Writing inode tables: done |
[root@server ~]# mkdir /mnt/test [root@server ~]# mount /dev/sdb1 /mnt/test/ [root@server ~]# df -Th 文件系统 类型 容量 已用 可用 已用% 挂载点 /dev/sda2 ext3 20G 2.9G 16G 17% / /dev/sda1 ext3 122M 12M 104M 10% /boot tmpfs tmpfs 95M 0 95M 0% /dev/shm /dev/sdb1 ext4 9.9G 151M 9.2G 2% /mnt/test |
[root@server ~]# vi /etc/fstab LABEL=/ / ext3 defaults 1 1 |