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.
I want to write a script in Bash that will automatically backup my RAW photos from an SD card to an external USB drive via a Raspberry Pi. I intend to use it when on holiday to backup photos without having to take my laptop with me.
What I'm attempting to do is power up the Pi, plug in my cameras SD card via a USB/SD card reader, then plug in a 320GB USB HD and then get the script to mount the SD card & HD then rsync files from the SD card to the HD.
I know how to mount both devices and do the rsync. However I'm unsure as how to get the Pi to correctly identify the SD card from the 320GB HD.
I guess that if I plug the SD card in first it will get mounted as sda1, then the second device, the HD, will mount as sda2? So I could cron a script to rsync from sda1 to sda2 every 5 mins. However this seems dangerous as it may copy in the wrong direction.
Is there a simple way to ensure it will always copy from the SD to the HD?
I want to write a script in Bash that will automatically backup my RAW photos from an SD card to an external USB drive via a Raspberry Pi. I intend to use it when on holiday to backup photos without having to take my laptop with me.
What I'm attempting to do is power up the Pi, plug in my cameras SD card via a USB/SD card reader, then plug in a 320GB USB HD and then get the script to mount the SD card & HD then rsync files from the SD card to the HD.
I know how to mount both devices and do the rsync. However I'm unsure as how to get the Pi to correctly identify the SD card from the 320GB HD.
I guess that if I plug the SD card in first it will get mounted as sda1, then the second device, the HD, will mount as sda2? So I could cron a script to rsync from sda1 to sda2 every 5 mins. However this seems dangerous as it may copy in the wrong direction.
Is there a simple way to ensure it will always copy from the SD to the HD?
Man thanks for any help.
I found out that if I use the following:
Code:
lsblk -f -e 11 | grep EOS_DIGITAL
It returns
Code:
└─sda1 vfat EOS_DIGITAL 1368-0838
So I can see that the Canon EOS_Digital SD card is on sda1. I now need to isolate that first part of the line. I thought I could awk the drive out of that line using:
I guess that if I plug the SD card in first it will get mounted as sda1, then the second device, the HD, will mount as sda2?
No, the second "device" would be sdb or sdc or something else, depending upon how many devices are attached. The sda is the device and sda1 is the partition on the device.
One autonomous method would be to plug the drives into the Pi before you power it up. An @boot cron job would check to see if the both the card reader and drive was plugged and then copy the files.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.