7

So my RPI is working great and is running it's OS from the SD card. A lot of the time when I'm programming I don't have an internet connection. I can't make a direct connection to my mac cause it's a Macbook Air and it doesn't have Ethernet. So what I would like to be able to do is the following:

When I eject the SD from the Pi and connect the SD to my mac I see the following files:

files

Is there a way to edit the root files from my Mac when the SD is plugged into my Mac? (By saying the root files is mean the files you see when you ssh into the pi with the SD in and enter the command cd / )

Iain Smith
  • 163
  • 1
  • 5
eds1999
  • 203
  • 1
  • 2
  • 6

2 Answers2

6

I basically didn't have a Keyboard I could use for my Raspberry Pi and was wanting to do the same.

I did this:

  1. Insert the SD card into the MacBook
  2. Open Applications > Disk Utility > right click on the partition under "Apple SDXC Reader Media" > unmount
  3. Take a note of the "Device" name on "Apple SDXC Reader Media" mine was disk3
  4. Install Virtual Box
  5. Run this command changing "disk3" at the end to what you got in step 3 sudo VBoxManage internalcommands createrawvmdk -filename ./sd-card.vmdk -rawdisk /dev/disk3
  6. Change the permissions so you can access them sudo chmod 777 /dev/disk3 sudo chmod 777 ./sd-card.vmdk
  7. Download the Ubuntu live iso from here (You can use your own favorite distro if you want.)
  8. Create a Virtual Machine in VirtualBox enter image description here
  9. Dont set a hard disk on this step: enter image description here
  10. Once the virtual machine is created go to > Settings > Storage > Add the Ubuntu live iso as the live CD like this: enter image description here
  11. Add a SATA controller and set the hard drive to the file you create in step 5 "sd-card.vmdk" like this:

Note I had to unmount the partition again here like in step 2, it was some how mounted. enter image description here 12. Run the Virtual Machine and you should see the mounted sdcard partitions (boot and the 32GB partition in my case) now you can edit the files you need. enter image description here

Iain Smith
  • 163
  • 1
  • 5
3

Due to the way the SD-card reader is connected in Macbooks, you can't mount the root Filesystem on Partition 2 of the card which is formatted in EXT (no virtual machine or other Programm will be able to access the SD-reader in OSX). The first partition is FAT32, which is automatically mounted by OSX and shows up in Finder.

You can only boot native to Ubuntu or any other Linux distro and mount the SD card there

you can make a backup (.img) of your SD-Card and mount this in a virtual machine. This workaround is also not the simplest and pretty slow (depending on the sd card)

Gotschi
  • 608
  • 2
  • 7
  • 16