LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 05-20-2007, 01:45 PM   #1
pentalive
Member
 
Registered: Jun 2005
Location: Sacramento, CA
Distribution: Many, Old and New
Posts: 124

Rep: Reputation: 15
Linux Windows/ backup & Restore


Hi,

I have a 40gb hard drive in my laptop - and a 40gb external usb2 hard drive. There are ubuntu feisty fawn linux and windows xp pro partitions on the laptop.

I want to copy everything from the laptop to the external for backup purposes.

I think I need to do this:

1) create a thumb-drive linux I can boot the machine from so that niether OS I want to backup is "running"

2) boot the thumb drive and use dd to clone the internal drive to the usb drive

3) repeat at interval (perhaps after major installs or once a week or so)

If I do this will I be able to:

mount the external drive and get individual files while running from the internal drive linux or windows?

Restore the backup to a new 40gb drive in the laptop (replacing the current one that has broke) If the internal drive breaks will the usb drive be
bootable? (I can currently boot from the drive it's holding and experimental
ubuntu install.)

Restore the backup to some other machine and expect it to work?

Do I really need to use the thumb drive, or can windows or linux back themselves up properly?

Are there other backup methods that would be better(given what I have asked
above)?

And the hardest question... Are there any questions I am not asking that
I should consider?

Thanks!!

Last edited by pentalive; 05-20-2007 at 01:47 PM.
 
Old 05-20-2007, 02:01 PM   #2
1337_penguin
Member
 
Registered: Jul 2005
Location: Brighton, UK
Distribution: Mainly Debian and Mepis, but also Slackware, Arch and Mandriva
Posts: 73

Rep: Reputation: 15
Hi

If it has a CD-ROM drive, you won't need to bother with making an install on a USB drive as you could just use a live CD such as Knoppix.

As for using dd, although it should be fine if you copy everything (ie. the bootloader, partition table and partitions) it will be slower than just copying the files on the partitions. (for example, I tend to create partitions on another drive, cp -ax /mnt/old /mnt/new and then restore the bootloader)

To answer your other questions, restoring the image onto another drive of the same size should be fine, as should booting from the USB drive provided that the BIOS is capable of booting from USB.

1337_penguin

Last edited by 1337_penguin; 05-20-2007 at 02:03 PM.
 
Old 05-20-2007, 02:06 PM   #3
pentalive
Member
 
Registered: Jun 2005
Location: Sacramento, CA
Distribution: Many, Old and New
Posts: 124

Original Poster
Rep: Reputation: 15
Thanks... bootloader? Individual files?

Quote:
Originally Posted by 1337_penguin
Hi

If it has a CD-ROM drive, you won't need to bother with making an install on a USB drive as you could just use a live CD such as Knoppix.

As for using dd, although it should be fine if you copy everything (ie. the bootloader, partition table and partitions) it will be slower than just copying the files on the partitions. (for example, I tend to create partitions on another drive, cp -ax /mnt/old /mnt/new and then restore the bootloader)

Yo answer your other questions, restoring the image onto another drive of the same size should be fine, as should booting from the USB drive provided that the BIOS is capable of booting from USB.

1337_penguin

BIOS Can boot from usb. Will dd copy the bootloader too?

If I dd this will it create partitons that windows would mount? (so I can restore individual files)

Thanks
 
Old 05-20-2007, 02:14 PM   #4
1337_penguin
Member
 
Registered: Jul 2005
Location: Brighton, UK
Distribution: Mainly Debian and Mepis, but also Slackware, Arch and Mandriva
Posts: 73

Rep: Reputation: 15
If you supply the device name to dd it will copy everything.

eg.
Code:
dd if=/dev/hda of=image.foo
The first 512 bytes contain the bootloader (first 446 bytes) and partition table (next 64 bytes).

eg. to copy the bootloader you could do something like:
Code:
dd if=/dev/hda of=bootloader.img bs=446 count=1
If the drive contains a FAT(/32)/NTFS partition then that should work. If you want to be able to access the Linux partition from Windows you could try something like this: http://www.fs-driver.org/

1337_penguin

Last edited by 1337_penguin; 05-20-2007 at 02:16 PM.
 
Old 05-20-2007, 02:24 PM   #5
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
A partition is a consecutive hard disk space from xth section to the yth sector. The first sector is always reserved for the boot loader and is called the boot sector, although a few Linux partitions type start the filing system from the first sector but they are the minor exception.

To dd a partition it always starts from the first and stops when the last one is reached. Therefore dd is the only backup command that copies the boot loaders. All the other commands in Linux and WIndows are filing system-based in that only the filing system, less the boot sector, is copied.

Modern Bios can boot USB as the first bootable device but like 1337_penguin said the logical choice is to use a Linux Live CD but a USB based distro will work too.

You can mount the back up disk and restore individual files as you wish to.

If you clone the whole disk the target must be at least same size, down to the exact number of sectors, or just larger. This is because in cloning the first sector, containing the partition table, is always transferred. If the target disk is smaller that partition table tells that there are hard disk addresses not available in the smaller hard disk and no operating system in the world would dare to touch it because no one knows what to do with it.
 
Old 07-09-2007, 10:39 AM   #6
pentalive
Member
 
Registered: Jun 2005
Location: Sacramento, CA
Distribution: Many, Old and New
Posts: 124

Original Poster
Rep: Reputation: 15
After Action Report

I can indeed dd one entire disk to the other, using the command
dd if=/dev/sda of=/dev/sdb

I boot from a live cd ubuntu, make sure /dev/sda and /dev/sdb are not mounted. use dd

I have been able to boot from the USB drive in it's container, but only Linux - grub chokes when I try to boot windows from there.

I have been able to mount the USB drive and see files in the backup. (I did not try to copy any but I assume that will work ok too)

I have phyically removed my laptops internal drive and swapped the backup drive in, and that booted the machine and looked exactly the same as the internal drive did. (woot! slow speed mirroring...)

The backup takes about 2 hours. not too bad.

Thanks!
 
  


Reply

Tags
backupoptions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Backup & Restore Your Installation johnroberts LinuxAnswers Discussion 2 11-04-2009 05:14 PM
Oracle 10 G Database Backup & Restore rajaniyer123 Linux - Software 1 07-02-2006 11:21 PM
How to backup & restore the MBR in linux? sgzlit Linux - Newbie 7 03-02-2005 09:07 PM
Backup & Restore chaitu_iiit Linux - Software 2 10-30-2004 12:10 AM
Backup & Restore plan using tar markcasazza Linux - Newbie 1 04-14-2004 01:11 PM


All times are GMT -5. The time now is 12:08 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration