User Tools

Site Tools


linux:clone-linux-drive

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
linux:clone-linux-drive [2025/08/10 21:47] – created Wulf Rajeklinux:clone-linux-drive [2025/09/03 01:50] (current) Wulf Rajek
Line 1: Line 1:
-====== Clone Linux Drive ======+====== Clone Linux Drive/System ======
  
  
Line 6: Line 6:
 Firstly you will need a live USB stick, build this or use an existing stick - this will be used throughout. Firstly you will need a live USB stick, build this or use an existing stick - this will be used throughout.
  
-Install the new hard drive and build it as a new machine as normal as per [[process_scripts:amati-usb-install|Amati USB Install]].+Install the new hard drive and build it as a new machine as normal.
  
 Once complete, boot the PC to the live environment with only the old hard drive installed. Once complete, boot the PC to the live environment with only the old hard drive installed.
Line 121: Line 121:
   - Confirm that the mount points have applied, this may require a restart.   - Confirm that the mount points have applied, this may require a restart.
  
 +
 +
 +====== Live remote cloning ======
 +
 +Target system:
 +<code>
 +sudo apt-get install openssh-server
 +sudo sed -i 's/#PermitRootLogin/PermitRootLogin/' /etc/ssh/sshd_config
 +sudo service ssh restart
 +</code>
 +
 +On source system:
 +<code>
 +sudo su -
 +apt-get install sshfs rsync
 +mkdir /mnt/newsystem
 +mount -t fuse.sshfs root@IP:/ /mnt/newsystem
 +cp /mnt/newsystem/etc/fstab /root/newfstab
 +rsync -ahPHAXx --delete --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found} / /mnt/newsystem
 +
 +#or for overall bandwidth stats and brief output:
 +rsync -ahPHAXx --info=progress2 --info=name0 --delete --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found} / /mnt/newsystem
 +
 +</code>
 +
 +Adjust /mnt/newsystem/etc/fstab file accordingly
 +
 +reset GRUB:
 +<code>
 +for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt/newsystem$i; done
 +sudo chroot /mnt/newsystem
 +sudo grub-install --recheck /dev/sdX
 +sudo update-grub
 +</code>
  
linux/clone-linux-drive.1754858871.txt.gz · Last modified: by Wulf Rajek