I have a bunch of files I'd like to send to my rpi. I have them in 2 places: 1. on my mac and 2. on a an SD card for my pi that has corruption in the kernel and won't boot.

I'd like to put the files on my currently running pi that has a different SD card.

ssh'ing the files from my mac is soooo slow, so I'm trying to figure out a faster way. I tried and failed to put them on a USB thumb drive from my mac and connect it to the pi but I couldn't mount the thumb drive. So I had an idea to put the SD with the corrupt kernel in the USB card reader that came in my kit and connect it to the pi.

When I do that, I can see the contents of that card. But I couldn't find the files in there so I tried mounting the 2 imgs I found in it (kernel.img and kernel7.img) using (e.g.) sudo mount -t sysfs kernel7.img /home/pi/mntpt, but I believe that what I'm seeing is the boot drive partition. It's only 35M in size. The pi home folder is nowhere to be found.

Is there a way I can find the files in the SD that's in the USB card reader and copy them out into the card that my pi booted from?

Output of requested commands (while the USB SD card reader is inserted into one of the pi's USB ports:

pi@raspberrypi:/media $ lsblk
sda           8:0    1 29.8G  0 disk 
├─sda1        8:1    1   57M  0 part /media/usb0
└─sda2        8:2    1  7.4G  0 part 
mmcblk0     179:0    0 29.7G  0 disk 
├─mmcblk0p1 179:1    0  1.2G  0 part 
├─mmcblk0p2 179:2    0    1K  0 part 
├─mmcblk0p5 179:5    0   32M  0 part /media/pi/SETTINGS
├─mmcblk0p6 179:6    0   69M  0 part /boot
└─mmcblk0p7 179:7    0 28.4G  0 part /
pi@raspberrypi:/media $ sudo parted /dev/sda print free
Model: Mass Storage Device (scsi)
Disk /dev/sda: 32.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
        16.4kB  4194kB  4178kB           Free Space
 1      4194kB  64.0MB  59.8MB  primary  fat16        boot, lba
 2      64.0MB  7969MB  7905MB  primary
        7969MB  32.0GB  24.0GB           Free Space


As far as I understand you are trying to do all copying on your mac. But why not using the Raspberry Pi? Just boot it up and then plug in the USB card reader to it with source SD Card inserted. Then mount the source SD Card and copy the files you want to the RasPis storage (SD Card).

As I can see from your updated question the "old" corrupted SD Card, plugged in with a card reader onto the RasPi, has two partitions:/dev/sda1 (boot partition, formated with fat filesystem) and /dev/sda2 (root partition, formated with ext4 filesystem). To get access to the files you have to mount the root partition /dev/sda2. But it seems this partition has lost its filesystem ext4 because parted should show it in its output at column File system for Number 2 (/dev/sda2). For Number 1 (/dev/sda1) it shows the correct filesystem fat16.

You can try to mount /dev/sda2 but I'm not very hopeful that you can because of the corrupted filesystem:

rpi ~$ sudo mkdir /mnt/sda2
rpi ~$ sudo mount -t ext4 /dev/sda2 /mnt/sda2

If this fails you could use very low level recovery tools scanning the SD Card for readable data but that is not an easy task. Fortunately you have the files still available on your MAC. The MAC can read fat filesystems so you can format your USB thumb drive on the RasPi and then transfer the files from the MAC to the RasPi with it. Of course you will loose all data on the thumb drive. You have already tried it but I don't know why it fails. Maybe the thumb drive wasn't formated the right way. Here is how to format it with a 4 GB partition. With 4 GB you are on the save side with fat because there are known limits with bigger partitions.

rpi ~$ sudo parted /dev/sda mktable msdos
rpi ~$ sudo parted /dev/sda mkpart primary fat32 0% 3999MB
rpi ~$ sudo mkfs.fat -F32 /dev/sda1

The thumb drive should then look like this:

rpi ~$sudo parted /dev/sda print
Model: General UDisk (scsi)
Disk /dev/sda: 4028MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  3999MB  3998MB  primary  fat32        lba

Try if you can access it:

rpi ~$ sudo mkdir /mnt/sda1
rpi ~$ sudo mount /dev/sda1 /mnt/sda1
rpi ~$ sudo touch /mnt/sda1/USB_thumb_drive
rpi ~$ sudo ls /mnt/sda1

rpi ~$ sudo umount /mnt/sda1

Now plug the USB thumb drive into the MAC and copy the files.

  • Sorry, I was unclear. That's what I'm trying to do, however. The USB card reader is plugged into the pi. However I don't see the files. I think all I can see is the boot partition on that card. The card in the USB reader in the pi appears to only have only 35Mb on it. I assume that all my files are on a different partition, or else the card is more hosed than I thought...
    – hepcat72
    Mar 9 '19 at 22:48
  • @hepcat72 OK, lets have look. Please edit your question and add the output of this commands from the RasPi when the card reader is plugged in: lsblk and sudo parted /dev/sda print free.
    – Ingo
    Mar 9 '19 at 23:05
  • @hepcat72 I have updated the answer.
    – Ingo
    Mar 10 '19 at 13:40
  • I think you’re right. Both answers are good and I suspect Both contributed toward figuring out what the problem was/is. Yours seemed to figure out the missing files issue first, but I feel bad choosing one answer over the other. I suppose I’ll choose this one and upvote the other? Anyone have an opinion on the correct stack etiquette here?
    – hepcat72
    Mar 10 '19 at 14:28
  • @hepcat72 It's up to you. Accepting an answer mainly means that's the solution for your problem. The problem is copying files to your running SD Card. What solved your problem? Can you mount the "old" SD Card?
    – Ingo
    Mar 10 '19 at 14:39

I find that the easiest way to copy files from a Mac to the Pi is FTP, although I also use rsync and AFP (netatalk on the Pi).

Unless you have a very slow network this is unlikely to be slow - All I/O on the Pi goes through the USB controller (except on-board WiFi and GPIO) so all methods have the same bottleneck.

You can put the old SD Card in a reader and read on the Pi. These will automount on Desktop, and can easily be mounted from the command line.

You have asked many different (and vague) questions. You cannot access ext4 partitions on the Mac (at least not since Apple inflicted SIP on us), although these are readable on any Linux machine.

The kernel.img files are NOT file system images and are not mountable (they are kernel code).

The root partition does not seem to be mounted. The following will mount it if it is OK

sudo mkdir /mnt/SDA2
sudo mount /dev/sda2 /mnt/SDA2

This is a script I use to mount Cards

# 2017-05-06
# 2018-11-18


# Check/create Mount Points
if [ ! -e $BOOT_MOUNT ]; then
    mkdir $BOOT_MOUNT
if [ ! -e $ROOT_MOUNT ]; then
    mkdir $ROOT_MOUNT
    echo "mounts " $BOOT_MOUNT  $ROOT_MOUNT
if [ -e /dev/sda ]; then
echo $SD
# Mount Partitions
if ! $(mountpoint -q $BOOT_MOUNT); then
    mount $SD1 $BOOT_MOUNT  # mount partition containing boot files
if ! $(mountpoint -q $ROOT_MOUNT); then
    mount $SD2 $ROOT_MOUNT  # mount root partition containing OS files
  • Yeah, sorry. Vague and unclear. I'm doing this all on the pi. I'm currently copying from the mac via scp. It's just really slow and I was hoping to just use the usb card reader plugged into the pi, but I can't find the files and as I comment above, the card only appears to have 35Mb data. Though I know it should have about 9G.
    – hepcat72
    Mar 9 '19 at 22:51
  • @hepcat72 "I can't find the files" is not going to get any response - WHAT do you see when you insert the device. Also try writing in paragraphs - it is difficult to read.
    – Milliways
    Mar 9 '19 at 23:34
  • Thanks for the help. I added the commands with output. And I tried improving the question. How do I find the pi home folder in the SD card in the USB reader plugged into the rpi?
    – hepcat72
    Mar 10 '19 at 0:09
  • OK, so I mounted the SD card. I had to add -t sysfs to not get an error. I also had to change it to /dev/sdb, as it had changed between boots.
    – hepcat72
    Mar 10 '19 at 5:10
  • However - do I need to mount a different partition or something? I'm looking for the pi home directory. This was a card I was booting off of until the other day when it would not boot (it was kernel panicking during boot up). The files I'm looking for should be in /home/pi. Do you know where I can locate that on the card? Once I mount it, why don't I see the file system as it would be had I booted off of it? Instead, I cd in there and I see: block bus class dev devices firmware fs kernel module power. Where's etc? Where's usr? Where's home?
    – hepcat72
    Mar 10 '19 at 5:15

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.