Copy encrypted compact flash issues with dd in ubuntu
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
OK, back to the beginning. These commands are correct.
Quote:
Originally Posted by solojayda3rd
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.
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
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.
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?
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.
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.
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
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.
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
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.