LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-20-2009, 10:23 PM   #1
allen00860
LQ Newbie
 
Registered: May 2009
Posts: 3

Rep: Reputation: 0
Question 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 it’s 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,
Allen
 
Old 05-20-2009, 10:27 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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.



Cheers,
Tink
 
Old 05-20-2009, 10:44 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,130

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
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.

Last edited by syg00; 05-20-2009 at 10:49 PM.
 
Old 05-21-2009, 02:21 AM   #4
allen00860
LQ Newbie
 
Registered: May 2009
Posts: 3

Original Poster
Rep: Reputation: 0
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
Allen

---------------

[root@localhost /]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
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 System.map
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 /]#
 
Old 05-21-2009, 02:26 AM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,130

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
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.
 
Old 05-23-2009, 08:48 PM   #6
allen00860
LQ Newbie
 
Registered: May 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Hey Tinkster & syg00,

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


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Compact Flash Installation robotissues Linux - General 5 10-02-2006 04:37 PM
Compact flash mngmd Linux - Hardware 2 11-18-2005 09:57 PM
Compact Flash Reader wildwingman Linux - Hardware 1 06-15-2005 12:06 PM
mounting compact flash Jeebizz Slackware 5 03-19-2005 03:09 AM
Linux on a Compact Flash ducksew Linux - General 7 11-23-2004 03:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration