Convert file system format on AWS EC2 ephemeral storage disk from ext3 to ext4

I have an instance-store EC2 instance with Ubuntu 11.04 i386. At present my disk partition looks like this:

Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda1            9.9G  529M  8.9G   6% /
none                  828M  116K  828M   1% /dev
none                  833M     0  833M   0% /dev/shm
none                  833M   40K  833M   1% /var/run
none                  833M     0  833M   0% /var/lock
/dev/xvda2            147G  188M  140G   1% /mnt

Can I convert /mnt (/dev/xvda2) to ext4? If yes, can you please guide me or point me to the right resource.

Thanks


You can convert /mnt from ext3 to ext4 in place (after backing up data for safety):

dev=/dev/xvda2
sudo umount $dev
sudo tune2fs -O extents,uninit_bg,dir_index $dev
sudo fsck -fv $dev
sudo mount $dev

You don't have to edit /etc/fstab on Ubuntu 11.04 for EC2 since the AMI lists that file system as auto.

Reference: https://help.ubuntu.com/community/ConvertFilesystemToExt4


  1. Backup /mnt/
  2. umount /mnt/
  3. mkfs.ext4 /dev/xvda2
  4. mount /mnt/
  5. Restore your files