3

This is a question about feasibility so please bear with me.

I'm going to Thailand for 4 weeks and I plan to bring my camera along. Now my SD card has only 16 GB of storage and I was thinking about a possibility to backup the pictures on the card with a raspberry pi.

Following would be the setup:

  • There would be no monitor or input device connected to the RPi
  • I bring along the SD card with the OS on it, a SD card reader (that can be connected via USB) and the power supply

So I have the RPi and start it plugging it to the power supply.

After booting up, what I would want to happen is as soon as I plug in the SD card reader which contains my SD from my camera, a program (that started with the OS) realizes there is this new external device and moves the whole content from the SD card to a USB drive/stick.

I hope you can follow me - I appreciate any input. And sorry about the tags, not sure what I should put there.

closed as unclear what you're asking by Piotr Kula, Butters, lenik, syb0rg, nc4pk Aug 19 '13 at 0:36

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    PLease edit your question and ask a specific question. What you ask is possible. But what have you done so far and what technical problems have you run into. The format on this site is to ask a specific question. Discussions are not allowed (frowned upon) unless in the chat room. WThanks for letting us know about your trip but it does not constitute to a good question. Please ask something specific. I suggest taking a netbook along and syncing your photos online and to a hard drive. Once synced online nobody can steal or destroy them. – Piotr Kula Aug 8 '13 at 11:49
  • 3
    You would be much better off looking for a cheap android device that has SD and USB, or a netbook. While what you want to do is certainly possible, if something goes wrong you will all of a sudden need a screen and keyboard and time and know-how. It is EXTREMELY optimistic to assume that will not happen with a prototype device (by "prototype" I mean the combination of the pi with your custom software); I'm guessing you are also totally new to the pi. A netbook or a tablet, OTOH, should be very reliable for this and may have other uses besides, since it includes screen and input. – goldilocks Aug 8 '13 at 12:32
  • Take the SB from your Pi, and use it in your camera. That way you'll have more storage :-). Otherwise look at udev to automount the SD-card reader and USB-storage device, and run you custom script for transferring the images. For transfer I'd use rsync. rsync will skip if an image already exists (and by default leaves file on the usb-storage, even if the original file has been removed from the cameras-SD. – Gerben Aug 8 '13 at 17:48
  • This seems like it does what you are asking for:petapixel.com/2016/06/16/… – Riley Apr 6 '17 at 18:55
2

It is possible, of course, you can make a program/script and a always consider that when you boot you will immediately mount the SD card and the USB stick, then you will copy all the photos from the card to the stick.

Of course there are some issues. You will have to find a way to tell you if there are any errors, if the process goes on ok. You can always take a HDMI cable with you and try to find a TV somewhere to plug your Pi and follow the procedure on screen, or you can make a simple LED status system connected directly to the GPIO that will flash a red LED if something goes wrong, and a green one if all worked fine.

How should be that script? First try to mount both the stick and the card, and flash the green LED if you get a positive result to both mounts. Your devices when the kernel boots will most likely be the same from boot to boot, if nothing else changes. So connect them and find out which devices appear. Start your script by mounting them both and examining the error codes of mount (check the manual). Output your GPIO connected LED with a single green flash. (There are some tutorials on how to connect a LED to the Pi online).

Second step you make an inventory of all the pictures in the card and save their names to a file. All the cameras I know name files sequentially, they do not repeat a name if you don't manually reset the counter. Check if your camera is like this to make sure, that should work on your favor.

You can create a new directory on the stick with the current date (even if a offline Pi will not have the correct date, it will provide you with a unique answer, and sequential), or just copy the new files to a unique directory, given that there shouldn't be repeated names.

Once you copy all the files, check for the command's error code and see if it was successful or not. I would not recommend a -y or force, given the value of the data you have, you should manually inspect in case of any errors. Flash the green LED twice if no error was reported. Make the red LED solid if there was some error code that was not success.

Third and last step: compare the manifest you made when the script started and check if every file on that list exists on the destination directory on the USB stick. You can even make some MD5 or CRC test to make sure that there was no corruption in the process, but that will take a while to check. Nothing that a good night of sleep while your Pi works won't solve (I think! Check your timing if you want to ado that!).

If all files are checked according to the manifest, make the green LED solid and enjoy! I don't recommend your script formatting or erasing the card, just do that on the camera manually after the green solid LED.

You can always create a cumulative manifest file and check it at boot time, to make sure nothing happened to your stick while you slept. :)

  • 1
    Nice theory lesson ... – Piotr Kula Aug 8 '13 at 11:52
  • 1
    I am sorry I tried to help. – Marco Poli Aug 8 '13 at 11:56
  • 2
    True. But please consider making your answers a bit more practical and format them a bit better. It is really difficult to read such a long monolithic piece of text without any references, pictures, indentation or anything... if you do that I can give u +1 for effort on a hopeless question. – Piotr Kula Aug 8 '13 at 11:58
  • Wow! Thanks for the answer! And for what it's worth, I don't mind 'lengthy' answers :) – Philipp Aug 9 '13 at 13:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.