Go Back   The UNIX and Linux Forums > Special Forums > Hardware > Filesystems, Disks and Memory
google site



Filesystems, Disks and Memory Discuss NAS, SAN, RAID, Robotic Libraries, backup devices, RAM, DRAM, SCSI, IDE, EIDE topics here.

Closed Thread
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Search this Thread
  #1  
Old 12-07-2009
Registered User
 

Join Date: Dec 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Automated disk cloning

Hi,

I'm running Ubuntu on my laptop. To keep my data safe and easy disaster recovery as well I bought similar HDD to one installed in my laptop with higher capacity and using USB box I'm doing disk clone to it. So at any time I can replace disk and carry on with my work as before.

I'm trying to simplify this, automate it. My goal is:
1. plug external USB disk and boot from it
2. "one click" action to execute cloning, let it work.
3. when done, unplug disk and reboot as normal.

I don't want to look for live CDs or use USB key linux installations to do this job everytime, I just want something that will reside on the same external disk, will boot up and do its job.

I tried something like this on virtual machine:
disk A: 300 MB disk, one primary partition, linux installation (DSL) (grub)
disk B: 1GB, actuall back up disk (USB)

I have created primary partition 4 on disk B of size 300MB at the end of the drive. Installed GRML linux on it and Grub as a boot manager. This is suppose to be backu up performing OS.

I've created shell script which does this:
1. backup MBR of disk B

Code:
dd if=/dev/sdb of=bMBR bs=512 count=1

2. backup MBR of disk A

Code:
dd if=/dev/sda of=aMBR bs=512 count=1

3. clone disk A to disk B from possition 0

Code:
dd_rescue /dev/sda /dev/sdb

4. restore disk B MBR so it can be used to backup next time again

Code:
dd of=/dev/sdb if=bMBR bs=512 count=1

when I wanted to use disk B as regular disk I copied back MBR of disk A.

Code:
dd of=/dev/sdb if=aMBR bs=512 count=1

and it shoudl boot up from disk B as it would from disk A, disk B should be regular clone of disk A.

I didn't get expected results.
In first case when disk B should have its original MBR, after cloning it does hang at boot time with black screen and GRUB written on top.
If I copy MBR of disk A to disk B and try to boot from disk B, boot manager seem to be ok but I get kernel panic message from DSL linux with no more info.

I'm not an expert in this field I just wanted to confirm with more experienced users whether I'm just missing something or going completely wrong route. So I won't spend ages of trying to fix something that can't work this way.

Is there anyone who can direct me or give me some clues?

Thanks
Sponsored Links
  #2  
Old 12-07-2009
fpmurphy's Avatar
Moderator
 

Join Date: Dec 2003
Location: /dev/ph
Posts: 2,477
Thanks: 0
Thanked 37 Times in 36 Posts
I am confused as to why you are copying and restoring MBRs. What are you trying to achieve doing this?

You state that you have a laptop and a similar external hard disk. Then you start talking about a virtual machine with a 300Mb disk and a 1GB disk. Which is it? Actual hardware or a virtual environment?
  #3  
Old 12-07-2009
Registered User
 

Join Date: Dec 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Well I'm trying to prove the Idea first in virtual environment, I don't want to screw up actually backed up data on real external disk and also it would take 2 hours each try on real drives to copy 100GB.
So I installed 2 different small linux distributions on 2 virtual disks in virtual machine simulating the stuff with much less data, so I have a sandbox to play with.

I want the external disk to be bootable. So I can boot directly from it and it will handle copying data from live OS disk to external disk itself.
I prepared external disk with small partition in the end of disk and made disk bootable from it. Linux starts up and runs shell script with steps I described.
I'm copying the data from lsource disk to external disk from position 0 which overwrites MBR on external disk with MBR of source disk, so I back up MBR of external and then restore it.
I coudl possibly do copy of data from position 513 which possible is the same thing as backing up and restoring later isn't it?

I just want to copy data from source disk to external but keeping external in its actual state, bootable and booting from partition at the end of the disk.
What I assumed was that if I keep external disk MBR including partition table created for one partition at the end, it would not matter on other data copied to the disk after MBR and not touching partition at the end of the disk.
I'm I completely wrong here?
Sponsored Links
Closed Thread

Tags
backup, clone, dd, dd_rescue, disk

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Problem by cloning boot disk. wolfgang Solaris 6 08-24-2009 07:42 PM
Disk cloning using ufsrestore patricko0317 Solaris 4 06-16-2007 12:55 AM
Hpux Disk Cloning eykyn17 HP-UX 2 06-06-2006 01:59 PM
Disk cloning mhachez SCO 2 01-20-2005 03:12 AM
Aix Cloning annette UNIX for Dummies Questions & Answers 4 01-29-2002 11:19 PM



All times are GMT -4. The time now is 09:22 PM.