Rsync my elastix to 2nd SATA disc

Discussion in 'General' started by vaibhavs, Oct 23, 2009.

  1. vaibhavs

    Joined:
    Oct 2, 2009
    Messages:
    95
    Likes Received:
    0
    Hi,

    My Elastix server is functioning well.
    Thx to members of this forum!!


    I have purchased an identical disc for backup.
    I did a `dd` & cloned the main disc to the 2nd disc (downtime of about 90 min to sector-by-sector copy 240 GB disc).

    The 2nd SATA is connected to the server.

    I would like to backup the main disc every alternate day (via cron & rsync).

    My plan is as follows:
    ---------------
    stop httpd
    stop mysql
    mount 2nd hdd
    rsync
    unmount 2nd hdd
    start mysql
    start httpd
    -----------------

    I anticipate little downtime.

    Problem:
    --------
    I am unable to mount the 2nd HDD.
    Some lvm issue.

    Code:
    [root@elastix ~]#  fdisk -l
    
    Disk /dev/sda: 250.0 GB, 250059350016 bytes
    255 heads, 63 sectors/track, 30401 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *           1          13      104391   83  Linux
    /dev/sda2              14       30401   244091610   8e  Linux LVM
    
    Disk /dev/sdb: 250.0 GB, 250059350016 bytes
    255 heads, 63 sectors/track, 30401 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1   *           1          13      104391   83  Linux
    /dev/sdb2              14       30401   244091610   8e  Linux LVM
    
    Code:
    [root@server1 ~]# mount /dev/sdb2 /mnt/HDD2
    mount: /dev/sdb2 already mounted or /mnt/HDD2 busy
    [root@server1 ~]#
    
    Code:
    [root@server1 ~]# mount -t ext3 -o rw /dev/sdb /mnt/HDD2
    mount: wrong fs type, bad option, bad superblock on /dev/sdb,
           missing codepage or other error
           In some cases useful info is found in syslog - try
           dmesg | tail  or so
    
    [root@server1 ~]#
    
    I am struggling since 2 days with this.
    How do I crack this...

    Pls help!

    Thx
    Vai
     
  2. ramoncio

    Joined:
    May 12, 2010
    Messages:
    1,663
    Likes Received:
    0
    Hi vaibhavs,

    You need to rename the Volume Group (VG), or it conflicts with the second hard drive VG name.
    I have done it booting with an Ubuntu live cd, but maybe you can also do it in single user mode, I haven't tried that way. In order to change the VG names, they must not be in use.
    With ubuntu (or any other lvm compatible live cd) it is quite easy. You need to install lvm2 using apt-get. Then run 'vgscan -v' to see the existing VGs.
    Use 'vgdisplay', so you can see the VG UUID of each VG, as you can't rename them using the VG name (both VGs have the same name) you need to use the UUID. With 'vgrename UUID NewVGName' you rename the VG.
    At this point you can also rename the second hard drive's VG too, so if any time you need to rsync that hard drive with a brand new installed Elastix hard drive you will not need to repeat this VG rename process.
    Also, don't forget to modify /boot/grub/menu.lst and change VolGroup00 for NewVGName, or you won't be able to boot Elastix!

    Then you are ready for rsyncing!!
     
  3. ramoncio

    Joined:
    May 12, 2010
    Messages:
    1,663
    Likes Received:
    0
    Next time you can use rsync, clonezilla, or mondoarchive to clone the hard drive, dd takes much more time and you don't need to copy the entire hard drive sector by sector, just the data. You can even do it from the live cd and when you finish, install lvm2, rename the VGs change both menu.lst and you are done.

    Using rsync and another Elastix server or mondoarchive you can do it without downtime at all.
    I wrote a script somewhere here in the forum to migrate a running server to a brand new Elastix installed server using rsync. You can even migrate a lvm machine to a non-lvm destination server.
    And mondoarchive can also be run without downtime, into a running Elastix server.
    With the next options it generates a bootable iso which you can use to boot and clone your hard drive to a brand new machine:

    Code:
    mondoarchive -p mondoarchive_ -Oi -I "/" -E '/root/images/mondo /root/.VirtualBox/HardDisks' -d /root/images/mondo -s 4400m -8
    
    (all in one line, darn Fireboard!!)

    -p prefix
    -I "include"
    -E 'excludes'
    -d destination
    -s size
    -8 compression level

    There is also a script somewhere in the forum to install mondoarchive, I think it was from NerdVittles.
     
  4. vaibhavs

    Joined:
    Oct 2, 2009
    Messages:
    95
    Likes Received:
    0
    Hi Ramoncio,

    Thx for your detailed reply... Its got my eyes spinning already :huh:
    I have basic linux knowledge, so this is all Greek for me.
    But I am determined to do this... Its my first on my ToDo list Monday morning and I will take it one-step-at-a-time to prevent confusion.

    I have a SUSE-10 LiveCD.

    My run-up is as follow:

    (1) Boot the server using LiveCD.
    (2) run 'vgscan -v' to see the existing VGs
    (3) run 'vgdisplay', & note the VG UUID of each VG (I believe I will see UUID of both HDDs)
    (4) run 'vgrename UUID NewVGName' -- Change HDD1 UUID Name
    Question: Don't I need to define the current name which has to be renamed ?
    I mean all `rename` commands have 2 parameters: currentName, newName.
    Please advice.

    (5) run 'vgrename UUID NewVGName' -- Change HDD2 UUID Name

    Pls let me know if my run-up is correct or if I have missed something.

    Thx again.
    Vai
     
  5. vaibhavs

    Joined:
    Oct 2, 2009
    Messages:
    95
    Likes Received:
    0
    Hi,

    Here are my outputs:
    Code:
    [root@elastix ~]# vgscan -v
        Wiping cache of LVM-capable devices
        Wiping internal VG cache
      Reading all physical volumes.  This may take a while...
        Finding all volume groups
        Finding volume group "VolGroup00"
      Found volume group "VolGroup00" using metadata type lvm2
        Archiving volume group "VolGroup00" metadata (seqno 3).
        Archiving volume group "VolGroup00" metadata (seqno 3).
        Creating volume group backup "/etc/lvm/backup/VolGroup00" (seqno 3).
        Finding volume group "VolGroup00"
      Found volume group "VolGroup00" using metadata type lvm2
        Archiving volume group "VolGroup00" metadata (seqno 3).
        Archiving volume group "VolGroup00" metadata (seqno 3).
        Creating volume group backup "/etc/lvm/backup/VolGroup00" (seqno 3).
    [root@elastix ~]#
    


    Code:
    [root@elastix ~]# vgdisplay
      --- Volume group ---
      VG Name               VolGroup00
      System ID
      Format                lvm2
      Metadata Areas        1
      Metadata Sequence No  3
      VG Access             read/write
      VG Status             resizable
      MAX LV                0
      Cur LV                2
      Open LV               2
      Max PV                0
      Cur PV                1
      Act PV                1
      VG Size               232.78 GB
      PE Size               32.00 MB
      Total PE              7449
      Alloc PE / Size       7449 / 232.78 GB
      Free  PE / Size       0 / 0
      VG UUID               KIsay7-JOiP-ttlr-WMRY-sTjc-8rqb-3LLezn
    
      --- Volume group ---
      VG Name               VolGroup00
      System ID
      Format                lvm2
      Metadata Areas        1
      Metadata Sequence No  3
      VG Access             read/write
      VG Status             resizable
      MAX LV                0
      Cur LV                2
      Open LV               2
      Max PV                0
      Cur PV                1
      Act PV                1
      VG Size               232.78 GB
      PE Size               32.00 MB
      Total PE              7449
      Alloc PE / Size       7449 / 232.78 GB
      Free  PE / Size       0 / 0
      VG UUID               rYEsOa-Bmao-0NKS-Jhgg-fnvu-1fXn-4DFVig
    


    As you will see 'VG Name' of both disks is "VolGroup00"
    AND VG UUID is already different.

    Confused again, what do I need to change ?
    "VolGroup00"
    OR
    KIsay7-JOiP-ttlr-WMRY-sTjc-8rqb-3LLezn & rYEsOa-Bmao-0NKS-Jhgg-fnvu-1fXn-4DFVig

    Thx again for your time.

    Vai
     
  6. ramoncio

    Joined:
    May 12, 2010
    Messages:
    1,663
    Likes Received:
    0
    Try to use VolGroup00 and you'll see why, read the error you get, it is quite clear.

    'vgrename VolGroup00 NewName' is used when you don't have two VGs called VolGroup00, you need to identify which of them. In this case you need to use the UUID, as I told you. And the UUID will remain the same, it will only change the VG name.
     
  7. donhwyo

    Joined:
    Aug 8, 2008
    Messages:
    293
    Likes Received:
    0
    Why not make a raid 1 out of your new disk. There are many tutorials on how to make a raid after the install for centos out there. You can also do it from the install disk if you don't mind reinstalling.

    I know raid is not really a backup but you can remove the drive and add it back easily and the raid software will do all the sync operations quick and easy. I disconnect 1 drive before doing a major update. If all works smooth after a few days I add the other drive back. If it fails I boot of the old version and add the other drive back.

    Don
     
  8. vaibhavs

    Joined:
    Oct 2, 2009
    Messages:
    95
    Likes Received:
    0
    I think I am getting there....
    My rename command should be:

    Code:
    vgrename KIsay7-JOiP-ttlr-WMRY-sTjc-8rqb-3LLezn VolGroup-E-Main
    
    vgrename rYEsOa-Bmao-0NKS-Jhgg-fnvu-1fXn-4DFVig VolGroup-E-Back
    
    Please advice.

    Thx
    Vai
     
  9. vaibhavs

    Joined:
    Oct 2, 2009
    Messages:
    95
    Likes Received:
    0
    The only reason I want to refrain from RAID1 is that if there is any corruption it will get copied on the backup drive as well.

    With the current rsync type setup, I plan to have 2 backup HDDs.
    On Odd dates, I will rsync Main with HDD1 twice a day
    On Even dates, I will rsync Main with HDD2 twice a day

    Just 1 server, least down time in case of a HDD crash / corruption.
    With 2 HDD it will cover me for weekends etc.

    This seems to be the best solution & at lowest cost.

    Thx
    Vai
     
  10. vaibhavs

    Joined:
    Oct 2, 2009
    Messages:
    95
    Likes Received:
    0
    I managed to change the VG-Name of one of the HDDs to "VolGroup-E-Back"

    But when trying to change the VG-Name of the other HDD to "VolGroup-E-Main", I got the following message:
    Volume Group "VolGroup00" still has active LVs

    How can I address this ?



    I am booted with FC-9 Live Disk.
    How do I change the /boot/grub/menu.lst.
    Mount the HDD or something...
    I have never done this stuff before, so need some help pls.

    Thx
    Vai
     

Share This Page