You are not logged in.

#1 2006-01-30 20:52:30

otakar
Member
From: Charles University, Prague, Cz
Registered: 2006-01-14
Posts: 15

Copying of partition content using dd [solved]

I've got a problem. I bought a new hard disk for my laptop. I copied content of my old home directory (on separate partition with ext3fs, approx. 17GB) using dd to a file.

dd if=/dev/hda6 of=home.img 

Then a backed the file on an external hdd.
When I had installed new hdd and arch, I copied the file to new home partition (also ext3fs, approx. 40 GB).

dd if=home.img of=/dev/hda6

And here comes the problem. The home partition reports havimg just 17GB (as the old one).
Can I fix it somehow? Is there any other way to copy content of whole partition without this problem?

Offline

#2 2006-01-30 23:03:29

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,838

Re: Copying of partition content using dd [solved]

Briefly, dd created an image of your old partition, and that image will always be 17GB - there's nothing you can do about that. If you still have the old disk, mount it somewhere and do one of the following:
- copy the contents using cp -a
- archive the contents using tar
Either of these methods will allow you to restore to the larger partition.
If you no longer have the old disk, or can't mount it anywhere, you can always create another partition with the unused 23GB, and use it that way.

Offline

#3 2006-01-31 09:35:22

paranoos
Member
From: thornhill.on.ca
Registered: 2004-07-22
Posts: 442

Re: Copying of partition content using dd [solved]

those are valid suggestions, tomk. i think you forgot that you can mount a drive image though smile

first, reformat your /home directory as desired, then do the following:

mount -t ext3 home.img /mnt -o loop
cp -a /mnt  /home

Offline

#4 2006-01-31 09:39:21

pikass
Member
From: Schwartz space
Registered: 2005-11-28
Posts: 85

Re: Copying of partition content using dd [solved]

I recommend to use rsync -a over cp for such tasks.

Offline

#5 2006-01-31 10:47:58

dojo
Member
Registered: 2005-11-02
Posts: 96

Re: Copying of partition content using dd [solved]

Hi,

i think you can change the partition size using cfdisk and then resizing your ext3-partition with

resize2fs

.

Have look at the manpage for the options.
For the next  backup you should use tar.

Greets

Sunnemer

Offline

#6 2006-01-31 11:12:23

zen_guerrilla
Member
From: Greece
Registered: 2002-12-22
Posts: 259

Re: Copying of partition content using dd [solved]

Consider using dump (in extra) instead of dd. It's the unix-way of back-up smile.

Offline

#7 2006-01-31 11:36:06

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,838

Re: Copying of partition content using dd [solved]

paranoos wrote:

those are valid suggestions, tomk. i think you forgot that you can mount a drive image though smile

I did indeed - thanks.

Offline

#8 2006-01-31 11:53:44

otakar
Member
From: Charles University, Prague, Cz
Registered: 2006-01-14
Posts: 15

Re: Copying of partition content using dd [solved]

Thak you all, for your help. Arch community is really great!
As I had already deleted the .img file I copied content out using rsync -a, formated partition and rsync -a back. So it's working.

ota

Offline

Board footer

Powered by FluxBB