0

I have a Raspberry Pi with an SD card connected to it. The SD card holds the entire OS on it, which is a problem since I want to place a new image on the SD card to install a new OS on it. The way I manage my RPI is by using SSH between my PC and my RPI. On my PC, I use Linux in VMware.

My question is: Since I can't unmount my SD card while controlling my RPI by SSH, is there a way to move the image onto the SD card from Linux on my PC?

EDIT:

My PC does not have any SD card slot.

  • 3
    Just buy a USB SD card reader. – Biswapriyo Mar 7 at 8:30
  • @Biswapriyo LoL, that doesn't really help me out. There must be a way to do this. – user54952820 Mar 7 at 8:35
  • 1
    Use the USB reader suggested by @Biswapriyo in your RPi. – Dougie Mar 7 at 10:21
  • Hello and welcome – Which raspberry pi model do you have? – You can also write the new image to a USB Drive and boot that partition. Check this answer out. – M. Rostami Mar 7 at 10:36
  • 2
    You can't - just buy a new SD Card - they are cheap. – Milliways Mar 7 at 11:19
1

In theory it's not impossible, however, if you are asking the question, then I'd strongly recommend you do not try.1

My PC does not have any SD card slot.

Ah. Well, unless you are in prison or orbiting the Earth, it should be pretty easy for you to buy a USB SD card reader.3 These vary in price up to ~$25 USD, but if you are happy with USB 2.0 speed (which is fine for writing images), then they start at ~$0.99 online (including shipping! which may take a long time, don't fall for that). Meaning if you live near a big box or department store you can probably find one for $5-10, or at a pharmacy, etc., marked up by 50%. Beware different SD card sizes (chances are you have an adaptor for that already as they commonly come with micro cards).

OTOH, if your time is worth absolutely nothing to you, you could try my suggestion in the footnotes at no cost. I'd bet against you though, sorry, so you might want to first set a time limit on your no-cost hours.


  1. The "theory" I have in mind is that if you can create a root filesystem in memory and chroot or otherwise swap into it, you could then do whatever you want to the card. The final problem is then where to source the image from; if you have a big enough card whereby you might be able to have an extra partition, 2 you could put it there and possibly partially overwrite the card from the beginning -- but probably not, meaning the only option is to stream it over a network. Which will be the easy part.

  2. Yes, chained footnotes. If you do have room for an extra partition on which an image would fit, the saner approach would be to write a root fs into it and just change root in /boot/cmdline.txt. This is a slightly more complex procedure than just writing the image to the card because you will have to extract the root fs partition out of it instead.

  3. Unless you computer does not have any USB ports either, which would be pretty unusual.

| improve this answer | |
  • Ok, thanks for clearing it up. – user54952820 Mar 7 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.