Tiny Core Linux
Tiny Core Base => Raspberry Pi => Topic started by: xuraax on March 19, 2022, 07:41:17 AM
-
I am running a program in Python which needs to save data permanently to the SD card. I am using the normal Python file operations which saves data to a ram file.
What is the recommended method of saving permanently to disk?
Thanks
Xuraax
-
Just specify a persistent location to save the data. Like add a USB drive, or create a separate partition on your SD card.
-
if you want to save to your sd card then:
sudo mount /dev/mmcblk0p1 /mnt/mmcblk0p1
then you have the fat32 partition of the sd card which you can write files to using your python program
or
sudo mount /dev/mmcblk0p2 /mnt/mmcblk0p2
which will mount the ext4 partition instead, there you save files to linux filesystem, less supported so you can't just plug it into windows or mac without special programs that read the partition.
However if you have a linux desktop, this should be no issue.
-
@mbivol10,
Thanks for your reply.
I, more or less, arrived at the same setup you proposed except I created a third partition to keep my saved files separate.
Furthermore for python to be allowed to save files to this drive I had to change permissions for this drive using chmod 777.
Regards
xuraax