peetaur

How to transfer a Linux install to another machine. - short

Mar 22nd, 2017
508
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ====================================================
  2. The short short version (see full here http://pastebin.com/4NLFkdzQ)
  3. ====================================================
  4.  
  5.     parted /dev/sda mktable gpt
  6.     parted /dev/sda mkpart root 1 -- -1
  7.    
  8.     mkfs.ext4 /dev/sda1
  9.  
  10.     mount /dev/sda1 /mnt/root
  11.    
  12.     # this only copies rootfs. If you have separate /home, /var, etc. then you need to run separate commands for those.
  13.     rsync -avHPAXx sourceMachine:/ /mnt/root/
  14.  
  15.     cd /mnt/root
  16.     mkdir dev proc sys media mnt
  17.    
  18.  
  19.     # next 4 lines: general, non-arch based (works for arch too, but pacman won't work within chroot)
  20.     mount -o rbind /dev dev
  21.     mount -o rbind /proc proc
  22.     mount -o rbind /sys sys
  23.     chroot /mnt/root
  24.  
  25.     # next 1 line: archlinux based (requires arch-install-scripts package)
  26.     arch-chroot /mnt/root
  27.         blkid
  28.         vim /etc/fstab
  29.             make sure UUIDs are right
  30.         vim /etc/udev/rules.d/70-persistent-net.rules
  31.             (Optional) remove all lines from this file
  32.            
  33.         grub-install /dev/$disk
  34.         grub-mkconfig -o /boot/grub/grub.cfg
  35.    
  36.         vim /boot/grub/grub.cfg
  37.             make sure UUIDs are right
  38.            
  39.         #debian based: (not sure if it's -c or -u)
  40.             update-initramfs -u
  41.         #openSUSE:
  42.             mkinitrd
  43.         #arch/manjaro; replace "linux" with your kernel name. List first with ls.
  44.             mkinitcpio -p /etc/mkinitcpio.d/linux.preset
  45.         #arch/manjaro alternative; (add kernel version in there, based on filenames in /lib/modules/)
  46.             mkinitramfs -g /boot/initramfs-...-x86_64.img -k ...
  47.        
  48.         #debian based:
  49.             vim /etc/network/interfaces
  50.         #openSUSE:
  51.             vim /etc/sysconfig/network/ifcfg-eth0
  52.  
  53.         exit
Add Comment
Please, Sign In to add comment