LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 835|回复: 2

Convert File System from ext3 to ext4(ZZ)

[复制链接]
发表于 2009-3-1 14:08:46 | 显示全部楼层 |阅读模式
Convert File System from ext3 to ext4
ext3 ext4 fs Howto

http://admon.org/node/125

Some time ago ext4 was released and served as a built-in feature in linux kernel mainline. Ext4 provides additional benefits compared to ext3. The next release of Fedora, version 11, will by default use ext4 unless serious regressions occured. In this article I'd give you a general way on converting filesystems from ext3 to ext4.

EXT4 Filesystem Features

Ext4 filesystem has more features and generally gain better performance than ext3, it's main features include:

* Delayed allocation & mballoc allocator for better on-disk allocation
* Sub-second timestamps
* Space preallocation
* Journal checksumming
* Large (>2T) file support
* Large (>16T) filesystem support
* Defragmentation support

Once you converted your file system to ext4, the fs cannot be mounted as ext3. Note that ext4 may have some bugs so do not use it on productive servers. It's also recommended that keep your /boot in ext3.

You need to check ext4 is supported and compiled in you current kernel. Otherwise, you need to apply the patch, and re-compile your kernel. I assume that your kernel supports ext4.
Simply follow these steps to convert an existing ext3 file-system to ext4. For example, in order to converting /dev/sdb1 to ext4, you need to type:
# cd /; umount /dev/sdb1
# tune2fs -O extents,uninit_bg,dir_index /dev/sdb1
# fsck -pf /dev/sdb1

Now, all's OK, just mount it as ext4:

mount -t ext4 /dev/sdb1 /ext4

If you have converted /boot file system , you need to update /boot/grub.conf. Use your favourite editor to open this file, find out current kernel config section and append the following parameter:
rootfstype=ext4

Here is sample config:

title        Ubuntu 8.10, kernel 2.6.28.1
root        (hd0,1)
kernel    /boot/vmlinuz-2.6.28.1 ro quiet splash rootfstype=ext4
initrd        /boot/initrd.img-2.6.28.1
quiet

Save and close the file. And run update-grub:
$ update-grub
Next, update your /etc/fstab file so that it can be mounted as ext4 file system by default. And finally, reboot your system:
$ reboot
All's done, have a nice tour! [over]
发表于 2009-3-1 19:05:07 | 显示全部楼层
如果/boot所在分区是ext4格式,你试过吗?grub不需要打补丁吗?
回复 支持 反对

使用道具 举报

发表于 2009-3-1 22:26:42 | 显示全部楼层
Post by waynef;1954655
如果/boot所在分区是ext4格式,你试过吗?grub不需要打补丁吗?

我就是这样的,grub应该不行,我用的是linux下的grub2或dos下的grub2,均可以引导。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表