How to clone your ubuntu OS using rsync.


2nd pc – install ssh-server
make a partition with ext4

$sudo su
#apt-get install openssh-server
#mount /dev/sda<num> /<mount_point> eg. #mount /dev/sda4 /mnt

1st pc – run rsync
(PC1)$sudo rsync -av –one-file-system –exclude=/proc/* –exclude=/dev/* \
–exclude=/sys/* –exclude=/tmp/* –exclude=/home/* –exclude=/lost+found \
–exclude=/var/tmp/* –exclude=/boot/grub/* –exclude=/root/* \
–exclude=/var/mail/* –exclude=/var/spool/* –exclude=/media/* \
–exclude=/etc/fstab –exclude=/etc/mtab –exclude=/etc/hosts \
–exclude=/etc/timezone \
–exclude=/etc/X11/xorg.conf* –exclude=/etc/gdm/custom.conf \
–exclude=/etc/lightdm/lightdm.conf /root@<ipaddress_of_second_pc>:/<mount_point_to_ext4>

after rsync complete

ssh from 1st pc to 2nd pc

(PC1)$ssh root@<ipaddress_of_second_pc>

#cd /<mount_point_to_ext4>
#mount -t proc /proc proc/
#mount -t sysfs /sys sys/
#mount -o bind /dev dev/
#mount -t devpts /dev/pts dev/pts/
#chroot . /bin/bash

#grub-install /dev/sda –force
#update-grub

#mkdir home/<standard_username_from_pc1>

#chown -Rf <standard_username_from_pc1>:<standard_username_from_pc1> home/<standard_username_from_pc1>/

#chmod 755 home/<standard_username_from_pc1> -Rf

if you want to change username and home dir.

#usermod -l <newname> -d /home/<newdir> -m <current_username>

#groupmod -n <newgroup> <current_group>

if you want to enable swapfile

#dd if=/dev/zero of=/swapfile bs=1G count=4 (This will create 4GB swapfile)
#mkswap /swapfile

#nano /etc/fstab
and add the following line

/swapfile   none    swap    sw    0   0
 

#reboot

Advertisements

About herzcthu

I'm a translator of many cms and blogging software such as WordPress, Joomla. I'm administrator of WordPress Burmese official site. Founder of myanmapress.com

Posted on December 8, 2016, in Uncategorized. Bookmark the permalink. Leave a comment.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: