How can I backup/restore different partitions individually?
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How can I backup/restore different partitions individually?
I have both Ubuntu and Vista on my machine, not counting the extra media partitions, and I would like to know if there is a way to backup all of the partitions to a USB hard drive so I can restore a single partition or all of them easily.
For example, I want to be able to restore only Windows if it crashes or only Ubuntu if I make it crash or only /home without overwriting the working partitions.
What would be a safe, simple and efficient way to get this done every week? I'll take care of the cron job, but I need advice on the method.
I would try using fdisk on the hard drive that your linux is installed. If you can see the Vista partitions then you could try to use the dd command from a partition to a file on your usb drive. e.g., dd if=/dev/sda of=/mnt/usbdrive/partition_name
Be very careful with fdisk. You can always use the letter q as a command followed by enter t9o exit without changing anyting
Quote:
Originally Posted by n1c0_ds
I have both Ubuntu and Vista on my machine, not counting the extra media partitions, and I would like to know if there is a way to backup all of the partitions to a USB hard drive so I can restore a single partition or all of them easily.
For example, I want to be able to restore only Windows if it crashes or only Ubuntu if I make it crash or only /home without overwriting the working partitions.
What would be a safe, simple and efficient way to get this done every week? I'll take care of the cron job, but I need advice on the method.
You probably don't wanna do it in a cron job. Especially for a mounted partition.
Try out clonezilla live. It works great as an image backup tool. Runs off a livecd.
After fixing some errors with my partitions (overlapping), I used dd if=/dev/sda of=/dev/sdc1. sdc1 is a 250gb, fat32 partition on my external hard drive.
Over 2 hours and still writing, can't wait to see what will happen.
In the end, I still ended up using the DD command. While it might not be the fastest method, it still is remarkably simple and efficient.
It took me 12 hours to get my whole hard drive backed up to an external HDD.
Once you're done, I had to use GParted to remake the swap partition as it had been destroyed during the transfer and showed up as an unknown partition. (I was using my computer the whole time)
I would not trust the partitions containing your active system nor active applications after using dd!
Using dd on a mounted partition that contains files that change rapidly can result in different parts of a single file being copied while the file is changing.
I do not understand the way Vista partitions a disk so you are going to get that from some one else.
I do know that with a Linux system one can copy the boot sector and in that way maintain a partition table of the hard disk.
As for it taking 12 hours, You did say you were using a USB connection.
Quote:
Originally Posted by n1c0_ds
In the end, I still ended up using the DD command. While it might not be the fastest method, it still is remarkably simple and efficient.
It took me 12 hours to get my whole hard drive backed up to an external HDD.
Once you're done, I had to use GParted to remake the swap partition as it had been destroyed during the transfer and showed up as an unknown partition. (I was using my computer the whole time)
Well, I tried Norton Ghost yesterday. Big disappointment. So I went back to the dd command and this time added conv=sync,noerror and it worked like a charm. The external hard drive is now bootable (I even booted it by accident and didn't notice until I saw the blinking light).
IMHO, making regular image backups is too fragile. An initial clone, and full file backup after a new install would be ok. You can use rsync or tar to create incremental backups.
If you use dd to create a temporary zero-filled file, and then delete it, partitions will be more compressible. Use the results of `df' to determine the size of the zeroed file to create. Restoring, you would pipe the output of zcat (or bzcat) to the dd command when restoring.
If you do compress the images, you won't be able to mount the images.
If you create a disk image, you can use losetup to create loop devices, and then mount partitions on the image. I'd recommend running "fdisk -lu" to create a listing of your partition table. Print it out. It may come in handy in the future to either restore a damaged MBR or to get the offsets to use with losetup.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.