Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Member
    Join Date
    Nov 2004
    Posts
    58

    Unhappy Clone local drive with rsync?? Advice needed

    Can anyone explain how I might go about backing up an entire (server/drive) to another one in the same machine - at regular intervals? (ie. cron)

    Basically, the main hard-drive in the system has been a little unreliable lately, and I'd like to clone it (ie. WITHOUT compression/tars etc) so in the event of a failure, the 2nd drive could be swapped over and everything would run as usual.

    Here's the physical drives of the system:
    hda: WDC WD2500JB-75FUA0, ATA DISK drive
    hdb: ST3250820A, ATA DISK drive
    hdc: SAMSUNG CD-ROM SC-148A, ATAPI CD/DVD-ROM drive
    hda: max request size: 1024KiB
    hda: 488281250 sectors (250000 MB) w/8192KiB Cache, CHS=30394/255/63, UDMA(100)
    hda: cache flushes supported
    hdb: max request size: 1024KiB
    hdb: 488397168 sectors (250059 MB) w/8192KiB Cache, CHS=30401/255/63, UDMA(100)
    hdb: cache flushes supported
    hdc: ATAPI 48X CD-ROM drive, 128kB Cache, UDMA(33)


    hda contains everything.

    /dev/hda5 7.9G 385M 7.1G 6% /
    /dev/hda1 122M 33M 83M 29% /boot
    none 506M 0 506M 0% /dev/shm
    /dev/hda6 189G 88G 92G 49% /home
    /dev/hda7 1012M 319M 642M 34% /tmp
    /dev/hda2 20G 4.0G 15G 22% /usr
    /dev/hda3 9.9G 424M 9.0G 5% /var
    /tmp 1012M 319M 642M 34% /var/tmp

    And I'd like to copy everything (partitions, files, boot record etc) to hdb which has just been added by the datacenter.

    So, can rsync do this? and If so, with what command?

    Sorry for all the questions, but after researching on the web, and in this forum, I haven't found a clear answer.. but I have learned that done incorrectly, I could seriously mess up the existing data.

    Thanks in advance.

  2. #2
    Member
    Join Date
    Nov 2001
    Location
    Athens - Greece
    Posts
    98

    Default

    *** I TAKE NO RESPONSIBILITY FOR THE INSTRUCTIONS BELOW ***
    As i don't feel very comfortable with rsync, i would use a "dump'n'restore" approach. So...
    1. Copy the mbr and partition table from hda to hdb with the command
    Code:
    dd if=/dev/hda of=/dev/hdb count=16
    2. create a dummy chroot dir with the commands
    Code:
    mkdir -p /home/SECONDDRIVE/boot
    mkdir /home/SECONDDRIVE/home
    mkdir /home/SECONDDRIVE/usr
    mkdir /home/SECONDDRIVE/var
    3. create file system on the new drive
    Code:
    newfs /dev/hdb1
    newfs /dev/hdb2
    newfs /dev/hdb3
    newfs /dev/hdb5
    newfs /dev/hdb6
    newfs /dev/hdb7
    4. Mount the new partitions to the appropriate folders with the command:
    Code:
    mount /dev/hdb5 /home/SECONDDRIVE/
    mount /dev/hdb1 /home/SECONDDRIVE/boot
    mount /dev/hdb2 /home/SECONDDRIVE/usr
    mount /dev/hdb3 /home/SECONDDRIVE/var
    mount /dev/hdb6 /home/SECONDDRIVE/home
    5. Dump and restore data on the new drive with the commands:
    Code:
    dump cf - / | (cd /home/SECONDDRIVE/; restore xf - )
    dump cf - /boot | (cd /home/SECONDDRIVE/boot; restore xf - )
    dump cf - /usr | (cd /home/SECONDDRIVE/usr; restore xf - )
    dump cf - /var | (cd /home/SECONDDRIVE/var; restore xf - )
    dump cf - /home | (cd /home/SECONDDRIVE/home; restore xf - )
    ------
    CPanel Tips and Solutions
    http://www.cphelp.gr
    ------

  3. #3
    Super Moderator This forum account has been confirmed by cPanel staff to represent a vendor. chirpy's Avatar
    Join Date
    Jun 2002
    Location
    Go on, have a guess
    Posts
    13,495

    Default

    Bear in mind that this would likely generate corrupt MySQL databases if you have them stored on the drive. These need to be dumped to text files beforehand and then restored from the dumps.
    Jonathan Michaelson

    Need your cPanel servers secured and tuned?
    cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
    Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
    http://www.configserver.com

  4. #4
    Member
    Join Date
    Sep 2001
    Posts
    315

    Default

    Is there any other solution to replicated a disc during the main disk is in normal operation? This would be a very good solution to make backups, in case a disk is broken, you just replace the disk and everything is running again. No need for OS reload, WHM installation and Cpanel Backup restore.

    Or is the replication to disk I/O intensive?

    Michael

  5. #5
    Member
    Join Date
    Nov 2004
    Posts
    58

    Default

    thanks troxalias,

    I got to step 3, and get '-bash: newfs: command not found
    '.

    Was I meant to substitute "seconddrive" with something in step2?

    Thanks.. and sorry for the noob questions.

    Cameron

  6. #6
    Member
    Join Date
    Feb 2008
    Location
    Atlanta, GA
    Posts
    74
    cPanel/Enkompass Access Level

    DataCenter Provider

    Default

    Quote Originally Posted by CoolMike View Post
    Is there any other solution to replicated a disc during the main disk is in normal operation? This would be a very good solution to make backups, in case a disk is broken, you just replace the disk and everything is running again. No need for OS reload, WHM installation and Cpanel Backup restore.

    Or is the replication to disk I/O intensive?

    Michael
    How about using RAID? I have never used before but am about to with new server.

  7. #7
    Super Moderator This forum account has been confirmed by cPanel staff to represent a vendor. chirpy's Avatar
    Join Date
    Jun 2002
    Location
    Go on, have a guess
    Posts
    13,495

    Default

    RAID isn't a reliable method for duplicating data for this purpose and doesn't address the issue of MySQL database corruption. To avoid that, you're better off using a backup MySQL database that will duplicate transactions in realtime. Setting that up is straightforward.
    Jonathan Michaelson

    Need your cPanel servers secured and tuned?
    cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
    Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
    http://www.configserver.com

  8. #8
    Member
    Join Date
    Nov 2004
    Posts
    58

    Default

    chirpy, what would you recommend for cloning/mirroring a drive?

    rsync, dd or maybe some other software?

    thanks

  9. #9
    Super Moderator This forum account has been confirmed by cPanel staff to represent a vendor. chirpy's Avatar
    Join Date
    Jun 2002
    Location
    Go on, have a guess
    Posts
    13,495

    Default

    If you want remote synchronisation, then rsync would probably by the best way with periodic updates from the liver server. Together with a duplicate MySQL server to keep that up to date.
    Jonathan Michaelson

    Need your cPanel servers secured and tuned?
    cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
    Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
    http://www.configserver.com

  10. #10
    Member
    Join Date
    Oct 2003
    Location
    Atlanta, GA
    Posts
    121

    Default

    Quote Originally Posted by chirpy View Post
    If you want remote synchronisation, then rsync would probably by the best way with periodic updates from the liver server. Together with a duplicate MySQL server to keep that up to date.
    can you post a how-to, showing how you would do the mirroring of another drive

Similar Threads & Tags
Similar threads

  1. Advice Needed
    By markholland8 in forum Data Protection
    Replies: 4
    Last Post: 04-11-2009, 07:01 AM
  2. Possible Drive Failure - Need to clone
    By Dhp4 in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 03-02-2008, 11:26 AM
  3. subdomain advice needed
    By mv_ in forum New User Questions
    Replies: 4
    Last Post: 05-02-2007, 07:03 AM
  4. rsync backup to my local Windows server - what should I install?
    By spaceman in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 10-26-2006, 05:14 PM
  5. Replies: 19
    Last Post: 12-08-2005, 07:26 PM
Tags for this Thread
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube