Rearrange Disk Partitions
Start computer with gparted LiveCD and start GParted. The data partition is "/dev/sda1".
-
Use "Resize/Move" to move /dev/sda1 partition to the end of the disk, before the swap partition. Shrink 928GB to 295GB, where 87GB are used. It took about 5 hours. You can only shrink the partition without moving them to the end, which will be faster than the previous "shrink + move" method.
-
Right click /dev/sda1 -> Manage Flags, uncheck the "boot" flag.
-
Create a new 50GB partition /dev/sda3 with EXT4 format, label it as "system1" and quit GParted;
-
Start computer with new system (Mint 17 64bit here) LiveCD;
-
Install Mint, select "Something else" when asked for "Installation type";
-
Select /dev/sda3, click "change", then choose "Ext4 journaling file system" in "Use as", then choose "/" as the "Mount point", set /dev/sda1 mounted at /home and the old swap partition as swap;
-
Install the system, then reboot;
Transfer old data
The old partition is mounted on /home, so the old home folder is now /home/home/chad. So we need:
-
Move sub-folders of /home/home/chad to /home/chad;
-
After some days when it's sure all data have been transfered, delete all folders and files under /home except "chad" (new $HOME folder);
Now on /dev/sda3, there is only one folder "chad". When install the second system, just mount /dev/sda3 to /home, everything will be ok.
Supported methods for disk partition management
Start "Terminal" on LiveCD.
-
Detect disk:
gdisk /dev/sda
, notice your detection target is the whole disk instead of a partition, so "sda" can't be written as "sda1", or there will no MBR be found. -
Backup MBR:
sfdisk -d /dev/sda > parts.txt
, you can recover MBR withsfdisk /dev/sda < backup-sda.sfdisk
, or with "dd" command:Backup: # dd if=/dev/sda of=/backup/mbr_sda.bak bs=512 count=1 Restore: # dd if=/backup/mbr_sda.bak of=/dev/hda bs=512 count=1
Install the Second OS
-
Backup MBR and grub.cfg:
-
Install centOS 6.5 Minimal with USB stick;
-
Choose "Create Custom Layout", create a new partititon, mounted at /, and mount sdb1 as /home;
-
Uncheck "Install boot loader on /dev/sdb";
-
Reboot system. There is no change in boot menu, startup origin system (Mint 17), run
update-grub
with root. -
Reboot, you can see the CentOS is in boot menu.
Note: If you don't want an OS in your boot menu, rename its "boot" folder as "boot.old" (or anything else).
Ref:
How to Move Your Home Folder to Another Partition
Google: Linux系统启动过程
6 Stages of Linux Boot Process (Startup Sequence)
How To Backup & Restore Master Boot Record (MBR) In Linux
Linux: Copy Master Boot Record (MBR)
Manpage of sfdisk.
Boot loader Grub: how to repair, adapt or remove it