Chinaunix首页 | 论坛 | 博客
  • 博客访问: 72027
  • 博文数量: 21
  • 博客积分: 1478
  • 博客等级: 上尉
  • 技术积分: 220
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-22 20:41
文章分类

全部博文(21)

文章存档

2011年(1)

2010年(2)

2009年(18)

我的朋友

分类:

2009-10-13 13:33:12

Step one:
Upgrade to Jaunty. You now have a working Jaunty install running the ext3 file system.
Make sure you are running kernel 2.6.28-11-generic or higher.
To check which kernel you are running:
Code:
uname -a
Step two:
Make a backup of all your (important) data.

Step three:
EDIT: Some extra info on how to convert from ext2 to ext4 (thanks, groggyboy)

Boot from a (Jaunty) live-cd and run the following code (in this example the partition to convert is on /dev/sda1) to convert the partition:
To convert from ext3 to ext4:
Code:
sudo bash
tune2fs -O extents,uninit_bg,dir_index /dev/sda1
e2fsck -pf /dev/sda1
To convert from ext2 to ext4:
Code:
sudo bash
tune2fs -O extents,uninit_bg,dir_index,has_journal /dev/sda1
e2fsck -pf /dev/sda1
Step four:
Mount the partition and change the type of the converted partition in fstab:
Code:
sudo bash
mount -t ext4 /dev/sda1 /mnt
nano /mnt/etc/fstab
change "ext3" to "ext4" like in the example below:
Code:
# /dev/sda1
UUID=XXXXXXXXXXXXXXXXXXXXXXXXXX / ext3 relatime,errors=remount-ro 0 1
change it to:
Code:
# /dev/sda1
UUID=XXXXXXXXXXXXXXXXXXXXXXXXXX / ext4 relatime,errors=remount-ro 0 1
and save the changes.

Step five:
EDIT: Some extra info on how to refresh grub when you have a separate /boot partition (thanks, utkjamie)

This step might be optional but when I upgraded from Intrepid to Jaunty the upgrade process did not install/update the new grub stage. So if you don't run either of the following code examples you might get an (fatal) error 13 when booting the machine.
Use this code to refresh grub when you do not have a separate /boot partition (in this example the root partition is sda1)
Code:
sudo bash
mount /dev/sda1 /mnt
grub-install /dev/sda --root-directory=/mnt --recheck
Use this code to refresh grub when you do have a separate /boot partition (in this example the /boot partition is sda1)
Code:
sudo bash
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot
grub-install /dev/sda --root-directory=/mnt --recheck
That's it, after you reboot you you will be running from an ext4 file system.
As a side note, all the files that where present before the conversion will not benefit from the conversion as they were written to disk using ext3 technology. Only newly created or overwritten files will be using the true ext4 technology (so now, using update-manager will be extra beneficial ). As ext3 and ext4 are compatible with each other having files written to disk in ext3 mode on your ext4 file system do not impose any risks (and most if not all ext3 sectors could eventually disappear even without defragging).

There is currently a online-defragging tool in development (e4defrag) which should be available with the next kernel release.

from:



注意:其实这种方法有些局限性,即仅对升级后新建的文件采用ext4格式存储,而对以前的文件,仍然会按照原来的格式进行存储。
阅读(1439) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~