LinuxQuestions.org
Review your favorite Linux distribution.
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 06-01-2015, 11:43 PM   #16
solojayda3rd
Member
 
Registered: Jun 2015
Posts: 32

Original Poster
Rep: Reputation: Disabled

Ok, issue with the umount was me. I wasn't putting a space between umount and /dev. Here's my next issue, I'm not sure i'm doing the dd correctly. Am I supposed to mount my first card before i copy it to my hard drive? Also when i use df -h it shows my cf card as sde1. Should my dd to my hard drive say sudo dd if=/dev/sde or sde1? and also for the dd to my new blank cf Should it say sudo dd of=/dev/sde or sde1? I ask because when i finally did the umount it wouldn't umount sde. It would say /dev/sde wasn't mounted. But when i did umount /dev/sde1 it unmounted. It's all a little confusing to me, but to restate, i'm just trying to make an exact copy of a cf card to another cf card, and somehow this machine knows i'm not using the original card. thanks.
 
Old 06-02-2015, 01:54 AM   #17
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,104

Rep: Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267
You can check what was mounted using the command mount. You can umount only those filesystems. Usually that would be /dev/sde1, but sometimes /dev/sde can be valid too. You need to check it.
for dd:
if you want to copy the content of the device use if=/dev/sde, if you need only a partition use if=/dev/sde1 or similar. But again, it depends on how that card was formatted.

Last edited by pan64; 06-02-2015 at 01:55 AM.
 
1 members found this post helpful.
Old 06-02-2015, 01:59 AM   #18
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,832

Rep: Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820
OK, back to the beginning. These commands are correct.
Quote:
Originally Posted by solojayda3rd View Post
sudo dd if=/dev/sde of=/home/folder/cfcard

then to copy from my hard drive to the blank cf:

sudo dd if=/home/folder/cfcard of=/dev/sde
Nothing should be mounted on the CF card - nothing in /dev/sde[1-9]. You can't normally mount or unmount a device node (/dev/sde) - especially if partitions exist on it.
Personally I would alter the final command as follows - it forces the writes to the CF immediately rather than queuing them - saves worying about if it's finally finished or not.
Code:
sudo dd if=/home/folder/cfcard of=/dev/sde oflag=sync
 
1 members found this post helpful.
Old 06-02-2015, 02:14 AM   #19
solojayda3rd
Member
 
Registered: Jun 2015
Posts: 32

Original Poster
Rep: Reputation: Disabled
ok cool i'll give that one a try. The reason i was asking about the whole process again is that I'm making sure I copied to my hard drive correctly to begin with. Otherwise i'm basically trying different ways to copy a flawed copy to a blank card. If what i wrote seems like a good method (because i'm just following what i've seen) then i'll keep trying to figure out what's wrong with my final steps. I'm thinking about buying another card reader so i can skip the middle step and go card to card, if that would eliminate a possibly erroneous step...anyone let me know if that makes sense. Thanks
 
Old 06-02-2015, 02:39 AM   #20
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,104

Rep: Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267
no, that would not eliminate your problem. Your original problem was you removed the device before the writing process was completed. You can force to complete it by:
1. using the flag suggested by syg00: oflag=sync
2. manually umount that device (or eject it)
3. execute the command sync (as root).
(obviously wait as long as the commands completed and afterward you can remove the card.
 
1 members found this post helpful.
Old 06-02-2015, 03:06 AM   #21
solojayda3rd
Member
 
Registered: Jun 2015
Posts: 32

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
no, that would not eliminate your problem. Your original problem was you removed the device before the writing process was completed. You can force to complete it by:
1. using the flag suggested by syg00: oflag=sync
2. manually umount that device (or eject it)
3. execute the command sync (as root).
(obviously wait as long as the commands completed and afterward you can remove the card.
Hey, not sure if that's a list to follow in order or 3 different options. I'm doing the first step right now in my ubuntu virtual machine. I'm also thinking maybe I took out the card prematurely when i copied it to my hard drive because i just waited for the bar to stop blinking and for it to say virtualmachin:~$ and unplugged it. Right now that machine is not in use i can grab that cf and re-copy it to my hard drive again just to be safe. i haven't read about the flag=sync yet, so i'll ask, if i do copy the good card again should my command look like this?

sudo dd if=/dev/sde of=/home/folder/cfcard oflag=sync
 
Old 06-02-2015, 03:16 AM   #22
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,832

Rep: Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820
Yes.

pan64 was giving you options. Pick one.
 
1 members found this post helpful.
Old 06-02-2015, 03:18 AM   #23
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,104

Rep: Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267
that is not flag, but oflag. All the 3 options make the same thing, forces to write the data from the buffers onto the device (flush buffers).
sudo dd if=/dev/sde of=/home/folder/cfcard oflag=sync
is ok.
 
1 members found this post helpful.
Old 06-02-2015, 03:49 AM   #24
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,599

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
Before you use dd to copy the device, use df only to identify the two device names.

THEN dismount both (though dismounting the source shouldn't make a difference) and use dd to copy.

The problem with using dd to copy a device to a second device while that second device is mounted is that the system holds filesystem information in memory (which may be empty). ejecting/dismounting will corrupt the result of the copy and the final device may be totally unusable.
 
Old 06-02-2015, 04:24 AM   #25
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,104

Rep: Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267
my god, yes, you should umount before dd, so option 2 is not ok.
 
Old 06-02-2015, 04:46 AM   #26
solojayda3rd
Member
 
Registered: Jun 2015
Posts: 32

Original Poster
Rep: Reputation: Disabled
ok, i think i follow what was just said, but to be sure i'm going to state what i did. I used optioned 1. I never used df since the system keeps calling my cf "sde". I entered the command

sudo dd if=/dev/sde of=/home/folder/cfcard oflag=sync

then just pulled out the cf card since syg00 said "Personally I would alter the final command as follows - it forces the writes to the CF immediately rather than queuing them - saves worying about if it's finally finished or not.

and now i plan to use the command

sudo dd if=/home/folder/cfcard of=/dev/sde oflag=sync

to copy to my blank card. Though i've been meaning to ask since i only have a couple of spare cf cards. Was there some sort of formatting i needed to do before i copy to a card if there was already something on it? I haven't because i thought dd just copies over whatever was on the card. Thanks for all the patience, i'm no where close to a programmer and i'm learning everything i need to know just to accomplish this task. So feel free to talk to me like a child, because the language goes over my head real quick. Thanks
 
Old 06-02-2015, 04:48 AM   #27
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,104

Rep: Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267
dd will destroy anything on that card, so you do not need to format/prepare.
 
1 members found this post helpful.
Old 06-02-2015, 05:08 AM   #28
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,380

Rep: Reputation: 353Reputation: 353Reputation: 353Reputation: 353
Maybe it simply checks the serial number of the card?
 
2 members found this post helpful.
Old 06-02-2015, 07:50 AM   #29
JeremyBoden
Member
 
Registered: Nov 2011
Posts: 937

Rep: Reputation: 174Reputation: 174
You could try copying two different cards to separate disk files & do a md5 check to see if they are same or different.
You could also try the same with your newly created card to check that you have a match.
 
1 members found this post helpful.
Old 06-02-2015, 10:02 AM   #30
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,599

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
It depends on how the licensing works. It is likely that the two cards have different license keys.
 
1 members found this post helpful.
  


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
How do you duplicate a 512 Meg Compact flash to a 1 GB compact flash using dd??? allen00860 Linux - Newbie 5 05-23-2009 09:48 PM
Installing Ubuntu Server on a Compact Flash Card haroldjclements Linux - Newbie 1 05-15-2008 02:57 AM
FFS partition on Compact Flash card - how to copy ??? rkaluzinski Linux - General 0 02-24-2006 04:48 PM
Make an exact copy of a compact flash card Pimple Linux - General 8 02-01-2006 12:37 PM
Exact Copy of Compact Flash Card Onyx^ Linux - Software 1 09-01-2004 05:30 AM


All times are GMT -5. The time now is 05:54 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration