📜 ⬆️ ⬇️

How to convert ext3 to ext4 file system

Now everyone has a new Ubuntu with ext4 support, and in my last post about its release there were a few comments with questions about how to remake the file system into this very ext4. On this great occasion, I decided to translate the topic from wiki.kernel.org, where it is written about it. The translation is completely free, diluted with my own thoughts. By the way, you can read about all the new ext4 buns in English now in Russian here , and also in the new article yktoo here !

Mount ext3 as ext4 without conversion


First, starting from the 2.6.28 kernel, you can mount ext2, ext3 and ext4 file systems as ext4. This will make it possible to use the new optimized gizmos of the new driver (for example, delayed allocation, multi-block allocation and large inodes if you formatted your ext3 with this option), while physically changing nothing on the disk, allowing you to go back to the ext3 driver , eg. This is done very simply - in your / etc / fstab change ext3 to ext4 and that's it. True.

Convert to ext4


It’s quite another thing if you want to use the new ext4 features, such as extents, which change the physical format of the data storage, but also give a big performance gain. If you convert from ext2, you first need to turn on journaling (in other words, convert to ext3):

sudo tune2fs -j /dev/{ }

Then, to enable new features on your ext3 file system, you need to do this:
')
sudo tune2fs -O extents,uninit_bg,dir_index /dev/{ }

Attention! After this command, you will never be able to mount the file system as ext3.
After that, it is necessary ( Mastyf says that it is not necessary, because when you first reboot, everything will be checked by itself, but I would still be reinsured) to check the file system using fsck to tidy up what tune2fs did not finish. We do it like this:

sudo e2fsck -pDf /dev/{ }

After that, edit / etc / fstab and reboot.

Note : There are some new features that can be obtained only by reformatting the partition, for example, flex_bg and support for partitions larger than 16 terabytes.

Another note : it is not recommended to change the size of the inode using e2fsprogs version 1.41.0 or later, because this leads to corrupted data and sad people.

Last note : after extents are included, new files will be created using them, but nothing will happen to the old ones and they will continue to lie on the disk in the old format. I read somewhere about the magic utility defrag2fs , which also translates all old files into a new format, but, as I understand it, it is still very raw, it does not work well, it is life threatening and it is better to wait.

How to boot if / boot is ext4 too


In general, converting / boot to ext4 is pointless. But if you really want, then you must first do everything as written above. Then, you need to tweak a little / boot / grub/menu.lst . We find this line:

title Ubuntu 9.04 <...>
root (hdX,Y)
kernel /boot/vmlinuz-2.6.28-... root=... ro quiet splash

And add to the last at the end rootfstype=ext4

Source: https://habr.com/ru/post/58121/


All Articles