Mwright
Posts: 3
Joined: Tue Jan 31, 2017 5:39 pm

Pi micro SD card as removable storage

Fri Apr 07, 2017 3:39 pm

Is it possible to use the micro sd card on the raspberry pi zero for removable storage for files I'm saving on the pi?

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 6957
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.

Re: Pi micro SD card as removable storage

Fri Apr 07, 2017 3:47 pm

Mwright wrote:Is it possible to use the micro sd card on the raspberry pi zero for removable storage for files I'm saving on the pi?
Can you clarify what you mean by "removable storage"? - for example, if you want to remove the card whilst the Pi is powered and running then the answer's No. However, if you remove the card after the Pi has been shutdown cleanly and powered off, transfer it to another (Linux) computer (eg. a card reader in another Pi) then the answer's Yes, it's possible, but you need to know where to find the files.
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B, B+, and a A+) but Buster on the P3B+, P4B's & P400. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

User avatar
DougieLawson
Posts: 42232
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK

Re: Pi micro SD card as removable storage

Fri Apr 07, 2017 3:49 pm

Only if your RPi isn't booted from it. (Which is possible on an RPi3B, CM3 and RPi2B2.) If you pull the root filesystem that would be like pulling the harddrive from your laptop while you're using it.

It's much easier to use a plain old USB stick.
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

Mwright
Posts: 3
Joined: Tue Jan 31, 2017 5:39 pm

Re: Pi micro SD card as removable storage

Fri Apr 07, 2017 5:26 pm

FTrevorGowen wrote:
Mwright wrote:Is it possible to use the micro sd card on the raspberry pi zero for removable storage for files I'm saving on the pi?
Can you clarify what you mean by "removable storage"? - for example, if you want to remove the card whilst the Pi is powered and running then the answer's No. However, if you remove the card after the Pi has been shutdown cleanly and powered off, transfer it to another (Linux) computer (eg. a card reader in another Pi) then the answer's Yes, it's possible, but you need to know where to find the files.
Trev.

Right sorry! So I'm saving images and then after powering the pi off I want to be able to insert the micro SD card into a computer and grab the images from that SD card in a folder called lets say IMAGES.

Mwright
Posts: 3
Joined: Tue Jan 31, 2017 5:39 pm

Re: Pi micro SD card as removable storage

Fri Apr 07, 2017 5:30 pm

DougieLawson wrote:Only if your RPi isn't booted from it. (Which is possible on an RPi3B, CM3 and RPi2B2.) If you pull the root filesystem that would be like pulling the harddrive from your laptop while you're using it.

It's much easier to use a plain old USB stick.

Right Sorry! I meant after it's turned off. I'm currently using a usb stick but I wanted to see if I could get rid of it. I'm saving images and then after powering the pi off I want to be able to insert the micro SD card into a computer and grab the images from that SD card in a folder called lets say IMAGES. I don't think it's possible but I wasn't sure if there was something I was overlooking.

User avatar
jahboater
Posts: 8260
Joined: Wed Feb 04, 2015 6:38 pm
Location: Wonderful West Dorset

Re: Pi micro SD card as removable storage

Fri Apr 07, 2017 5:55 pm

Mwright wrote:Right sorry! So I'm saving images and then after powering the pi off I want to be able to insert the micro SD card into a computer and grab the images from that SD card in a folder called lets say IMAGES.
What operating system does your computer run?
If its Linux, then yes you can do that and it will be simple as inserting the SD card and waiting for it to automount.

User avatar
DougieLawson
Posts: 42232
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK

Re: Pi micro SD card as removable storage

Fri Apr 07, 2017 6:02 pm

The filesystem on your SDCard is ext4. You can read that with Linux systems. Windows will look at it and go "No, doesn't make any sense to me" and ask "Would you like to reformat your SDCard?".

Use a USB stick it's a million times easier.
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

hommar
Posts: 191
Joined: Sat Mar 25, 2017 1:55 pm
Location: Russia, Yekaterinburg

Re: Pi micro SD card as removable storage

Fri Apr 07, 2017 7:40 pm

I use USB-boot for backup SD
I plugout SD, plugin USB-storage with Raspbian-Lite, and boot from it.
Then system from USB was started, I plugin SD and copy image SD to USB-storage

User avatar
HawaiianPi
Posts: 7431
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: Pi micro SD card as removable storage

Sat Apr 08, 2017 7:21 pm

Assuming you are running one of the Raspbian images, your SD card is split into 2 partitions, a tiny FAT32 partition used for the boot code, and the rest of the card formatted with the Linux ext4 file system that is used for the OS and all user data. The small boot partition won't hold much, and as Dougie said above, Windows (or Mac) computers can't read the ext4 file system by default.

There are a few solutions for that.
1. Run Linux on your main PC.
2. Install ext4 filesystem drivers for Windows/Mac.
3. Save your pictures to a network resource (NAS, shared folder or connected computer).
4. Repartition the SD card to give you additional storage for your images (expand the boot partition and save your pictures there).
5. And, of course, the ubiquitous USB flash drive.

If your Pi is connected to your network, then option 3 would probably be the best and simplest solution. You would have access to your images without even shutting the Pi down.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups, and where is that annoying music coming from?

Martin Frezman
Posts: 1009
Joined: Mon Oct 31, 2016 10:05 am

Re: Pi micro SD card as removable storage

Sat Apr 08, 2017 11:13 pm

Mwright wrote:Is it possible to use the micro sd card on the raspberry pi zero for removable storage for files I'm saving on the pi?
Since you mention specifically that you are using a PiZero, you could use the tricks described in the URL below to (more or less) turn the Zero into a USB flash drive. The trick here is that you create a virtual drive image in a file (an ordinary file, residing in the normal Linux rootfs part of the SD card) that is formatted FAT32, then you put your files there. Then when you plug the Zero into your Windows machine (via, say, a micro USB to USB A cable), the Zero is seen as a flash drive containing the files in the virtual drive image.

Sounds like exactly what you need.

URL: http://blog.gbaman.info/?p=699
If this post appears in the wrong forums category, my apologies.

User avatar
Gavinmc42
Posts: 6836
Joined: Wed Aug 28, 2013 3:31 am

Re: Pi micro SD card as removable storage

Sun Apr 09, 2017 3:21 am

On my IoT data logger Pi's I use piCore OS.
Three partitions, boot- 30MB, piCore OS - 100MB (only really need about 12MB, the rest is just in case), data - rest of SDcard.

Any Linux OS will have no trouble reading the third partition and getting the data off it.
You can even take the SDcard out while it is still running, as piCore runs from ram.
It only reads the 1st two partitions on power up.

With good coding it only writes data to the sdcard if there is the third partition.
Sticking card back in and you only loose the data from the time the card was out.
With smarter coding this data could be buffered in ram until card is back in and ready.

Pi Zero USB drive sounds like a good idea for portable Pi data loggers.

These days I am using Ultibo and baremetaling the logger application as the OS.
Same thing, boots from sd and then runs from ram.
I nearly always take out the SD card while running, upgrade the kernel.bin code and reset.

Trying to do this with Raspbian = world of pain.
You need a lot of Linux knowledge to bullet proof it.
Gets broken and you have a 4-8GB SDcard that needs backing up.
I find it easier to backup the <3MB Ultibo kernel.bin ;)
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Return to “General discussion”