User Tools

Site Tools


administration:system-mirror

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
administration:system-mirror [2008/03/12 20:29] damiradministration:system-mirror [2008/11/24 11:36] 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.+  * obviously you can use the same trick to upgrade to a RAID 5 software system 
 +  * **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 13: Line 14:
   * /dev/sda: is the original disk from where the system boot   * /dev/sda: is the original disk from where the system boot
   * /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's no need to put the swap partitions on a raid system)     * 2Gbyte for the swap partition (there's no need to put the swap partitions on a raid system)
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 **/etc/mdadm.conf** file.   * the informations about the devices is written in the **/etc/mdadm.conf** file.
  
-=== 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
 <code> <code>
   mkfs.ext3 /dev/md0   mkfs.ext3 /dev/md0
 </code> </code>
  
-=== 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
 <code> <code>
Line 85: Line 87:
   mkfs.ext3 /dev/vg1/var   mkfs.ext3 /dev/vg1/var
   mkfs.ext3 /dev/vg1/export   mkfs.ext3 /dev/vg1/export
-  mkfs.ext3 /dev/md0 
 </code> </code>
  
-=== 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 ====
 <code> <code>
   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:
 <code> <code>
 +vi /1/etc/fstab
 +
 /dev/vg1/root           /                       ext3    defaults        1 1 /dev/vg1/root           /                       ext3    defaults        1 1
 /dev/md0                /boot                   ext3    defaults        1 2 /dev/md0                /boot                   ext3    defaults        1 2
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**
 <code> <code>
-mkinitrd --preload raid1 --preload raid456 --fstab /1/etc/fstab /boot/initrd-2.6.23.15-80.fc7-2.img 2.6.23.15-80.fc7+mkinitrd --preload raid1 --preload raid456 --preload sata_nv --fstab /1/etc/fstab /boot/initrd-$(uname -r)-raid.img $(uname -r)
 </code> </code>
  
-=== 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 /vmlinuz-2.6.23.15-80.fc7 ro root=/dev/vg1/root vga=791 selinux=0 noipv6 panic=30         kernel /vmlinuz-2.6.23.15-80.fc7 ro root=/dev/vg1/root vga=791 selinux=0 noipv6 panic=30
-        initrd /initrd-2.6.23.15-80.fc7-2.img+        initrd /initrd-2.6.23.15-80.fc7-2-raid.img
 </code> </code>
  
   * 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't work for complex situation like this   * avoid the **grub-install** command, doesn't work for complex situation like this
Line 165: Line 170:
 </code> </code>
  
-=== 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:
 </code> </code>
  
-=== Reboot ===+ 
 +==== Reboot ====
   * time to reboot and see what happens   * time to reboot and see what happens
 <code> <code>
Line 178: Line 184:
 </code> </code>
  
-  * at the boot prompt select the second boot option and verify that is the right one checking that contains the **root (hd1,0)** line+  * **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
 <code> <code>
Line 212: Line 218:
 </code> </code>
  
-== 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
 <code> <code>
Line 218: Line 224:
 </code> </code>
      
-=== add the second disk to the raid system ===+==== add the second disk to the raid system ====
  
 <code> <code>
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 ===+==== one last task is to create the second swap partition ====
  
 <code> <code>
Line 235: Line 241:
   * uncomment the line about he swap partition inside /etc/fstab   * uncomment the line about he 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.txt · Last modified: 2009/03/16 15:00 by damir