2

I have a partition (/dev/sda1) of 10 GB. Also have "dd" file of another 7 GB partition ( /dev/sdb1).

When I execute the command as:

dd if=sdb1.dd of=/dev/sda1

then everything goes fine but I can not use remaining 3 GB space of /dev/sda1

Is there any way to tell DD to utilize remaining free space ( 3 GB in this case ) ?

3 Answers 3

10

dd does not care about free space (as in the filesystem concept) whatsoever, it just copies block by block.

If sdb1.dd is a filesystem image, you may be able to grow it using resize2fs or other tools (depending on the filesystem type) after you copied it.

resize2fs /dev/sda1
1

Is there any way to tell DD to utilize remaining free space ( 3 GB in this case ) ?

No.

More to the point, assuming the target partition is the proper size (as you say), what you are doing is effectively writing a file system which only knows about the first portion of the partition. dd does not care about the meaning of the data written either at the source or the destination.

Depending on the file system in use, you might be able to expand the file system to use the entire partition, but that's far beyond the responsibilities of dd and the specifics will depend heavily on which exact file system is inside that image file.

0

dd doesn't copy files, if copies bytes. That includes the structure of the filesystem, which is a 7 gigabyte filesystem. When you are done copying, the filesystem data indicates it is a 7 gigabyte filesystem.

If you are just trying to duplicate all the files, using dd to make a copy isn't what you want. Use tar, or dump/restore onto a freshly created filesystem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .