Cloning an SD card with only one SD slot on computer

I have a cpap machine which writes all of its data on a 2GB SD card. I'm fairly possessive about my data, and don't like having the card out of my machine for longer than it takes to download the data each morning. Periodically the doctor wants me to bring the disk in so that they can look over the data, so I would like to be able to make a clone of the card so that I don't have to worry about them losing it, or inserting it in a Windows 8 computer when it's not write-protected. (In a particularly anti-social-even-for-microsoft move, win8 writes files on the card and then the cpap machine will not use it without reformatting the disk.)


I have been using Disk Utility -> New Image to make backups of the disk on my laptop, but that has a bunch of options and I'm not sure that I am selecting the right one anyway. If I had one of those usb sd card readers, then I would use the disk utility copy command with one sd card in the reader and one ad card in the computer's sd slot, but that seems rather silly -- presumably you can do a clone by making an image of the source disk, popping it out, and then restoring the image to a new disk. And that has the added benefit of leaving a backup on the computer, too.


If that's the right way to do it, can anyone tell me --

1) What's the right format/options to select in Disk Utility -> New Image?

2) What's the procedure for restoring that file to the new disk?


Or, if Disk Utility is not the right tool, can someone explain some other tool for doing the job?

Posted on Nov 22, 2014 12:27 PM

Reply
9 replies

Nov 27, 2014 8:52 AM in response to cathy fasano

If you followed the instructions from Nils, you should now have an image file which is a copy of the original card.

You should be able to reverse the process to copy the image file onto a new blank SD card. Be sure that you are not

doing this until after you have put the new SD card into the Mac. This will destroy the contents of whatever card is mounted.

*Replace cpap-sd-20141125.img with the most recent filename that you want to restore to the new SD Card.


1) /usr/sbin/diskutil unmountDisk /dev/disk3

2) sudo /bin/dd if=~/cpap-backup-dir/cpap-sd-20141125.img of=/dev/disk3 bs=4m

3) /usr/sbin/diskutil eject /dev/disk3


* Something else worth considering. Most SD Cards have a write protect switch on them. When in the Locked position, the card should be protected from Dr. Disk Mangler's PC. You would need to ensure that the switch is returned to the unlocked position before re-inserting into your CPAP.


locking_and_unlocking_sd_card.jpg

Nov 24, 2014 9:40 AM in response to VikingOSX

VikingOSX wrote:


Why are you downloading data from the CPAP data card each morning? Geez.


Because I have RERA and am still trying to fine-tune my settings to get the number of arousals down to something that doesn't leave me totally punked all of the time. Thursday night I woke up 15 times, and the longest I was asleep was 1hr 42min, even though my AHI was only 0.5. The only way that I know what happened is that I read my card and analyzed it in Sleepyhead. Which is excellent software that runs on macs, unix and windows.


VikingOSX wrote:


My SD card stays in the CPAP on six month cycles — the frequency requested by the respiratory team that downloads/plots the data to their specialized equipment/software. In 3 years, no data has ever been lost by leaving the card in the machine, or any apnea episodes recorded.

You would be an unusually lucky patient if the "respiratory team" cares about ANYTHING other than your hours of use, which have to be above a certain level or the insurance company won't pay. As long as you don't take your mask off, you count as "compliant" -- even if the reason that you didn't take your mask off is that you had a heart attack and died in your sleep. As in you couldn't take the mask off because you were dead.


Their "specialized software" is ResScan, which totally *****, and only runs on windoze. The latest version of Windows 8 will corrupt the card unless you slide the write-protect tab on. So it's really plausible that the exact machine that they need to run the software will be the machine that corrupts the card.

VikingOSX wrote:


...or any apnea episodes recorded.

Everyone has a couple of apneas here or there, they are normal, especially if you are awake, and a cpap machine cannot detect whether you are asleep or not. If they tell you that you never had ANY apneas over six months, then one of three things is true:

  1. Your machine is a brick and the only thing that it is recording is how much time you spent with it strapped on. It could have worthless settings on it and not be working at all for your medical condition and you could be having apneas all night. You would have no way of knowing how much damage was being done to your body until you had a stroke or heart attack.
  2. The "respiratory team" is lying to you when they tell you that there are no events, or more likely, they are lying when they say they checked your data for events and they just don't know.
  3. You are actually dead and just haven't noticed. (Did you vote in Chicago in the last election?)


VikingOSX wrote:


...the CPAP could potentially stop working if the data fails a CRC check when the CPAP machine restarts. If you have ever had a machine fail over some spurious error code, you know how tired you get before a machine replacement happens.


Which is PRECISELY what I am worried about happening. If I take my one-and-only data card to my doctor, and they twiddle with the write-protect tab and put it in a win8 machine with it writeable, then their stupid windows computer WILL corrupt my one-and-only data card. I'm concerned about the card simply failing, too -- I've been a sysadmin for 34 years and I know that all media eventually wears out, and cheap media (like sd cards) is more likely to fail long before it should.

Nov 22, 2014 2:15 PM in response to cathy fasano

It sounds like you are using the wrong "New Image". If you just insert the card, the volume should show up in the left hand pane of Disk Utility. Select it. Then click on the "New Image" button in the toolbar. That will bring up a dialog with only a couple of options. You can just click "Save" to accept the defaults and create a disk image. The only option you might want to change would be encryption.


If you don't need a 100% pure clone, you can alway hold down the option key while dragging the mounted SD disk on the desktop. That will make a copy of all of the contents.

Nov 22, 2014 2:49 PM in response to cathy fasano

Cathy,


Why are you downloading data from the CPAP data card each morning? Geez.


My SD card stays in the CPAP on six month cycles — the frequency requested by the respiratory team that downloads/plots the data to their specialized equipment/software. In 3 years, no data has ever been lost by leaving the card in the machine, or any apnea episodes recorded.


In my Resmed machine, the data card is formatted FAT-16, not the FAT-32 supported by Disk Utility. The proprietary documents on this drive use CRC (Cyclic Redundancy Check) error checking (file extensions are .crc).


Although you can get the data off your card into a FAT-32 .dmg folder, I would advise against writing data back to the SD card, as the CPAP could potentially stop working if the data fails a CRC check when the CPAP machine restarts. If you have ever had a machine fail over some spurious error code, you know how tired you get before a machine replacement happens.

Nov 25, 2014 7:47 PM in response to cathy fasano

I would use the dd(1) from the Terminal.app.


This is to create a directory to store the files to. And would only need to be created once, assuming that you

don't already have a place to stash the files. On my system, the SD chip is device /dev/disk3




The following command would, 1) unmount all the filesystem on the SD card. 2) clone the SD card. And 3) ejects the

SD card, so that it can be removed.


Change "~/cpap-backup-dir", to the directory where you want to save the output file too.


1) /usr/sbin/diskutil unmountDisk /dev/disk3

2) sudo /bin/dd if=/dev/disk3 bs=4m of=~/cpap-backup-dir/cpap-sd-$(date +%Y%m%d).img

3) /usr/sbin/diskutil eject /dev/disk3


the image file will have a name that looks like ' cpap-sd-20141125.img', which has the Year, Month, and Day encoded into the filename.

Nov 27, 2014 7:16 PM in response to tmclink

see tmclink's guidance above, on how to restore the cloned image back to the SD card. As he noted, make sure that you have a new or scratch SD card inserted, before you run the 'dd' command to restore the image. You should also, check the output from 'diskutil list' to make sure that the /dev/disk3, is actually the SD card, and not point to another device, that you don't want to overwrite. Like a thumb drive or a hard drive.


There is a chance that you would get a error when running "distill umountDisk /dev/disk3" , if the new SD card doesn't have a filesystem on it. Since nothing is mounted.


Regards,


Nils

Nov 27, 2014 7:38 PM in response to tmclink

tmclink wrote:

Most SD Cards have a write protect switch on them. When in the Locked position, the card should be protected from Dr. Disk Mangler's PC. You would need to ensure that the switch is returned to the unlocked position before re-inserting into your CPAP.


Yep, I always write-lock the disk before putting it into the computer, and the cpap machine complains if I put it back locked. I've just been a sysadmin long enough to totally expect the scenario where I write lock the disk, hand it over, they slide the switch back and unlock it, and stick it into the computer. (Because the clerk doesn't understand what he/she is doing, and has been trained to slide the tab...)


Always expect the worst, then you can sometimes be pleasantly surprised is my motto!

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Cloning an SD card with only one SD slot on computer

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.