administration:system-mirror
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
administration:system-mirror [2008/03/12 19:30] – damir | administration:system-mirror [2009/03/16 14:00] (current) – damir | ||
---|---|---|---|
Line 3: | Line 3: | ||
===== Prologue ===== | ===== Prologue ===== | ||
- | * with the instructions that follow we move a complete root system disk from bare partitions to a raid 1 software layer. | + | * with the instructions that follow we move a complete root system disk from bare partitions to a RAID 1 software layer. |
- | * all the work is done without putting the server off-line, but it's better to stop the services before starting the copy of the files from the old disk to the new one. | + | |
+ | * **all the work is done without putting the server off-line, but it's better to stop the services before starting the copy of the files from the old disk to the new one** | ||
* only one reboot process is needed if the disks are already installed on the server and if the whole process is correct. | * only one reboot process is needed if the disks are already installed on the server and if the whole process is correct. | ||
Line 14: | Line 15: | ||
* /dev/sdb: is the second disk | * /dev/sdb: is the second disk | ||
- | === create the correct partitions we need === | + | ==== create the correct partitions we need ==== |
* 100 MB for the boot partition | * 100 MB for the boot partition | ||
* 2Gbyte for the swap partition (there' | * 2Gbyte for the swap partition (there' | ||
Line 47: | Line 48: | ||
- | === now we need to create the raid 1 partitions for the boot and the other partitions === | + | ==== now we need to create the raid 1 partitions for the boot and the other partitions |
* /dev/md0 will be the first raid 1 partition used only by the /boot directory | * /dev/md0 will be the first raid 1 partition used only by the /boot directory | ||
* /dev/md1 will be the raid 1 disk used for everything else | * /dev/md1 will be the raid 1 disk used for everything else | ||
Line 61: | Line 62: | ||
* the informations about the devices is written in the **/ | * the informations about the devices is written in the **/ | ||
- | === the /dev/md0 partition will be used flat for the boot partitions === | + | ==== the /dev/md0 partition will be used flat for the boot partitions ==== |
+ | * so we can format it right now | ||
< | < | ||
mkfs.ext3 /dev/md0 | mkfs.ext3 /dev/md0 | ||
</ | </ | ||
- | === the /dev/md1 partition will be splitted using the lvm layer === | + | ==== the /dev/md1 partition will be splitted using the lvm layer ==== |
* if the virtual disk **vg1** is already used, please change the example below | * if the virtual disk **vg1** is already used, please change the example below | ||
< | < | ||
Line 85: | Line 87: | ||
mkfs.ext3 / | mkfs.ext3 / | ||
mkfs.ext3 / | mkfs.ext3 / | ||
- | mkfs.ext3 /dev/md0 | ||
</ | </ | ||
- | === time to mount the partitions to copy the system from the original disk === | + | ==== time to mount the partitions to copy the system from the original disk ==== |
< | < | ||
mkdir /1 | mkdir /1 | ||
Line 106: | Line 107: | ||
* wait until the system is copied | * wait until the system is copied | ||
| | ||
- | === Create the new initrd image file === | + | |
- | * after the copy we need to create a new initrd and change the information in the /etc/fstab file | + | ==== Create the new initrd image file ==== |
+ | * after the copy we need to create a new initrd and change the information in the **/1/etc/fstab** file | ||
* avoid the use of label inside this file, instead use the physical name of the devices | * avoid the use of label inside this file, instead use the physical name of the devices | ||
* you should have something like that: | * you should have something like that: | ||
< | < | ||
+ | vi / | ||
+ | |||
/ | / | ||
/ | / | ||
Line 125: | Line 129: | ||
* the reference to the swap partition on the first disk must be commented | * the reference to the swap partition on the first disk must be commented | ||
- | * now we can create the new initrd image | + | * now we can create the new initrd image **include also the serial-ata module, if necessary** |
< | < | ||
- | mkinitrd --preload raid1 --preload raid456 --fstab / | + | mkinitrd --preload raid1 --preload raid456 |
</ | </ | ||
- | === Edit the grub configuration file in the original disk === | + | |
+ | ==== Edit the grub configuration file in the original disk ==== | ||
* change the file adding a instance forthe new disk | * change the file adding a instance forthe new disk | ||
* this is the original instance: | * this is the original instance: | ||
Line 149: | Line 154: | ||
root (hd1,0) | root (hd1,0) | ||
kernel / | kernel / | ||
- | initrd / | + | initrd / |
</ | </ | ||
* leave the default boot partition to the old disk, so in case of trouble we can reboot | * leave the default boot partition to the old disk, so in case of trouble we can reboot | ||
- | === Install the boot loader on the second disk === | + | ==== Install the boot loader on the second disk ==== |
* we need to install the grub boot loader on the new disk using the **grub** command | * we need to install the grub boot loader on the new disk using the **grub** command | ||
* avoid the **grub-install** command, doesn' | * avoid the **grub-install** command, doesn' | ||
Line 165: | Line 170: | ||
</ | </ | ||
- | === update the data on the second disk === | + | ==== update the data on the second disk ==== |
* we need to copy the changes from the original disk to the new one | * we need to copy the changes from the original disk to the new one | ||
Line 172: | Line 177: | ||
</ | </ | ||
- | === Reboot === | + | |
+ | ==== Reboot | ||
* time to reboot and see what happens | * time to reboot and see what happens | ||
< | < | ||
Line 178: | Line 184: | ||
</ | </ | ||
- | * at the boot prompt select the second boot option and verify that is the right one checking that contains the **root (hd1,0)** line | + | |
* if everything was right the system should boot with the raid 1 disk | * if everything was right the system should boot with the raid 1 disk | ||
- | ==== The New System ==== | + | ===== The New System |
* now we have the system running on the software raid disk, but the raid is in downgrade mode (only one disk is operating at the moment) | * now we have the system running on the software raid disk, but the raid is in downgrade mode (only one disk is operating at the moment) | ||
* we need to connect the original disk tho the current one | * we need to connect the original disk tho the current one | ||
Line 189: | Line 195: | ||
* in our examples /dev/vg0 is the old lvm disk | * in our examples /dev/vg0 is the old lvm disk | ||
- | === Deleting the old lvm partitions === | + | ==== Deleting the old lvm partitions |
* we disable the old lvm partitions to avoid confusion | * we disable the old lvm partitions to avoid confusion | ||
< | < | ||
Line 212: | Line 218: | ||
</ | </ | ||
- | == Creating the new partition table form the second disk === | + | ==== Creating the new partition table form the second disk ==== |
* now we can recreate the new partition table copying the partition of /dev/sdb to /dev/sda | * now we can recreate the new partition table copying the partition of /dev/sdb to /dev/sda | ||
< | < | ||
Line 218: | Line 224: | ||
</ | </ | ||
| | ||
- | === add the second disk to the raid system === | + | ==== add the second disk to the raid system |
< | < | ||
Line 226: | Line 232: | ||
* the raid subsystem is synchronizing the content of both disks | * the raid subsystem is synchronizing the content of both disks | ||
- | === one last task is to create the second swap partition === | + | ==== .... and update the grub code ==== |
+ | |||
+ | < | ||
+ | grub | ||
+ | root (hd0,0) | ||
+ | setup (hd0) | ||
+ | quit | ||
+ | </ | ||
+ | |||
+ | ==== the last task is to create the second swap partition | ||
< | < | ||
Line 233: | Line 248: | ||
</ | </ | ||
- | * uncomment the line about he swap partition inside /etc/fstab | + | * uncomment the line about the swap partition inside /etc/fstab |
- | ==== Kernel upgrade ==== | + | ===== Kernel upgrade |
**During Kernel upgrade the grub file must be manually modified in order to add the reference to the second disk** | **During Kernel upgrade the grub file must be manually modified in order to add the reference to the second disk** | ||
administration/system-mirror.1205350203.txt.gz · Last modified: 2008/03/12 19:30 by damir