Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
copy_linux_to_a_new_harddisk [05.01.2011 00:07] – Pascal Suter | copy_linux_to_a_new_harddisk [06.06.2014 10:54] (current) – 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 --bind /dev/ /mnt/new/dev | + | 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 |
- | setup (hd0) | + | mount --bind /sys/ /tmp/target/sys |
+ | mount --bind | ||
+ | chroot /tmp/target | ||
+ | grub-install /dev/sdb | ||
+ | update-grub | ||
+ | grub | ||
+ | find / | ||
+ | root (hd0,0) | ||
+ | setup (hd0) | ||
+ | </ | ||
+ | * if you are moving your installation to new hardware (other than just the harddisk) you might need to update your initrd image to contain the necessary drivers (i.e. in redhat based systems). run '' | ||
* reboot your system | * reboot your system |