Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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?
Distribution: Mainly Debian and Mepis, but also Slackware, Arch and Mandriva
Posts: 73
Rep:
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.
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)
Distribution: Mainly Debian and Mepis, but also Slackware, Arch and Mandriva
Posts: 73
Rep:
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.
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.
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...)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.