Linux – remount / move root folder to another partition on centos

centosext4linuxxfs

We have an EC2/CentOS6 instance with "/" mounted to an EXT4 partition, and now another bigger sized hard disk formatted in XFS attached to the system. Since the former partition for "/" is insufficient in space and no LVM setup,

what's the steps if we want to move the "/" and all its contents to the
new XFS?

Note that it's an staging server so downtime is just fine.

Best Answer

Try the following:

make sure you have a backup, it's a risky mission.

  1. Copy you system dd if=/dev/<device_name_fs_is_on> of=/path/to/other/location/filesystem.img bs=1048576 count=20480
  2. Format the new hard drive and create the needed filesystem
  3. Copy the file system dd if=/path/to/other/location/filesystem.img of=/dev/<new_device_name>
  4. Mount the new filesystem
  5. Edit fstab.
  6. Ask your Data-Center for an ipkvm in case something went wrong.
  7. reboot