aaronnguyen / osid-python3

Open Source Image Duplicator - Python
GNU General Public License v3.0
33 stars 9 forks source link

Fresh SD Cards Not Read #9

Open mistrgrieve opened 4 years ago

mistrgrieve commented 4 years ago

When using a fresh SD card, the software does not acknowledge them unless you first format them. Is there a way to set the software to image brand new SD cards? I started writing a python script to do this, but I'm having trouble.

aaronnguyen commented 4 years ago

Could try to list all the devices in "/dev" then capture only /dev/sd* listings. (/dev/sda, /dev/sdb, /dev/sdc). But then after that validate that they are sd cards somehow.

Never ran into that issue before. let me see if I can replicate it. And I'll test a few things out. Let me know if you come up with a solution and if we can add it.

mistrgrieve commented 4 years ago

It's funny you should mention that. I started coding exactly what you suggested and got really close to making it work on friday, but some other things came up and I haven't had a chance to finish it. I'll see if I can finish it this week. I'm also thinking about turning this into a snap if you dont mind. Have you looked into snaps at all? I just converted code for one of my devices at work into a snap and it makes things so much easier.

On Mon, Sep 16, 2019, 7:26 PM Aaron Nguyen notifications@github.com wrote:

Could try to list all the devices in "/dev" then capture only /dev/sd* listings. (/dev/sda, /dev/sdb, /dev/sdc). But then after that validate that they are sd cards somehow.

Never ran into that issue before. let me see if I can replicate it. And I'll test a few things out. Let me know if you come up with a solution and if we can add it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/aaronnguyen/osid-python3/issues/9?email_source=notifications&email_token=AL56ETYPZML4OVUG2FVDUSDQKAI3DA5CNFSM4IVZPZJKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD62Z23Y#issuecomment-531996015, or mute the thread https://github.com/notifications/unsubscribe-auth/AL56ETZAHEQRQ7R2XCA6UVTQKAI3DANCNFSM4IVZPZJA .

aaronnguyen commented 4 years ago

listing all devices in /dev then looking for devices didn't seem very effective. 'sudo fdisk -l' did work for me though (l being lowercase L). The backend should have started with the su crontab, so there shouldn't be any issues with root access. (hopefully)

on the snap side note, you can fork the code and port to whatever you want. I don't mind at all! I have not heard of snap, just did a quick search, looks like scratch? Would love to see how that project turns out!

aaronnguyen commented 4 years ago

Note: found a solution in this question https://codereview.stackexchange.com/questions/152486/parsing-the-lsblk-output

using lsblk might be better, no root access needed. and can display just the disk names and size with the command "lsblk -d -o name,size -n". Will list the mmcblk0 (rpi disk) so will just have it ignore it.