LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 03-20-2012, 01:08 PM   #1
sgull
LQ Newbie
 
Registered: Mar 2012
Distribution: Mint 12 and Lucid Puppy dual boot
Posts: 16

Rep: Reputation: Disabled
disk image for backup help


I'd like to copy a disk image of my 160GB laptop disk which currently has only Mint installed (two primary partitions, one for root and one for swap, both of which occupy a total of 13GB on the disk, with the remainder unallocated) onto a 250GB external USB drive/disk (a spare disk I happen to have, with all space unallocated). Realizing there are all different backup strategies appropriate depending on varying factors, I've decided for now I'd simply like the ability to have an easily accessible and restorable image of what I have on the laptop disk in case of one of the two following scenarios:
1. The laptop disk fails or becomes corrupted.
2. I mess up the data on the laptop disk while doing something I don't know much about (accidentally or intentionally), like altering partitions, system configurations, etc. and lose operability and am unable to restore otherwise.

So far my limited disk backup experience in this regard has consisted of using Clonezilla, of which I've been able to create a disk-to-disk clone (as opposed to a disk to image copy). This is not what I desire, however, because such a disk to disk clone copies everything, even unallocated space. I'm wanting disk to image so that for example I could copy my Mint installation as mentioned, and whatever else I might eventually have on my laptop disk in addition, so that for example if I mess up my 160Gb laptop disk I could just restore it easily right back from the 250GB external disk to it's most recent state which had been copied onto that external disk. But of course, with a disk-to-disk clone image, an attempt to restore the copied 160GB disk from the bigger disk will not work, because with that method the full 250GB including the unallocated space will want to be restored onto the smaller disk but it obviously cannot. But with a disk to image method, restoring from an image on the bigger disk back onto the smaller disk can work because the image (as I understand it) will not include all the unallocated space but only the usable data which I was wanting to have restored.

I've tried unsuccessfully with Clonezilla to create an image of the laptop disk onto my external one. I am likely not doing something right while following the Clonezilla instructions, during the process with Clonezilla it recognizes both drives but the image creation onto the external disk aborts early with a Clonezilla error message "no input device!"

I'm also aware of using Linux dd utility command line method for drive image/cloning, and rsync and such, as well as consider other sensible backup strategies, which I would like to learn/practice but being a newbie was just hoping for now to get a reliable and understandable (and restorable!) disk image backup of my laptop drive as I've described in place.
Any comments/advice appreciated. Thanks.
 
Old 03-20-2012, 02:37 PM   #2
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,491

Rep: Reputation: Disabled
Quote:
I'm also aware of using Linux dd utility command line method for drive image/cloning, and rsync and such, as well as consider other sensible backup strategies, which I would like to learn/practice but being a newbie was just hoping for now to get a reliable and understandable (and restorable!) disk image backup of my laptop drive as I've described in place.
Any comments/advice appreciated. Thanks.
'dd' is the obvious choice; dd if=/dev/<disk> of=disk.img bs=1M will create the file disk.img, to restore it just reverse the proceedure.
(dd of=/dev/<disk> if=disk.img bs=1M)

Please ensure you have a separate copy of your MBR, so that you can restore just that. dd if=/dev<disk> of=mbr.img bs=512 count=1
to restore it dd of=/dev<disk> if=mbr.img bs=512 count=1

Next option is to use tar & gzip/bzip2 in combination. Please refer to the man pages for specifics, but it works something like :-
tar -cfvz / /<disk>/<mount>/<point>/disk.tar; tar -xfvz disk.tar

Hope that's of some help.
 
Old 03-20-2012, 03:42 PM   #3
sgull
LQ Newbie
 
Registered: Mar 2012
Distribution: Mint 12 and Lucid Puppy dual boot
Posts: 16

Original Poster
Rep: Reputation: Disabled
If I were to do dd if=/dev/sda of=disk.img bs=1M , to create the file disk.img , then I understand that the file disk.img would be located in my working directory. What then would be the next step toward getting the file disk.img onto the external USB disk?

And, just to double check, will using this command create a disk image file that will definitely not include the unallocated space on the source disk?

Last edited by sgull; 03-20-2012 at 10:22 PM. Reason: was informed the file disk.img would get located in working directory
 
Old 03-20-2012, 05:49 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
If you only want to backup real files, not inc 'empty' disk space try MondoRescue http://www.mondorescue.org/
 
Old 03-20-2012, 08:22 PM   #5
sgull
LQ Newbie
 
Registered: Mar 2012
Distribution: Mint 12 and Lucid Puppy dual boot
Posts: 16

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by chrism01 View Post
If you only want to backup real files, not inc 'empty' disk space try MondoRescue http://www.mondorescue.org/
Depending on what would be considered 'empty', I just don't want to have to be backing up unallocated disk space. "Unused" space within the partitions I would want to include in the backup.
 
Old 03-20-2012, 09:11 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Quote:
Originally Posted by sgull View Post
"Unused" space within the partitions I would want to include in the backup.
And why would that be ?.
I've not tried mondorescue (despite Chris constantly touting it), but it seems to be just the thing for this.
I'd suggest you go read the doco.
 
Old 03-20-2012, 09:30 PM   #7
sgull
LQ Newbie
 
Registered: Mar 2012
Distribution: Mint 12 and Lucid Puppy dual boot
Posts: 16

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by syg00 View Post
And why would that be ?. I've not tried mondorescue (despite Chris constantly touting it), but it seems to be just the thing for this. I'd suggest you go read the doco.
The reason I would want to include the unused space within the imaged partitions (of the imaged disk) is so that I could retain the sizing I previously may have allocated for particular partitions.

I read the doco of mondorescue but honestly to me it seems rather over-complicated (from my newbie-to-Linux perspective)for what I'm wanting to achieve.
 
Old 03-20-2012, 09:43 PM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
From my quick read it appears mondo sorts all that for you. What you *really* need is the size and type of the partition/filesystem.
No sense copying all that dross around. Which is (one of the reasons) why "dd" is such an appalling choice for this task.

I would have thought the quickstart would be all you need - and eminently understandable.
I see nothing there about the swap - Chris is it managed as well (one would hope so).
 
Old 03-20-2012, 10:01 PM   #9
sgull
LQ Newbie
 
Registered: Mar 2012
Distribution: Mint 12 and Lucid Puppy dual boot
Posts: 16

Original Poster
Rep: Reputation: Disabled
At the first screenshot paragraph in the Mondorescue quick-start it says "If you want to backup/restore to/from a local partition or if you simply want to store the ISO images in a local directory until you have time or facilities to burn them to CD's, choose 'hard disk'.

Well, I'm not wanting to backup/restore to/from a local partition, I am wanting to backup/restore to/from a local disk. And I'm not wanting to store ISO images so that I can later burn them to CD's. I'm wanting, as I mentioned, to backup a restorable disk image of my laptop disk onto an external USB disk (hard disk). The quick-start instructions don't seem to indicate a clear method of how I might go about specifically doing that. Instead, right off the bat, it seems like it's going off track of what I want to do.

Last edited by sgull; 03-21-2012 at 09:51 AM. Reason: correct spelling
 
Old 03-20-2012, 10:43 PM   #10
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
True enough.
 
Old 03-21-2012, 12:37 AM   #11
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Well, certainly don't mean to come across as 'constantly touting it'; just a tool I was recommended by a colleague & have used that can be the right answer in some circumstances ie if you don't want to shut-down the src system and you only want real files, not unused/ space eg like dd.
IOW, you can restore to a different sized disk/partition, so long as its big enough.

You could use clonezilla or dd or rsync or ... depends on what the restrictions/expectations are.
 
Old 03-21-2012, 12:56 AM   #12
sgull
LQ Newbie
 
Registered: Mar 2012
Distribution: Mint 12 and Lucid Puppy dual boot
Posts: 16

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by chrism01 View Post
You could use clonezilla or dd or rsync or ... depends on what the restrictions/expectations are.
My expectation is to create an image my laptop disk which currently looks like this, with only Linux Mint installed: http://imagebin.org/204013 , and my further expectation is that this image should be restorable and bootable (with MBR also imaged), but the image not to include the unallocated space of the source disk.

Not sure what the restrictions of being able to accomplish this might be. I think the biggest restriction right now may be my not being able to understand how to go about it, using any of the above-mentioned methods, i.e, clonezilla, dd, or rsync. any further advice appreciated
 
Old 03-21-2012, 04:16 AM   #13
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,491

Rep: Reputation: Disabled
dd if=/dev/sda1 of=/<ext-hdd-mount-point>/disk.img bs=1M to create an image of your 11.72gb partition.
dd if=/dev/sda of=/<ext-hdd-mount-point>/mbr.img bs=512 count=1 to copy your partition table

dd if=/<ext-hdd-mount-point>/disk.img of=/dev/sda1 bs=1M to restore the image to your disk (11.72gb)
dd if=/<ext-hdd-mount-point>/mbr.img of=/dev/sda bs=512 count=1 to restore you mbr partition table

Should do what you want.
(The method you use is up to you)

Last edited by fatmac; 03-21-2012 at 04:18 AM.
 
Old 03-21-2012, 10:15 AM   #14
sgull
LQ Newbie
 
Registered: Mar 2012
Distribution: Mint 12 and Lucid Puppy dual boot
Posts: 16

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by fatmac View Post
dd if=/dev/sda1 of=/<ext-hdd-mount-point>/disk.img bs=1M to create an image of your 11.72gb partition.
dd if=/dev/sda of=/<ext-hdd-mount-point>/mbr.img bs=512 count=1 to copy your partition table

dd if=/<ext-hdd-mount-point>/disk.img of=/dev/sda1 bs=1M to restore the image to your disk (11.72gb)
dd if=/<ext-hdd-mount-point>/mbr.img of=/dev/sda bs=512 count=1 to restore you mbr partition table
Thanks fatmac.
Questions:
1. ext-hdd-mount-point as above would be my second (backup) disk, correct? so /dev/sdb in that place within the command line(s)?
2. What about my 1gb swap partition, would I not want to be imaging/restoring that also?
 
Old 03-21-2012, 11:32 AM   #15
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,491

Rep: Reputation: Disabled
Quote:
Originally Posted by sgull View Post
Thanks fatmac.
Questions:
1. ext-hdd-mount-point as above would be my second (backup) disk, correct? so /dev/sdb in that place within the command line(s)?
2. What about my 1gb swap partition, would I not want to be imaging/restoring that also?
Yes, /dev/sdb if that is how it gets mounted. (Depends on where & when it gets mounted.)

Swap doesn't get backed up, no need. (The swap space is in your mbr backup)

(If you do lose the swap partition, just remake it; there is nothing you need on swap.)
 
  


Reply



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
Creating backup disk image of RAID 1 array (MDADM) Caligari2k Linux - Server 1 10-29-2010 05:30 AM
VirtualBox virtual disk image backup? .vdi .sav brianpbarnes Linux - Software 3 07-17-2009 02:12 PM
fitting 39 Gb disk image onto 39 Gb backup disk ivlad2002 Linux - Laptop and Netbook 6 03-29-2007 04:45 PM
What is the best sofware to backup an image of a hard disk of any OS? rooch84 Linux - Software 7 08-09-2004 03:28 AM
Using Knoppix for disk image backup johnp Linux - Software 1 04-28-2004 11:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:21 PM.

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