LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 01-17-2010, 07:10 AM   #16
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198

Quote:
Originally Posted by thedoctor
Will that program work if saving to a external hard drive as in sdb1.
The short answer is "no" - but that does not tell you the whole story, so I replied to this question earlier thus:
Quote:
Originally Posted by Simon Bridge in post #7
You can save the resulting .dd.gz to any drive that you have mounted.
You can not "save" to /dev/sdb1 because you can only save to a mounted file system. You can, crudely, write to it, but that won't do you much good. The point of having filesystems that you mount and then use is so you don't have to go messing about with binary.

You can save to an external drive partition by mounting it's filesystem someplace handy thus:

sudo mkdir /mnt/external
sudo mount /dev/sdb1 /mnt/external

now your /path/to/storage/ becomes /mnt/external/ as per jschiwal's post (above).
 
Old 01-17-2010, 11:33 PM   #17
thedoctor
Member
 
Registered: Jan 2010
Posts: 47

Original Poster
Rep: Reputation: 15
External Drive

For a external drive, if I write


sudo swapoff -a
sudo dd if=/dev/sda | gzip > /path/to/storage/sdb1.dd.gz

restore

sudo gzip -dc /path/to/storage/sdb1.dd.gz | dd of=/dev/sda
sudo swapon -a


Is the above correct.




Quote:
Originally Posted by Simon Bridge View Post
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.
 
Old 01-18-2010, 05:06 AM   #18
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
Quote:
Originally Posted by thedoctor View Post
For a external drive, if I write


sudo swapoff -a
sudo dd if=/dev/sda | gzip > /path/to/storage/sdb1.dd.gz

restore

sudo gzip -dc /path/to/storage/sdb1.dd.gz | dd of=/dev/sda
sudo swapon -a


Is the above correct.
That sort of thing will work, but seems to show that you still have some confusion about what the commands are doing.

It is good that you try to understand the commands before you use them.

for more information - enter

man dd
man gzip

the important command starts "sudo dd" - that is the bit where the drive gets imaged. I'll break it down in steps for you so you understand better:

sudo dd

- because you need to be root in order to access a /dev file.

if=/dev/sda

"if" means "input file", here we want to use /dev/sda - the entire internal hard drive - as the input. dd will read it in as pure binary, without trying to figure out what it is supposed to be. The drive needs to be unmounted to make a clean image.

| gzip > /path/to/storage/zipfilename.gz

the | is called a "pipe", which puts the output of the program in front of it into the input of the program after it. In this case, it takes the raw binary image of dd and puts it into gzip.

the > is also a pipe, but instead of a pipe to a program, it is a pipe to a file. So it's job here is to tell gzip where to put the resulting zip file. You can call the zip file anything you want, but it is helpful to make "zipfilename" something meaningful.

In this case, the file is a zip the image of sda created by dd, which is why I called it sda.dd.gz - but you can call it anything.

/path/to/storage/ is the absolute path to the filesystem you want to store the zip file in. If you use an external device, then this is the path to where the devices filesystem is mounted. That is going to be different for different systems, so you need to sort this out yourself.

Often, when you plug a removable device in, the OS will mount it for you in the /media directory. Go look. My system mounts my external drive as /media/usbdrive0 so, for me, /path/to/storage/ = /media/usbdrive0/ but yours will be different.

The reason we are piping the output directly to a storage medium is that you are running these commands from a live distro - running in RAM. It is unlikely you will have enough RAM to store the image. You can always cd into the directory you want the image to end up in first, in which case you can leave out the /path/to/storage/ part - which seems to be confusing you.
 
Old 01-18-2010, 06:09 AM   #19
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Rep: Reputation: 471Reputation: 471Reputation: 471Reputation: 471Reputation: 471
Just wondering if the OP has tried Remastersys?

It will create a Livecd, installable to HD
it will backup every folder,etc in the filesystem if yuo want
and is available for 8.10
http://www.geekconnection.org/remastersys/ubuntu.html

Remastersys-backup doesn't get the creds it deserves as
a backup utility

its also GUI driven and pretty easy vs cloning.etc

If I'm wrong,etc its cause I didnt read the whole thread
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How to make an image (back-up) for easily restoring tweaked operating system CharlieBucket Linux - Software 2 09-23-2007 04:32 PM
hard drive image back up ciberrust Linux - General 16 01-19-2007 02:08 AM
Partitioning my hard drive for another operating system. Chuong Linux - Software 5 11-09-2006 03:26 PM
back up entire hard drive to image file? with a live cd n_md Linux - Software 2 02-01-2006 03:04 AM
installing linux on unformatted hard drive with no operating system gjhowar Linux - Newbie 4 08-18-2004 04:29 PM

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

All times are GMT -5. The time now is 01:57 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