
In the announcement of
Fedora 9 , one of the first lines mentioned is experimental support for the
ext4 file system.
In this article, I will talk about how much benefit can be from replacing
ext3 with
ext4 file and what additional risks you will have if you decide to take this step.
Better ext4
- ext4 is faster, especially when working with large files (very noticeable when deleting).
- file size - up to 16T , file system - up to 1024
- “extended attributes in inodes” for SElinux, beagle, samba appeared. In certain situations, mkfs and fsck can speed up.
- You can simply mount existing ext3 partitions as ext4
- A defragmenter similar to that in XFS is being developed. He will be able to: collect the file in a continuous area, collect files from one directory together, collect empty space in a continuous area. Productivity at the same time should increase
Technical details read here:
ext4 in Russian ,
New ext4 features .
')
How to switch from ext3 to ext4
In a production version,
ext3 can be mounted as
ext4 . Now the procedure is a bit more complicated.
Let the disk
/ dev / sdc1 have
ext3 installed. Using
blkid we see how the kernel identifies the file system.
[root @ ad mnt] # blkid / dev / sdc1
/ dev / sdc1: LABEL = "/ var / www / img" UUID = "77d69541-cd2e-47d5-91fc-bdb5606aa8fb" SEC_TYPE = "ext2" TYPE = "ext3"
As long as we have TYPE = "ext3", we will not be able to mount the disk under ext4. Fix this problem
[root @ ad mnt] # debugfs -w / dev / sdc1
debugfs 1.40.8 (13-Mar-2008)
debugfs: set_super_value s_flags 4
debugfs: quit
check:
[root @ ad mnt] # blkid / dev / sdc1
/ dev / sdc1: LABEL = "/ var / www / img" UUID = "77d69541-cd2e-47d5-91fc-bdb5606aa8fb" SEC_TYPE = "ext2" TYPE = "ext4dev"
There is no error, now the file system is called
ext4dev .
You can mount:
[root @ ad mnt] # mount -t ext4dev -o extents / dev / sdc1 ./test
How to format a partition under ext4
# mke2fs -E test_fs / dev / sdc1
# tune2fs -j / dev / sdc1
Where it is already reasonable to use ext4
I can say for sure that it is not in the
/ var / lib / mysql directory.
I am already using
ext4dev , in the section where the
nginx cache is added, as well as all the photo content
(when uploading statics, the speed with the file system is important for nginx ) .
Not to risk it, I changed the file system by formatting and uploading content to a blank disc. During this procedure there was a slight curiosity. In ext3, all files occupied
97G , after being reloaded onto a new formatted
ext4dev partition,
it turned out
90G . I cut the comparison of folders in mc, compared half a day - everything is Ok :). I can’t say now why there was a saving, perhaps the data on ext3 was very fragmented (there were a lot of directories with small files).
What are the risks?
The risks are obvious, this is experimental support - anything is possible!
When switching from
ext2 to
ext3 , you could at any time abandon
ext3 and mount
ext3 as
ext2 , if you already switched to
ext4 - there is no way back!
You can be mounted with the option
-o noextents and then it will be possible to roll back everything in
ext3 , but this option cuts off almost all the virtues of
ext4 .
In the case of a “flush” file system, you need to be ready for
tune2fs .
Maybe you have already decided to transfer the / tmp directory to ext4 :)?
UPD1: To work
fsck you need to copy
fsck.ext3 to
fsck.ext4 . Now we can run
# fsck.ext4 / dev / sdc1