How to use Ext4 如何使用EXT4

How to use Ext4 如何使用EXT4

https://kernelnewbies.org/Ext4

 

有以下三种方式使用EXT4文件系统:

一.创建新的EXT4文件系统

对于新文件系统的安装,最简单也是推荐的方法,使用工具mkfs.ext4

.将现有的EXT3文件系统迁移到EXT4

使用tune2fs和fsck文件系统工具,先卸载原有的分区,执行

Tune2fs –O extents,uninit_bg,dir_index  /dev/yourfilesystem

使用完这个命令后,执行fsck。如果不执行,EXT4将不能挂载到你的文件系统上。使用fsck,如果文件系统有错误,将使你的文件系统达到一致的状态,会告诉你组描述符中的校验和错误,能明确告知你重新以EXT4挂载到文件系统上需要做什么。如果发现错误,你要做的只是按照默认值回答YES就可以了;如果你觉得回答YES麻烦,只需执行fsck时加上-p参数:

fsck -pDf  /dev/yourfilesystem

必须注意到,现存的EXT3文件系统将继续使用旧的间接寻址块来找到数据块;使用碎片管理工具可以将旧的EXT3寻址模式变成使用EXTE4的extent的模式(使用ioctl告诉文件系统用content格式重写文件)。

三.将ext3文件系统以EXT4模式挂载,不改变格式

在不改变EXT3文件系统格式的情况下,以EXT4方式挂载系统,接下来卸载

后,你可以重新以EXT3的方式重新挂载。你可以将EXT3文件系统这样挂载:

mount -text4 /dev/yourpartition /mnt

这样挂载就不会使用到EXT4文件系统的新特性,使用时所用到的特性只限制在EXT3文件系统的范围内了。

四.以下为原文:

 

At this time, all relevant distrossupport it. GRUB also supports Ext4. Just use it.

Switching to Ext4 is very easy.There are three different ways to switch:

1. Creating a new Ext4filesystem from the scratch

  • The easiest one, recommended for new     installations. Just update your e2fsprogs package to Ext4, and create the     filesystem with mkfs.ext4.

2. Migrate existing Ext3filesystems to Ext4

You need to use the tune2fs and fscktools in the filesystem, and that filesystem needs to be unmounted. Run:

  • tune2fs -O extents,uninit_bg,dir_index     /dev/yourfilesystem

After running this command you MUSTrun fsck. If you don't do it, Ext4 WILL NOT MOUNT your filesystem. This fsckrun is needed to return the filesystem to a consistent state. It WILL tell youthat it finds checksum errors in the group descriptors - it's expected, andit's exactly what it needs to be rebuilt to be able to mount it as Ext4, sodon't get surprised by them. Since each time it finds one of those errors itasks you what to do, always say YES. If you don't want to be asked, add the"-p" parameter to the fsck command, it means "automaticrepair":

  • fsck -pDf /dev/yourfilesystem

There's another thing that must bementioned. All your existing files will continue using the old indirect mappingto map all the blocks of data. The online defrag tool will be able to migrateeach one of those files to an extent format (using an ioctl that tells thefilesystem to rewrite the file with the extent format; you can use it safelywhile you're using the filesystem normally)

3. Mount an existingExt3 filesystem with Ext4 without changing the format

You canmount an existing Ext3 filesystem with Ext4 but without using features thatchange the disk format. This means you will be able to mount your filesystemwith Ext3 again. You can mount an existing Ext3 filesystem with "mount -text4 /dev/yourpartition /mnt". Doing this without having done theconversion process described in the previous point will force Ext4 to not usethe features that change the disk format, such as extents, it will use only thefeatures that don't change the file format, such as mballoc or delayedallocation. You'll be able to mount your filesystem as Ext3 again. Butobviously you'll be losing the advantages of the Ext4 features that don't getused...

猜你喜欢

转载自blog.csdn.net/lieye_leaves/article/details/78265184