LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 09-01-2009, 04:12 PM   #1
n1c0_ds
LQ Newbie
 
Registered: Mar 2009
Posts: 17

Rep: Reputation: 0
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.
 
Old 09-01-2009, 04:52 PM   #2
rimkus
LQ Newbie
 
Registered: Jan 2006
Posts: 9

Rep: Reputation: 0
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 View Post
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.
 
Old 09-01-2009, 06:37 PM   #3
ongte
Member
 
Registered: Jun 2009
Location: Penang, Malaysia
Distribution: Mageia, CentOS, Ubuntu
Posts: 468

Rep: Reputation: 72
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.
 
Old 09-01-2009, 10:46 PM   #4
n1c0_ds
LQ Newbie
 
Registered: Mar 2009
Posts: 17

Original Poster
Rep: Reputation: 0
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.


I'll try clonezilla too, next time.
 
Old 09-02-2009, 08:34 AM   #5
ongte
Member
 
Registered: Jun 2009
Location: Penang, Malaysia
Distribution: Mageia, CentOS, Ubuntu
Posts: 468

Rep: Reputation: 72
I don't think dd will work this way. dd is just a straight raw byte by byte copy. It will probably screw-up the sdc1 partition.

Last edited by ongte; 09-02-2009 at 08:40 AM.
 
Old 09-02-2009, 08:58 AM   #6
n1c0_ds
LQ Newbie
 
Registered: Mar 2009
Posts: 17

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by ongte View Post
I don't think dd will work this way. dd is just a straight raw byte by byte copy. It will probably screw-up the sdc1 partition.
It indeed did!

Since the thing absolutely needs a complete, raw hard disk to work, and that I can't provide.

After 12 hours, I had 204gb copied only! Not good if you don't have 12 hours free to keep your laptop open.
 
Old 09-02-2009, 09:08 AM   #7
ongte
Member
 
Registered: Jun 2009
Location: Penang, Malaysia
Distribution: Mageia, CentOS, Ubuntu
Posts: 468

Rep: Reputation: 72
There's a good clone of Ghost called G4L you might try out.
For quick backup of partitions, try partimage.
 
Old 09-02-2009, 09:05 PM   #8
n1c0_ds
LQ Newbie
 
Registered: Mar 2009
Posts: 17

Original Poster
Rep: Reputation: 0
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)
 
Old 09-03-2009, 06:33 AM   #9
rimkus
LQ Newbie
 
Registered: Jan 2006
Posts: 9

Rep: Reputation: 0
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 View Post
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)
 
Old 09-07-2009, 09:12 AM   #10
n1c0_ds
LQ Newbie
 
Registered: Mar 2009
Posts: 17

Original Poster
Rep: Reputation: 0
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).

I wrote a complete guide (pictures!) on how to use the command here:
http://blog.nicolasbouliane.com/?p=1115
 
Old 09-07-2009, 09:36 AM   #11
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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.
 
  


Reply

Tags
backup, clone, dd, drive



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
LXer: Backup and Restore Linux Partitions Using Partimage LXer Syndicated Linux News 0 01-22-2007 10:54 AM
Backup and restore magasem AIX 7 07-30-2006 01:36 PM
Backup Restore to new PC tjabaut Linux - Hardware 2 07-14-2006 11:01 PM
restore backup nkeever Linux - Newbie 2 06-19-2006 09:03 AM
backup / restore 5pints Linux - Software 2 01-11-2005 09:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration