Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
copy_linux_to_a_new_harddisk [05.01.2011 00:07] – Pascal Suter | copy_linux_to_a_new_harddisk [13.05.2013 23:55] – 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 | ||
- | | + | |
- | * edit fstab and / | + | * create mountpoints |
- | * install grub | + | mkdir / |
- | mount the root and boot partitions: | + | * mount source and targed partitions: < |
- | mount /dev/hdcX /mnt/new | + | mount /dev/sda3 / |
- | | + | mount /dev/sda1 / |
- | mount /dev/hdc0 /mnt/new/boot | + | mount /dev/sdb3 / |
- | chroot /mnt/new | + | mkdir / |
- | grub-install /dev/hdc | + | mount /dev/sdb1 / |
- | + | </ | |
- | | + | * now copy the os: < |
- | find / | + | * edit / |
- | (if you have an own partiton for boot, you can leave boot away in the above command) | + | * chroot to the target drive and install grub: < |
- | root (hd0,0) | + | mount --bind /dev/ /tmp/target/dev |
- | setup (hd0) | + | mount --bind |
+ | chroot /tmp/target | ||
+ | grub-install /dev/sdb | ||
+ | update-grub | ||
+ | grub | ||
+ | find / | ||
+ | root (hd0,0) | ||
+ | setup (hd0) | ||
+ | </ | ||
* reboot your system | * reboot your system |