-   Linux - Newbie (
-   -   How do you duplicate a 512 Meg Compact flash to a 1 GB compact flash using dd??? (

allen00860 05-20-2009 11:23 PM

How do you duplicate a 512 Meg Compact flash to a 1 GB compact flash using dd???
Hi All,

I have a 512 Meg compact flash (from a Cisco Router running Cisco Unity Express module) that I need to duplicate its content onto a 1GB compact flash.

I am running fedora 10 and I was able to read the 512 compact flash and I can see the files and the systems reports everything correctly file system is reiserfs.

I used dd to create an image file -

linuxhost#dd if=/dev/sdb1 of=/flash.img

The image size looks correct, size wise etc.

I then remove the 512 Meg compact flash and insert the 1 GB compact flash, the system recognizes the CF and mounts it, I unmount it to begin the restore of the image.

I then use dd to restore the image back to the 1 GB compact flash.

linuxhost#dd if=/flash.img of=/dev/sdb1

The transfer completed and it seemed that all the files have been transferred and the image was restored.

The only problem is that once the image is transferred to the 1 GB compact flash, it has a total space of 512 Meg (less the space used by the files) and I have not been able to restore the image to the 1 GB compact flash where the available space is 1 GB storage capacity on the compact flash. It reports the media as 1 GB but the total storage capacity is seen as 512 Meg.

I played around with the bs=, ibs=, obs=, and count= options but I have not been able to get it to work.

Does anyone know how this can be done and what the correct syntax is for accomplishing using dd?

Thanks in advance,

Tinkster 05-20-2009 11:27 PM

Hi, welcome to LQ!

What does fdisk tell you about the stick? Any unpartitioned space left?
Or did you also copy the partition table of the smaller one across?

If the answer to my 2nd question is "no", just add a partition; failing
that (or it being undesirable, use something like (q)parted to modify
the media.


syg00 05-20-2009 11:44 PM

I don't like dd used for this - as I say everytime this comes up.
dd did what you asked it to - it copied the (entire) filesystem. I don't use reiser, but I presume it comes with a resizing utility. You should be able to run that and have it fill the partition.

Edit: looks like resize_reiser should do the job.

allen00860 05-21-2009 03:21 AM

Wow thanks for the quick response everyone (and the welcome)...

Hey Tinkster – the answer is I am not sure; when I run the fdisk this is what I see (see below) (I am new to this so bear with me – I am learning ….) I see files but when I print the partition table I do not see a start or end is this normal? When I do a verify of the partition table I see unallocated sectors but I am not sure if that is relevant.

I will try to run the (q)parted or resize_reiser as syg00 suggested. I will need to read up on these utilities and if you don’t mind I will ask again if I have problems….

In the mean time based on the outputs if there are any suggestions I am all ears.

Thanks all


[root@localhost /]# df
Filesystem 1K-blocks Used Available Use% Mounted on
16997212 3132964 13691764 19% /
/dev/sda1 194442 13558 170845 8% /boot
tmpfs 500652 76 500576 1% /dev/shm
/dev/sdb1 495916 236688 259228 48% /media/disk
[root@localhost /]#

[root@localhost /]# ls /media/disk/ -l
total 1851
drwxrwxr-x 2 root daemon 9000 2004-09-20 00:12 bin
-rwxr-xr-x 2 root daemon 809372 2004-09-19 23:19 bzImage
-rwxr-xr-x 2 root daemon 809372 2004-09-19 23:19 bzImage.volant
drwxrwxr-x 4 root daemon 96 2004-09-19 23:21 data
drwx------ 2 root root 48 2004-09-19 23:22 dev
drwxrwxr-x 5 root daemon 664 2004-09-20 04:52 etc
drwxrwxrwt 2 root daemon 48 2004-09-20 03:59 home
-rw-r--r-- 1 root root 0 2004-09-20 00:00 INSTALL_COMPLETE
drwxrwxr-x 5 403 daemon 224 2004-09-20 04:53 ldap
drwxrwxr-x 6 root daemon 5288 2004-09-19 23:21 lib
drwxrwxr-x 3 root daemon 88 2004-09-19 23:20 opt
drwx------ 2 root root 48 2004-09-19 23:22 proc
drwxrwxr-x 2 root daemon 240 2004-09-19 23:20 sbin
drwxrwxr-x 3 root daemon 80 2004-09-19 23:22 sw
-rwxr-xr-x 1 root daemon 256628 2004-09-19 23:19
drwxrwxrwt 4 root daemon 224 2004-09-20 04:58 tmp
drwxrwxr-x 9 root daemon 224 2004-09-20 00:00 usr
-rw-rw-r-- 1 root daemon 0 2002-12-31 16:01 VALID_REISER_PARTITION
drwxrwxrwx 11 root daemon 288 2004-09-20 00:00 var
[root@localhost /]#

[root@localhost /]# fdisk /dev/sdb1
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xcf0a831e.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): p

Disk /dev/sdb1: 1024 MB, 1024934400 bytes
32 heads, 63 sectors/track, 992 cylinders
Units = cylinders of 2016 * 512 = 1032192 bytes
Disk identifier: 0xcf0a831e

Device Boot Start End Blocks Id System

Command (m for help): v
2001824 unallocated sectors

Command (m for help):

[root@localhost /]#

syg00 05-21-2009 03:26 AM

That last one is no good - lets see "fdisk -l" (no quotes).
But it would appear you have a one gig partition, and the resize should simply expand to fill it.

allen00860 05-23-2009 09:48 PM

Hey Tinkster & syg00,

Thanks for your help - I ran resize_reiser and was able to expand the file system size to 1 Gig.

All times are GMT -5. The time now is 02:12 AM.