USB flash drive - how to check mnt directory Topic is solved

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
somenrs
Posts: 11
Joined: Fri Jul 03, 2020 11:08 am

USB flash drive - how to check mnt directory

Post by somenrs »

Hi all.

I am a noob when it comes to Linux so please keep that in mind.
I'm working on a project that reads sensor data from 6 accelerometers using RPi 4B running DietPi and a custom C program. Right now I'm storing data on SD card. What I want is for the end user to get data on his Windows PC as easily as possible so I was thinking of saving data as it gets recorded to USB flash drive (as txt file). End user wants a simple procedure: record data on a flash drive, import it to Matlab, do analysis.
I am thinking of 2 ways how could this be done but I don't have the knowledge (yet) to implement it into my project:

1.) In C program do a function that checks if flash drive is inserted and then stores data on a flash drive which is FAT/NTFS formatted. There are 2 issues here: I don't know how to check if flash drive is inserted on Linux in C and second can I save data to FAT/NTFS formatted flash drive?

2.) Write a script that copies previous file to the flash drive when new file is created.

Any pointers would be helpful.
User avatar
Joulinar
Posts: 2072
Joined: Sat Nov 16, 2019 12:49 am

Re: USB flash drive - how to check mnt directory

Post by Joulinar »

Hi,

many thanks for your request. Does this RPi4B is connected to a network? Is it accessible from the windows clients?
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
somenrs
Posts: 11
Joined: Fri Jul 03, 2020 11:08 am

Re: USB flash drive - how to check mnt directory

Post by somenrs »

No, it will be used outdoors without option of any network. I'm kind of using that now in the lab as I program rpi over ssh and I'm constantly downloading files to my laptop. Flash drive is also preferred option by end user.
User avatar
Joulinar
Posts: 2072
Joined: Sat Nov 16, 2019 12:49 am

Re: USB flash drive - how to check mnt directory

Post by Joulinar »

Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
somenrs
Posts: 11
Joined: Fri Jul 03, 2020 11:08 am

Re: USB flash drive - how to check mnt directory

Post by somenrs »

I tried this method and it works for my needs:
https://www.raspberrypi.org/documentati ... storage.md
Post Reply