Partitioning

In this step we will partition our disk to create addiotional partition for our sedond OS.
First step is to resize our Data partition (as it has biggest size) and gain free space.
Command will look like this:

hfs_resize /private/var size


You should resize to about 5GB otherwise later you will have problem with copying rootFS as there won't be space on device . It's fixable but you will need to do more. For example I resized /private/var just to 2GB and had this issue so make sure you resize to bigger size.
Command should like this:

hfs_resize /private/var 5001000000

and I did:

hfs_resize /private/var 2001000000



Now make sure you write down size you resized to.
Now type:

gptfdisk /dev/rdisk0s1


And now:

p Enter



You should see Logical sector size also known as block size. On 64-bit devices it should be 4096. Keep this value in mind.
Now type:

i Enter 2 Enter



Write down somewhere Partition unique GUID.
Attribute flags should be 0003000000000000
After this type:

d Enter 2 Enter


If you did it type:

n Enter Enter


You should see now Last Sector . Don't click Enter !! Now you need divide size you used to resize /private/var by block size (which should be 4096). In my case it's 2001000000/4096=488525,390625. In most cases you will get sum with a comma. In this you need to just ignore so it will be just 488525. Now you need to add it to first default sector which is 880018 so it's 488525+880018=1368543. Pass this value to Last Sector.

If you managed to do this you will need to change name back to Data too

c Enter 2 Enter Data Enter


Now make sure we did it correctly

p Enter



Now we need to set attribute flags which were 0003000000000000 for Data

x Enter a Enter 2 Enter 48 Enter 49 Enter Enter



Now you need to recover unique GUID which was 5382B18A-FE58-4097-BCEE-2BE45806886E in my case.

c Enter 2 Enter (your GUID) Enter



After you do it type:

s Enter 3 Enter


Now you need to go back to basic mode

m Enter


Now you need to create 3rd partition for our second OS

n Enter 3 Enter Enter


This time in Last Sector we wanna specify size that our 3rd partition will have. I recommend something like 4-5 GB. Let it be 4.9 GB so it will be something like 5000000000 bytes and divide this value by block size (4096) so it's 5000000000/4096=1220703,125. Again we ignore commas so it's 11220703. Now add this value to first default sector which is 1368543 in my case. 1220703+1368543=2589247

We are almost done. We need to just change partition our 3rd partition name and save changes.

c Enter 3 Enter (our name) Enter



Just to make sure we did did all correctly type:

p Enter



Partitioning is done . We just need to save changes by typing:

w Enter Y Enter



To check you did correctly you can now type:

ls /dev/disk*



If you see this it means you partitioned correctly :)
If you resized /private/var to too small size I'm gonna show fix in next which is Restoring rootFS as I did same mistake.
Restoring rootFS