Backup data to Pendrive with c program
by Nishanth1829 from LinuxQuestions.org on (#5C2HE)
Hi all,
I am using a GTK C program in my embedded linux device. I need to backup a folder from my internal memory to pendrive when a button is clicked on the UI. While this, the pendrive is getting mounted as /dev/sda1 and I able to copy files to the /dev/sda1 and after this write cycle from my program, the pendrive volume becomes busy and I am unable to eject it. So when I remove and insert the pendrive, it is getting detected as /dev/sdb1. As the mount location is changing dynamically, I am stuck on how to write my files to pendrive from GTK C program. I am using libudev for pendrive insertion and removal detection.
Is my way correct? If not kindly help me with how to copy a folder from internal memory to pendrive without making the volume busy.
Thanks for your time.
Regards,
Nishanth


I am using a GTK C program in my embedded linux device. I need to backup a folder from my internal memory to pendrive when a button is clicked on the UI. While this, the pendrive is getting mounted as /dev/sda1 and I able to copy files to the /dev/sda1 and after this write cycle from my program, the pendrive volume becomes busy and I am unable to eject it. So when I remove and insert the pendrive, it is getting detected as /dev/sdb1. As the mount location is changing dynamically, I am stuck on how to write my files to pendrive from GTK C program. I am using libudev for pendrive insertion and removal detection.
Is my way correct? If not kindly help me with how to copy a folder from internal memory to pendrive without making the volume busy.
Thanks for your time.
Regards,
Nishanth