Converting a Root Ext File System to a Later Version
Caution:
Before performing a root file system conversion, make a full system backup from which you can restore its state.
-
Use the following command with the block device that corresponds to the root file system:
sudo tune2fs -j device
-
Identify which device is mounted as the root file system by running the mount command.
For example, the output of the following command shows that the root file system corresponds to the disk partition
/dev/sda2
:sudo mount
/dev/sda2 on / type ext2 (rw)
-
Shut down the system.
-
Boot the system from an Oracle Linux boot CD, DVD, or ISO.
You can download the ISO from the Oracle Software Delivery Cloud at https://edelivery.oracle.com/linux. For convenience, these images are also available from the Oracle Linux yum server at https://yum.oracle.com/oracle-linux-isos.html.
-
From the installation menu, select Rescue Installed System.
-
Select a language and keyboard, when prompted.
-
Select Local CD/DVD as the installation media.
-
Select No to bypass starting the network interface.
-
Select Skip to bypass selecting a rescue environment.
-
-
Select Start shell to obtain a
bash
shell promptat the bottom of the screen. -
If the existing root file system is configured as an LVM volume, use the following command to start the volume group, for example. If the volume group is
vg_host01
, type:sudo lvchange -ay vg_host01
-
Check the file system by using the fsck command appropriate to the new file system. If the later version is
ext3
, you would type the command as follows:sudo fsck.ext3 -f device
In the previous command, device is the root file system device,
/dev/sda2
.The command moves the
.journal
file to the journal inode. -
Create a mount point,
/mnt1
, and mount the converted root file system on it.sudo mkdir /mnt1 sudo mount -t ext3 device /mnt1
-
Edit the
/mnt1/etc/fstab
file to change the root file system type toext3
./dev/sda2 / ext3 defaults 1 1
-
Create the
.autorelabel
file in the root of the mounted file system.sudo touch /mnt1/.autorelabel
The presence of the
.autorelabel
file in/
instructs SELinux to re-create the security attributes of all the files on the file system.Caution:
If you don't create the
.autorelabel
file, booting the system might not succeed. In the file isn't created and the reboot fails, you can either disable SELinux temporarily by specifying theselinux=0
value in the kernel boot parameters; or, you can run SELinux in permissive mode by specifyingenforcing=0
. -
Unmount the converted root file system.
sudo umount /mnt1
-
Remove the installation media, then reboot the system.