copy_linux_to_a_new_harddisk

Differences

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

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
copy_linux_to_a_new_harddisk [04.01.2011 23:55] – created Pascal Sutercopy_linux_to_a_new_harddisk [06.06.2014 10:19] Pascal Suter
Line 1: Line 1:
 ====== Copy Linux to a new Harddisk ====== ====== Copy Linux to a new Harddisk ======
 +In the following howto i assume that sda is your source drive and sdb is your target drive.. please make sure not to mix this up in your setup! also i assume that your operating system disk has three partitions, sda1 as /boot, sda2 as swap and sda3 as / 
  
-  * stop any running services like apache, mysql etc. on the source system. +  * stop any running services like apache, mysql etc. on the source system. or even better, boot from a live linux and work from there.
   * partition and format the new harddisk   * partition and format the new harddisk
-  rsync - for each partition +    parted /dev/sda --> print shows the current partitions of sda including their sizes.. that should help :)  
-  * edit fstab and /boot/grub/menu.lst and update UUID according to [[harddisks_by_uuid_in_debian_lenny]] +  * create mountpoints for source and target <code>mkdir /tmp/source 
-  * install grub +mkdir /tmp/target</code> 
-  sudo grub +  * mount source and targed partitions: <code> 
-  find /boot/grub/menulst +mount /dev/sda3 /tmp/source 
-(if you have an own partiton for boot, you can leave boot away in the above command)  +mount /dev/sda1 /tmp/source/boot 
-  root (hd0,0) +mount /dev/sdb3 /tmp/target 
-  setup (hd0)+mkdir /tmp/target/boot 
 +mount /dev/sdb1 /tmp/target/boot 
 +</code> 
 +  * now copy the os: <code>rsync -aHvx --numeric-ids /tmp/source /tmp/target</code> 
 +  * edit /tmp/target/etc/fstab and /tmp/target/boot/grub/menu.lst and update UUID according to [[harddisks_by_uuid_in_debian_lenny]] 
 +  * chroot to the target drive and install grub: <code> 
 +mount --bind /dev/ /tmp/target/dev 
 +mount --bind /sys/ /tmp/target/sys 
 +mount --bind /proc/ /tmp/target/proc 
 +chroot /tmp/target 
 +grub-install /dev/sdb 
 +update-grub 
 +grub 
 +find /boot/grub/menulst</code>(if you have an own partiton for boot, you can leave boot away in the above command) <code> 
 +root (hd0,0) 
 +setup (hd0) 
 +</code>
   * reboot your system   * reboot your system
  • copy_linux_to_a_new_harddisk.txt
  • Last modified: 06.06.2014 10:54
  • by Pascal Suter