Restoring rootFS

First step is to create file system.

/sbin/newfs_hfs -s -v System -J -b 4096 -n a=4096,c=4096,e=4096 /dev/disk0s1s3



Now it's time to send our rootFS to /private/var and here problems began for those who resized /private/var to too low size (like me :P)
For those who resized /private/var to size like 5GB they are good to go they and can now skip these steps
And those who resized /private/var to too smal size type:

gptfdisk /dev/rdisk0s1

Then type:

x Enter s Enter 4 Enter


Now go back to basic mode.

m Enter



Now we need to create 4th partition from free space. We should have lot of free space if we resized /private/var to like 2-3 GB.
Type:

n Enter 4 Enter Enter


In Last Sector we need to substract about 20 from last default sector (3870728). It's 3870728-25=3870703

Now you need to set some nice looking name :P
In order to do this type:

c 4 Enter (name you want) Enter



After setting nice looking shitty name let us check if all is ok and if we created 4th partition with size 4-5 GB not 2-3 GB :P
Type:

p Enter



We can now save changes by typing:

w Enter Y Enter



Now we need to mount our new partition to send file system into it but first we need to create file system

mkdir /mnt2


Then

/sbin/newfs_hfs -s -v Data -J -b 4096 -n a=4096,c=4096,e=4096 /dev/disk0s1s4



After this we are fully able to mount /dev/disk0s1s4

mount_hfs /dev/disk0s1s4 /mnt2



Now you need open iproxy connection connection. In order to do this open new terminal window and type:

iproxy 2222 22


Now open another new window and now we will be about to send file system
If you didnt need to create 4th partition and in your case /private/var have much space then you type this:

scp -P 2222 path/to/rootfs.dmg root@localhost:/private/var


If you needed to create 4th Restore Partition you type this:

scp -P 2222 path/to/rootfs.dmg root@localhost:/mnt2


Now it's time to fianlly restore our copied rootFS to /dev/disk0s1s3
If you didn't need create 4th partition you type:

asr restore --source /private/var/rootfs.dmg --target /dev/disk0s1s3 --erase


If you needed to create 4th partition you type:

asr restore --source /mnt2/rootfs.dmg --target /dev/disk0s1s3 --erase


Now wait until restored finishes ;)

After restore finishes you may want to run fsck to check if our restored file system isn't corrupted just in case.

fsck_hfs -f /dev/disk0s1s3



If you see "The Volume 'volume name' appears to be OK" it means we sucesfully flashed second OS to /dev/disk0s1s3
Users who needed to create 4th partition need to do one easy step.
If you didn't need to create 4th partition you may just want to remove rootfs.dmg from /private/var and you can proceed to next step ;).

rm -rf /private/var/rootfs.dmg


For those who needed to create 4th partition you wanna remove /dev/disk0s1s4 as it's just takes 5 GB of storage that's useless.
In order to remove it you wanna start gptfdisk again.

gptfdisk /dev/rdisk0s1


Then type:

d Enter 4 Enter


And to check type:

p Enter



Now Restore_Partition should be gone. To save changes type:

w Enter Y Enter



Now you are able to proceed next step ;).
Also this 5GB storage isn't now just useless. After sucesfull dual-boot this storage will be added to /private/var.
Modifying Filesystem