Re: Making an image of my HDD

2008-08-09 Thread Paul Johnson
On Thu, 2008-07-31 at 15:55 -0400, Michael S. Peek wrote:
> Hello gurus,
> 
> I'm considering doing some dangerous tinkering with my laptop.  I have 
> regular backups of /root /boot /etc and /home, but would like to make a 
> complete image of the drive as well.  Ideally, what I want to do is boot 
> from a cd, dd the drive to a file on my workstation via ssh in such a 
> way that I can dd it back later if anything goes wrong.  But before I 
> risk my precious laptop on this, I wanted to double-check my dd command 
> with you guys:
> 
> dd if=${device} conv=sync,noerror bs=64K | ssh -l ${user} ${host} "dd 
> of=file.bin bs=64K"

You might find using an external hard disk and the faubackup package as
a cron.daily task might be more advantageous.  Rationale being that
bootloaders aren't terribly difficult to reinstall, the backups made by
faubackup are accessable using standard filesystem tools (cp, ls, cat,
etc), and backups are complete and incremental at the same time.

If data has not changed from the previous backup, faubackup makes a hard
link to the previous copy of the data.  This makes each day's backup a
complete backup, however, the space used on the filesystem is the same
as an incremental backup.  As older backups expire, when the last hard
link to a particular file's data is removed, the old data is also
removed.  You're getting the compactness of an incremental backup with
the completeness of a full backup every night.

Another thing you might look at is the Hard Disk Upgrade HOWTO.  This
might also give you some prospective into other options that might be of
use in this situation as well.

http://tldp.org/HOWTO/Hard-Disk-Upgrade/index.html

-- 
Paul Johnson
[EMAIL PROTECTED]


signature.asc
Description: This is a digitally signed message part


Re: Making an image of my HDD

2008-08-04 Thread Shachar Or
On Monday 04 August 2008 11:09, Johannes Wiedersich wrote:
> On 2008-08-01 22:09, Shachar Or wrote:
> > On Friday 01 August 2008 10:15, Johannes Wiedersich wrote:
> >> rsync -ax / [EMAIL PROTECTED]:/backup/dir/
> >
> > Does the -x option mean that it will not read mounts like /dev, /proc and
> > such?
>
> Please, read man rsync:

Of course I read it...
> [snip]
> -x, --one-file-system
>This  tells rsync to avoid crossing a filesystem boundary
> when recursing.  This does not limit the user’s ability to
>specify items to copy from multiple filesystems, just
> rsync’s recursion through the hierarchy of each directory that
>the  user specified, and also the analogous recursion on
> the receiving side during deletion.  Also keep in mind that
>rsync treats a “bind” mount to the same device as being
> on the same filesystem.
>
>If this option is repeated, rsync omits all mount-point
> directories from the copy.  Otherwise, it includes an  empty
>directory  at  each  mount-point  it  encounters (using
> the attributes of the mounted directory because those of the
>underlying mount-point directory are inaccessible).
>
>If rsync has been told to collapse symlinks (via
> --copy-links or --copy-unsafe-links), a symlink to a  directory  on
>another device is treated like a mount-point.  Symlinks
> to non-directories are unaffected by this option.
>
>
> Johannes

-- 
Shachar Or | שחר אור
http://ox.freeallweb.org/


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: Making an image of my HDD

2008-08-04 Thread Johannes Wiedersich
On 2008-08-01 22:09, Shachar Or wrote:
> On Friday 01 August 2008 10:15, Johannes Wiedersich wrote:
>> rsync -ax / [EMAIL PROTECTED]:/backup/dir/
> 
> Does the -x option mean that it will not read mounts like /dev, /proc and 
> such?

Please, read man rsync:
[snip]
-x, --one-file-system
   This  tells rsync to avoid crossing a filesystem boundary
when recursing.  This does not limit the user’s ability to
   specify items to copy from multiple filesystems, just
rsync’s recursion through the hierarchy of each directory that
   the  user specified, and also the analogous recursion on
the receiving side during deletion.  Also keep in mind that
   rsync treats a “bind” mount to the same device as being
on the same filesystem.

   If this option is repeated, rsync omits all mount-point
directories from the copy.  Otherwise, it includes an  empty
   directory  at  each  mount-point  it  encounters (using
the attributes of the mounted directory because those of the
   underlying mount-point directory are inaccessible).

   If rsync has been told to collapse symlinks (via
--copy-links or --copy-unsafe-links), a symlink to a  directory  on
   another device is treated like a mount-point.  Symlinks
to non-directories are unaffected by this option.


Johannes




signature.asc
Description: OpenPGP digital signature


Re: Making an image of my HDD

2008-08-01 Thread Shachar Or
On Friday 01 August 2008 10:15, Johannes Wiedersich wrote:
> On 2008-07-31 21:55, Michael S. Peek wrote:
> > Hello gurus,
> >
> > I'm considering doing some dangerous tinkering with my laptop.  I have
> > regular backups of /root /boot /etc and /home, but would like to make a
> > complete image of the drive as well.  Ideally, what I want to do is boot
> > from a cd, dd the drive to a file on my workstation via ssh in such a
> > way that I can dd it back later if anything goes wrong.
>
> IIUC, you 'just' need a backup of your system. I'd recommend to rsync
> your data to your backup like
>
> rsync -ax / [EMAIL PROTECTED]:/backup/dir/

Does the -x option mean that it will not read mounts like /dev, /proc and 
such?
>
> Do this for all partitions of your hard disk.
>
> (rsync runs over ssh)
>
> In case you have to restore in worst case you'd have to
> 1) reformat and repartition your hard disk (keep a reference of your
>partition info!)
> 2) rsync the other way round
>
> This is faster than dd, because only the actual data are transfered,
> while dd transfers all the empty space as well. It also saves (a lot of)
> disk space on your backup system.
>
> In most cases it is *much* faster than dd, since it's rather unlikely
> that you'll break your whole disk, ie. wipe all the data on disk. In
> this case, the restore process will only have to replace those files
> that are actually changed, ie. broken -- typically only a tiny fraction
> of your disk.
>
> YMMV, take care,
>
> Johannes

-- 
Shachar Or | שחר אור
http://ox.freeallweb.org/


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: Making an image of my HDD

2008-08-01 Thread Johannes Wiedersich
On 2008-07-31 21:55, Michael S. Peek wrote:
> Hello gurus,
> 
> I'm considering doing some dangerous tinkering with my laptop.  I have
> regular backups of /root /boot /etc and /home, but would like to make a
> complete image of the drive as well.  Ideally, what I want to do is boot
> from a cd, dd the drive to a file on my workstation via ssh in such a
> way that I can dd it back later if anything goes wrong.  

IIUC, you 'just' need a backup of your system. I'd recommend to rsync
your data to your backup like

rsync -ax / [EMAIL PROTECTED]:/backup/dir/

Do this for all partitions of your hard disk.

(rsync runs over ssh)

In case you have to restore in worst case you'd have to
1) reformat and repartition your hard disk (keep a reference of your
   partition info!)
2) rsync the other way round

This is faster than dd, because only the actual data are transfered,
while dd transfers all the empty space as well. It also saves (a lot of)
disk space on your backup system.

In most cases it is *much* faster than dd, since it's rather unlikely
that you'll break your whole disk, ie. wipe all the data on disk. In
this case, the restore process will only have to replace those files
that are actually changed, ie. broken -- typically only a tiny fraction
of your disk.

YMMV, take care,

Johannes



signature.asc
Description: OpenPGP digital signature


Re: Making an image of my HDD

2008-07-31 Thread elijah r.
> dd if=${device} conv=sync,noerror bs=64K | ssh -l ${user} ${host} "dd
> of=file.bin bs=64K"

Unless you need to encrypt, I recommend that you just use netcat
instead of ssh, as it will be faster.

I also recommend a larger block size.  Using a 64k block size will
take a long time, even if you take encryption out of the equation.

You should also boot from a Live CD; using dd to backup a mounted
filesystem can easily result in a corrupt backup image.  Off the top
of my head, I seem to remember Trinity Rescue Kit & Knoppix having
netcat, dd, and ssh.

The "noerror" conversion is unneccessary.  If dd is giving you input
errors, replace your hard drive and use dd_rescue to salvage your
data.  Also, I don't think you need to use the "sync" option in this
case.  I've never used it for my backups, and they have turned out
perfectly.

As long as you triple-check your if= and your of= before you hit enter
you shouldn't have any major issues. :-)

I also recommend you compress the image to save bandwidth and storage
space, although bzip2 has a 900k cap on its block size, so any larger
blocksizes passed to dd will be moot.

dd if=${device} bs=900k | bzip2 -9c | ssh -l ${user} ${host} "dd
of=backup.img.bz2"

Then verify the image.
on the laptop:
dd if=${device} bs=50M | md5sum

on the server:
bzip2 -d < backup.img.bz2 | md5sum

Someone please correct me if this is wrong.

-Elijah

--
http://elijahr.blogspot.com/


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: Making an image of my HDD

2008-07-31 Thread David A. Parker
dd if=${device} conv=sync,noerror bs=64K | ssh -l ${user} ${host} "dd 
of=file.bin bs=64K"




I have used dd to back up and restore hard drives before, but I've saved 
the image on a NFS directory instead of using ssh.


- Dave

--

Dave Parker
Utica College Department of
Integrated Information Technology Services
Data Processing Office
(315) 792-3229
Registered Linux User #408177


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]




Making an image of my HDD

2008-07-31 Thread Michael S. Peek

Hello gurus,

I'm considering doing some dangerous tinkering with my laptop.  I have 
regular backups of /root /boot /etc and /home, but would like to make a 
complete image of the drive as well.  Ideally, what I want to do is boot 
from a cd, dd the drive to a file on my workstation via ssh in such a 
way that I can dd it back later if anything goes wrong.  But before I 
risk my precious laptop on this, I wanted to double-check my dd command 
with you guys:


dd if=${device} conv=sync,noerror bs=64K | ssh -l ${user} ${host} "dd 
of=file.bin bs=64K"


Any gurus out there can verify whether this is a safe way to do it?

Thanks,

Michael


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]