LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > *BSD
User Name
Password
*BSD This forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.

Notices


Reply
  Search this Thread
Old 02-11-2009, 11:20 AM   #1
doxJeremy
LQ Newbie
 
Registered: Feb 2009
Posts: 5

Rep: Reputation: 0
duplicate CF card using dd


Hello everybody,
I have a CF card with NetBSD installed on it that I need to duplicate. I have a linux box with one external USB CF card reader that I'm using to put the image on the hard drive using dd. Then I put that image on the new CF card. The problem is when I boot from the new CF card the NetBSD bootloader starts, but then the computer reboots. It cycles like this 4-5 times then the computer tells me there's no bootable disk available. Here's my dd commands:

From CF card to hard drive:
Code:
dd if=/dev/sdc of=cf_card
From hard drive to new CF card:
Code:
dd if=cf_card of=/dev/sdc
I've tried this several times and I'm getting the same results. Shouldn't dd work for my purpose? The original CF card works just fine when booting from it. Is my dd command somehow wrong?

Thanks!
 
Old 02-12-2009, 05:03 PM   #2
clvic
Member
 
Registered: Feb 2008
Location: Rome, Italy
Distribution: OpenSuSE 11.x, vectorlinux, slax, Sabayon
Posts: 206
Blog Entries: 2

Rep: Reputation: 45
Are you sure that the name of the device is /dev/sdc both the first time you insert a card and the second time? I mean, I suspect that when you copy from the first card to the hard disk, the card device name is /dev/sdc. Maybe when you insert the second card, its name becomes /dev/sdd
Can you verify this?
 
Old 02-12-2009, 06:46 PM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
See if you can mount the cf_card file using a loop device. If it has a partition on it, you could try adding an offset of 63*512 bytes for the first partition. This is just to verify that the filesystem on the file is OK.

Code:
sudo /sbin/losetup -fs cf_card -o $((63*512))
sudo mount -t <vfat?> /dev/loop0 /mnt/<mountpoint>

file cf_card
sudo file -s /dev/loop0
Some cards don't have a partition, and you mount them using the disk device instead. I.E. /dev/sdc instead of /dev/sdc1.

Perhaps the data wasn't entirely flushed to the card before you ejected it. After creating the copy, try mounting it and then running "sync". Then run "eject". Don't remove or reboot until you know that the filesystem is OK. Also look at the device used for the card using "sudo file -s /dev/sdc"

Use "sudo /sbin/fdisk -l" and "udevinfo -q env -n /dev/sdc" to double check that the device nodes haven't changed.
Since it is a clone, the filesystem on the new cf card will have the same UUID number.

I'm not familiar enough with BSD to know what kind of filesystem is on the card, but I'm sure it is something that Linux understands. Eject and reinsert the card and double check that it is bootable, "sudo file -s /dev/sdc" and that the partition is mountable.

Last edited by jschiwal; 02-12-2009 at 06:49 PM.
 
Old 02-13-2009, 04:51 PM   #4
doxJeremy
LQ Newbie
 
Registered: Feb 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Thank you for your replies!

Quote:
Are you sure that the name of the device is /dev/sdc both the first time you insert a card and the second time? I mean, I suspect that when you copy from the first card to the hard disk, the card device name is /dev/sdc. Maybe when you insert the second card, its name becomes /dev/sdd
Can you verify this?
Both of them are /dev/sdc

@jschiwal:
Mounted image using loop device and verified the filesystem is ok.

file cf_card resulted in:
cf_card: x86 boot sector; partition 1: ID=0xa9, active, starthead 1, startsector 63, 8027649 sectors

sudo file -s /dev/loop0:
/dev/loop0: Unix Fast File system [v1] (little-endian), last mounted on /, last written at Thu Oct 30 12:06:58 2008, clean flag 255, number of blocks 1940904, number of data blocks 1910655, number of cylinder groups 21, block size 16384, fragment size 2048, minimum percentage of free blocks 5, rotational delay 0ms, disk rotational speed 60rps, TIME optimization

I don't have time right now to do the other things you suggested, but I'll try them and let you know in the next few days.

Thank you guys again for your replies.
 
Old 02-16-2009, 02:11 PM   #5
doxJeremy
LQ Newbie
 
Registered: Feb 2009
Posts: 5

Original Poster
Rep: Reputation: 0
I used /dev/sdc1 for the device. /dev/sdc won't even mount. The devices listed are /dev/sdc, /dev/sdc1, /dev/sdc5 and /dev/sdc6. The fdisk and udevinfo commands on both cards have identical output. But,

on the source card:
Code:
linux-j368:/mnt # file -s /dev/sdc1
/dev/sdc1: Unix Fast File system [v1] (little-endian), last mounted on /, last written at Thu Oct 30 12:06:58 2008, clean flag 1, number of blocks 1940904, number of data blocks 1910655, number of cylinder groups 21, block size 16384, fragment size 2048, minimum percentage of free blocks 5, rotational delay 0ms, disk rotational speed 60rps, TIME optimization
on the destination card:
Code:
linux-j368:/mnt # file -s /dev/sdc1
/dev/sdc1: Unix Fast File system [v1] (little-endian), last mounted on /, last written at Thu Oct 30 12:06:58 2008, clean flag 255, number of blocks 1940904, number of data blocks 1910655, number of cylinder groups 21, block size 16384, fragment size 2048, minimum percentage of free blocks 5, rotational delay 0ms, disk rotational speed 60rps, TIME optimization
Notice the "clean flag" number, the source card is 1 and the destination card is 255. Does that make a difference?
 
Old 02-27-2009, 04:53 AM   #6
alex2002
LQ Newbie
 
Registered: Mar 2004
Posts: 29

Rep: Reputation: 15
problem to clone cf

I have the exact problem. Did you solve it?

regards
alex
 
Old 02-27-2009, 03:41 PM   #7
doxJeremy
LQ Newbie
 
Registered: Feb 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Yes! I finally did! About 5 min ago.

I ended up using two IDE to CompactFlash adapters to do the transfer directly. I just used dd to copy the image from the source card to the destination card (both unmounted of course).
 
Old 03-02-2009, 01:01 AM   #8
alex2002
LQ Newbie
 
Registered: Mar 2004
Posts: 29

Rep: Reputation: 15
I did the same thing, but no success!? I want to copy from cf 128Mb to cf 4Gb. Data on 4Gb is ok, but the OS won't boot.

regards
Alex
 
Old 03-02-2009, 11:30 AM   #9
doxJeremy
LQ Newbie
 
Registered: Feb 2009
Posts: 5

Original Poster
Rep: Reputation: 0
I used two identical cf cards, same size and all. You could try creating a partition on the 4 gb cf card and just copy the image to that partition.

this post might be helpful:
http://www.linuxquestions.org/questi...ommand-362506/
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
what is the Duplicate packet? saman123 Linux - Networking 1 09-26-2007 12:08 AM
Duplicate sources skeletonca Linux - General 3 05-10-2007 06:37 AM
Duplicate Mail makko Linux - Software 3 03-03-2005 08:07 AM
I have one system, can I duplicate it? ForumKid Linux - General 3 10-13-2002 08:20 AM
fping says > duplicate for [0] saavik Linux - Networking 2 09-30-2002 01:24 AM

LinuxQuestions.org > Forums > Other *NIX Forums > *BSD

All times are GMT -5. The time now is 04:27 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