2001-11-13 07:11:23

by s.srinivas

[permalink] [raw]
Subject: % more space reqd. when dd is used?

hi all,

I have two physical harddisks /dev/hda1 and /hdb

1) i want to copy drive (take backup) to a file ( in /hdb)using dd.
So how much space( in terms percentage)more is required in /hdb
for it to be copied successfully.

2) After copying using dd if=/dev/hda1 of=/hdb/backup

how to retrive it back again in terms of directories and sub-directories
and files.

thank u all

regards
vasu



Attachments:
Wipro_Disclaimer.txt (853.00 B)

2001-11-13 09:58:51

by Yann E. MORIN

[permalink] [raw]
Subject: Re: % more space reqd. when dd is used?

Vasu,

> hi all,
> I have two physical harddisks /dev/hda1 and /hdb

You have two physical hard disks /dev/hda and /dev/hdb.
- hda contains a partition /dev/hda1 you want to backup.
- hdb contains at least one partition /dev/hdb1 on which you want to
put the backup (unless you use the raw HD formatted).

I'll assume you'll backup to a file in /dev/hdb1.

> 1) i want to copy drive (take backup) to a file ( in /hdb)using dd.
> So how much space( in terms percentage)more is required in /hdb
> for it to be copied successfully.

Don't know the right answer. That shall not need too much overhead.

But I would point out that /dev/hda1 can _not_ be a live filesystem
(I mean you can't do that if /dev/hda1 is mounted, for example as
your root FS), if it is, you'll end up with a backup containing errors
(due to cache).

$ umount /dev/hda1
$ mount /dev/hdb1 /hdb
$ dd if=/dev/hda1 of=/hdb/backup

But if you want, you can also do this:
$ umount /dev/hda1 /dev/hdb1
$ dd if=/dev/hda1 of=/dev/hdb1

That way, /dev/hdb1 needs to be exactly the size of /dev/hda1

> 2) After copying using dd if=/dev/hda1 of=/hdb/backup
> how to retrive it back again in terms of directories and
> sub-directories and files.

Two solutions here:
- you want to restore /dev/hda1 at the state it was at backup, then
you dd if=/hdb/backup of=/dev/hda1 (Note that once again /dev/hda1
must _not_ be mounted)
- or you just want to access the backup. In this case you need
a loop device: mount -o loop /hdb/backup /mnt/backup
You'll need loop support in your kernel (either built-in or
module). That way, you can compare the FS against the backup,
and/or restore part of it (by cp'ing files/directories).

Correct me where I'm wrong.

Regards,
Yann E. MORIN.

--
.---------------------------.----------------------.------------------.
| Yann E. MORIN | Real-Time Embedded | ASCII RIBBON /"\ |
| phone (+33/0) 299 055 231 | Software Designer | CAMPAIGN \ / |
| fax (+33/0) 299 055 221 ?----------------------: AGAINST X |
| [email protected] http://www.atosorigin.com | HTML MAIL / \ |
?--------------------------------------------------?------------------?