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 |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
|
01-04-2010, 09:51 PM
|
#1
|
Member
Registered: Jan 2010
Posts: 47
Rep:
|
Image Hard drive Ubuntu Operating system 9.10 Complete back up and restore
Image Hard drive Ubuntu Operating system 9.10 Complete back up and restore.
Changing over Hard Drives need a complete back up not just save files.
So the image can be restored on any hard drive that restores the computer to its original state before it was imaged.
|
|
|
01-04-2010, 10:13 PM
|
#2
|
LQ Guru
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211
Rep: 
|
quick and dirty: from a live disk - total disk clone.
sudo swapoff -a
sudo dd if=/dev/sda | gzip > /path/to/storage/sda.dd.gz
restore it:
sudo gzip -dc /path/to/storage/sda.dd.gz | dd of=/dev/sda
sudo swapon -a
on systems that use uuids you may need to prepare them as normal dev labels first - to avoid conflicts. Or you can regenerate uuids in a script. If you have to do this a lot, then you'll be wanting to put all above in some sort of script which also handles pushing the image out over a network etc.
Last edited by Simon Bridge; 01-04-2010 at 10:21 PM.
|
|
|
01-04-2010, 10:20 PM
|
#3
|
LQ Guru
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211
Rep: 
|
As you see I'm a bit of a traditionalist. There are lots of programs providing different amounts of control:
http://www.thefreecountry.com/utilit....shtml#imaging
|
|
|
01-05-2010, 02:55 AM
|
#4
|
Member
Registered: Jan 2010
Posts: 47
Original Poster
Rep:
|
Path
Tried the example from live disk several times without any success.
Thanks
Is there a way of saving it to a external Hard Drive.
I tried that with the sdb1.
Quote:
Originally Posted by Simon Bridge
quick and dirty: from a live disk - total disk clone.
sudo swapoff -a
sudo dd if=/dev/sda | gzip > /path/to/storage/sda.dd.gz
restore it:
sudo gzip -dc /path/to/storage/sda.dd.gz | dd of=/dev/sda
sudo swapon -a
on systems that use uuids you may need to prepare them as normal dev labels first - to avoid conflicts. Or you can regenerate uuids in a script. If you have to do this a lot, then you'll be wanting to put all above in some sort of script which also handles pushing the image out over a network etc.
|
|
|
|
01-05-2010, 03:14 AM
|
#5
|
Member
Registered: Nov 2003
Location: London, UK
Distribution: openSUSE, Ubuntu
Posts: 358
Rep:
|
I have successfully upgraded several machines with both Windows XP on NTFS partitions & Suse 11.1 on EXT3 partitions using CloneZilla. This was to replace existing hard drives with larger ones. In the case of one Win XP it was to provide a recovery solution, as I no longer have the install disks.
You need to give it a try first to understand the settings, but it will work between disks with different geometries. The best way seems to be to clone to a bare unformatted drive, and then resize & add partitions afterwards.
I was quite suprised the first time I did it with XP which was to replace a failing drive, and the machine came up with an error message at POST warning of a hardware change. Going into set-up and then rebooting and it all worked without any reconfiguration.
PartedMagic has a disk image function which will achieve the same result, but I haven't tried that yet.
|
|
|
01-05-2010, 06:30 AM
|
#6
|
Member
Registered: Jun 2009
Location: Penang, Malaysia
Distribution: Mageia, CentOS, Ubuntu
Posts: 468
Rep:
|
I second Clonezilla LiveCD. The best cloning tool on Linux by far.
|
|
|
01-05-2010, 06:25 PM
|
#7
|
LQ Guru
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211
Rep: 
|
Quote:
Originally Posted by thedoctor
Tried the example from live disk several times without any success.
|
Need to know what you mean by "without any success" - what happened? Were there errors? What were they? I need to know exactly what you did - the best way to do this is to copy and paste from the terminal - including the command you entered with the resulting output.
Quote:
Is there a way of saving it to a external Hard Drive.
|
You can save the resulting .dd.gz to any drive that you have mounted.
You are unlikely to have enough RAM to save the disk image in the live session anyway. When I do this, I boot from an external HDD.
As the others have commented, you may be more comfortable with a gui tool like clonezilla. I gave you a link to a huge list with descriptions for all you options in my previous post.
|
|
|
01-05-2010, 07:39 PM
|
#8
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
Just to add an FYI. It you use dd to create an image file and pipe it through gz as Simon Bridge suggested; you can first use dd to create a zeroed file which nearly fills the disk, and delete the file. For a new installation on an old disk this will greatly reduce the size of the saved backup image.
Use "sudo df -B512 <device>" to learn how many free blocks are available. Then create a temporary file just shy of that size.
Here is an example using a formated, mounted image (I didn't want to mess with a partiton on my laptop):
Code:
df -B512 /mnt/tera/
Filesystem 512B-blocks Used Available Use% Mounted on
/dev/loop3 1032080 72784 906872 8% /mnt/tera
jschiwal@qosmio:~> sudo dd if=/dev/loop3 | bzip2 >backup1.img
1048577+0 records in
1048577+0 records out
536871424 bytes (537 MB) copied, 209.76 s, 2.6 MB/s
:~> ls -lh backup1.img
-rw-r--r-- 1 jschiwal jschiwal 487M 2010-01-05 19:34 backup1.img
:~> sudo dd if=/dev/zero bs=512 count=906870 of=/mnt/tera/delete.me
906870+0 records in
906870+0 records out
464317440 bytes (464 MB) copied, 5.2989 s, 87.6 MB/s
:~> sudo dd if=/dev/loop3 | bzip2 >backup2.img
1048577+0 records in
1048577+0 records out
536871424 bytes (537 MB) copied, 37.9564 s, 14.1 MB/s
:~> ls -lh backup2.img
-rw-r--r-- 1 jschiwal jschiwal 45M 2010-01-05 19:36 backup2.img
I first copied a large media file and removed it for this demonstration to simulate a used hard disk. ( I did forget to delete the zeroed file as well. Doggonit! ) I should have named the backups with a .bz2 extension.
I wouldn't recommend using images for regular backups, but they are useful after a fresh installation to quickly recover after a hard disk failure.
Last edited by jschiwal; 01-05-2010 at 07:55 PM.
|
|
|
01-06-2010, 01:11 AM
|
#9
|
LQ Guru
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211
Rep: 
|
A lot of corporate CTOs like to mandate disk images as a failsafe. I've also seen internet cafes restore all their machines from an image each night to avoid malware.
For backups, we have so many other options - we can avoid high bandwidth costs by maintaining caching repositories and deploying thin clients to centralise maintenance. We can use offsite net storage for file backups - with utilities like rsync. The brute force approaches that we see so often are usually a response to having to put up with the restrictions built into a proprietary system.
Without knowing why thedoctor wants to clone the drive, we cannot really advise.
@jschiwal: I had no idea the saving was so great! I've mostly only done this on fresh installs to distribute to many identical machines.
How good is this as a zeroing method against forensic file recovery?
|
|
|
01-06-2010, 01:45 AM
|
#10
|
Senior Member
Registered: Mar 2009
Location: USA
Distribution: Arch
Posts: 1,022
Rep: 
|
Quote:
Originally Posted by Simon Bridge
quick and dirty: from a live disk - total disk clone.
sudo swapoff -a
sudo dd if=/dev/sda | gzip > /path/to/storage/sda.dd.gz
restore it:
sudo gzip -dc /path/to/storage/sda.dd.gz | dd of=/dev/sda
sudo swapon -a
on systems that use uuids you may need to prepare them as normal dev labels first - to avoid conflicts. Or you can regenerate uuids in a script. If you have to do this a lot, then you'll be wanting to put all above in some sort of script which also handles pushing the image out over a network etc.
|
^^^^ Is the best way if you are just doing it on your personal computer.
|
|
|
01-07-2010, 09:34 PM
|
#11
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
Quote:
Originally Posted by Simon Bridge
@jschiwal: I had no idea the saving was so great! I've mostly only done this on fresh installs to distribute to many identical machines.
|
My example was a little contrived because I filled the filesystem with a large file and then deleted that file before my test. If you are starting with a used drive that was once filled to capacity, you can see similar dramatic results. I once demonstrated this using my /boot partition, and got good results. The laptop I use now doesn't have a separate partition for /boot, so I used a 500 MB file instead for the demonstration. But as you use compressed images to prepare "many" machines, a 50% savings could free up a lot of bandwidth and time.
Quote:
How good is this as a zeroing method against forensic file recovery?
|
You would need special hardware to recover information written over. However zeroing free space won't cover the slack space between the end of a file and the end of a sector on the disk. Also, if some parts of the drive are swapped out as bad by the drive, this area which once contained files won't be zeroed out. When you wipe a drive, you want to use pseudo-random numbers to write over the drive, at least twice. Or use a secure wipe function that is part of the drive itself.
Last edited by jschiwal; 01-07-2010 at 09:45 PM.
|
|
|
01-07-2010, 10:18 PM
|
#12
|
LQ Guru
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211
Rep: 
|
Thanx.
ref your sig:
Owed to a Spell Chequer
I halve a spelling chequer
It came with my pea sea
It plane lee marques four my revue
Miss steaks aye ken knot sea
Eye ran this poem threw it
Your sure reel glad two no
It's vary polished in it's weigh
My chequer tolled me sew
A chequer is a bless sing
It freeze yew lodes of thyme
It helps me awl stiles two reed
And aides mi when aye rime
To rite with care is quite a feet
Of witch won should be proud
And wee mussed dew the best wee can
Sew flaws are knot aloud
And now bee cause my spelling
is checked with such grate flare
Their are know faults with in my cite
Of nun eye am a wear
Each frays come posed up on my screen
Eye trussed to be a joule
The chequer poured o'er every word
To cheque sum spelling rule
That's why aye brake in two averse
My righting wants too pleas
Sow now ewe sea wye aye dew prays
Such soft wear for pea seas
http://www.phys-astro.sonoma.edu/peo...ngChequer.html
even: sill oh ate.
|
|
|
01-14-2010, 09:25 AM
|
#13
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
Thanks for the poem. Your SpellChequer must have a poetic license plugin.
|
|
|
01-14-2010, 11:36 PM
|
#14
|
Member
Registered: Jan 2010
Posts: 47
Original Poster
Rep:
|
imaging the hard drive
Will that program work if saving to a external hard drive as in sdb1.
Thanks
Quote:
Originally Posted by Simon Bridge
quick and dirty: from a live disk - total disk clone.
sudo swapoff -a
sudo dd if=/dev/sda | gzip > /path/to/storage/sda.dd.gz
restore it:
sudo gzip -dc /path/to/storage/sda.dd.gz | dd of=/dev/sda
sudo swapon -a
on systems that use uuids you may need to prepare them as normal dev labels first - to avoid conflicts. Or you can regenerate uuids in a script. If you have to do this a lot, then you'll be wanting to put all above in some sort of script which also handles pushing the image out over a network etc.
|
|
|
|
01-15-2010, 06:58 PM
|
#15
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
Simply mount the external drive and redirect the output of gzip to a file on it.
So if you mount it on mnt/, then
sudo dd if=/dev/sda | gzip > /path/to/storage/sda.dd.gz
Doing an image backup of sda would be better done using a live cd. If you need to restore, you will probably be using a live CD anyway.
|
|
|
All times are GMT -5. The time now is 03:53 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|