Load the ext4 module so that CentOS5.x supports the ext4 file system

Source: Internet
Author: User
Recently, we have to perform a test to restore a file by mistake using the rm command in the ext4 file system. we need to format a hard disk into the ext4 file system. The result is: [root @ server ~] # Mkfs. ext4/dev/sdb1-bash: mkfs. ext4: commandnotfound I didn't load the ext4 module on the system before.

Recently, we have to perform a test to restore a file by mistake using the rm command in the ext4 file system. we need to format a hard disk into the ext4 file system, and the result returns an error:

[Root @ server ~] # Mkfs. ext4/dev/sdb1
-Bash: mkfs. ext4: command not found
I didn't load the ext4 module on the system before, and I was prompted that I didn't have this command, so I would like to configure it first (kernel version: 2.6.18-194. el5 ).


PS: CentOS 5.x contains the ext4 module, but it is not loaded. you need to manually add the module to the system.

[Root @ server ~] # Cd/lib/modules/2.6.18-194. el5/kernel/fs/ext4/
[Root @ server ext4] # ll
Total 288
-Rwxr -- r -- 1 root 285684 2010-04-03 ext4.ko
After finding the module, run the modprobe command to add it:
[Root @ server ext4] # modprobe ext4
// Note: Only the module name can be written, but not ext4.ko.
After the ext4 module is added, use lsmod to view it:
[Root @ server ext4] # lsmod | grep ext4
Ext4 243693 0
Jbd2 58329 1 ext4
Crc16 6209 1 ext4
Install the e4fsprogs software (otherwise, the error-bash: mkfs. ext4: command not found will still occur)
[Root @ server ext4] # yum-y install e4fsprogs
Format the hard disk again:
[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,983 04, 163840,229 376, 294912,819 200, 884736,160 5632

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 24 mounts or
180 days, whichever comes first. Use tune4fs-c or-I to override.

The system prompts that the formatting is successful. Attach a new disk and view the file system format:
[Root @ server ~] # Mkdir/mnt/test
[Root @ server ~] # Mount/dev/sdb1/mnt/test/
[Root @ server ~] # Df-Th
File system type capacity available in use % mount point
/Dev/sda2 ext3 20G 2.9G 16G 17%/
/Dev/sda1 ext3 122 M 12 M 104 M 10%/boot
Tmpfs 95 M 0 95 M 0%/dev/shm
/Dev/sdb1 ext4 9.9G 151 M 9.2G 2%/mnt/test
Finally, configure to automatically mount the new disk (sdb1) at startup ):
[Root @ server ~] # Vi/etc/fstab

LABEL = // ext3 defaults 1 1
LABEL =/boot ext3 defaults 1 2
Tmpfs/dev/shm tmpfs defaults 0 0
Devpts/dev/pts devpts gid = 5, mode = 620 0 0
Sysfs/sys sysfs defaults 0 0
Proc/proc defaults 0 0
LABEL = SWAP-sda3 swap defaults 0 0
/Dev/sdb1/mnt/test ext4 defaults 0 0


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.