LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Linux Windows/ backup & Restore (http://www.linuxquestions.org/questions/linux-newbie-8/linux-windows-backup-and-restore-555375/)

pentalive 05-20-2007 02:45 PM

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!!

1337_penguin 05-20-2007 03:01 PM

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

pentalive 05-20-2007 03:06 PM

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

1337_penguin 05-20-2007 03:14 PM

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

saikee 05-20-2007 03:24 PM

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.

pentalive 07-09-2007 11:39 AM

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!


All times are GMT -5. The time now is 02:07 AM.