Backing up my SD - Windows partition not working

I think my Micro SD card is broken, when in my Pi everything is fine but I’m trying to create a backup on Windows before I do an update, every time I plug it in to windows the Windows Bootable partition keeps disconnecting so I get a message like “D: is unavailable” It’s not my card reader because other cards work fine, I’ve also tried on my Mac and get the same issue.

On the odd time I’ve started to create a backup in Win32 Disk Imager it will again disconnect and I get a CRC error.

I have a couple of questions:

Is there anyway I can create an image of the SD while it’s running in my Pi?
Is there anything I can try to get the windows boot partition to work?
Is there a way I can back up all my settings so I can get another SD and copy them over?

What do you mean with windows partition? Most images have an ext4 system partition and a boot partition (I think it is fat32), some images only have one single ext4 partition.
There is no window partition on the image.

Also if you try to backup the card with windows: it can’t handle ext4, maybe this is the problem you’re facing.

Yeah I guess he mean the vfat partition on RPi images. Looks like it’s not accessible by Windows as well as MacOS. At least for the vfat partition access should be possible.

You could try following as a basic check on your system.

> /forcefsck
reboot
# then after reboot
journalctl -t systemd-fsck

Yeah I mean the part you can read in Windows, it’s around 128MB and contains config.txt, overlays folder etc, it opens the folder when I plug in the card but then quickly closes and says not accessible and even though I can still see the other partition mounted when I try to back it up I get an error about the location or handler not found.

On the odd occasion when this partition is still present I can start backing up the SD but after a while it gets disconnected and I get a CRC error.

I’ve just turned the Pi back on and tried that:

root@DietPi:~# journalctl -t systemd-fsck
-- Journal begins at Fri 2023-04-07 12:16:11 BST, ends at Fri 2023-04-07 12:24:15 BST. --
Apr 07 12:16:11 DietPi systemd-fsck[142]: Please pass 'fsck.mode=force' on the kernel command line rather than creating /forcefsck on the root file system.
Apr 07 12:16:11 DietPi systemd-fsck[157]: e2fsck 1.46.2 (28-Feb-2021)
Apr 07 12:16:11 DietPi systemd-fsck[157]: Pass 1: Checking inodes, blocks, and sizes
Apr 07 12:16:14 DietPi systemd-fsck[157]: Pass 2: Checking directory structure
Apr 07 12:16:18 DietPi systemd-fsck[157]: Pass 3: Checking directory connectivity
Apr 07 12:16:18 DietPi systemd-fsck[157]: Pass 4: Checking reference counts
Apr 07 12:16:19 DietPi systemd-fsck[157]: Pass 5: Checking group summary information
Apr 07 12:16:20 DietPi systemd-fsck[157]: /dev/mmcblk0p2: 66179/7768320 files (1.5% non-contiguous), 28739314/31183360 blocks
Apr 07 12:16:21 DietPi systemd-fsck[229]: Please pass 'fsck.mode=force' on the kernel command line rather than creating /forcefsck on the root file system.
Apr 07 12:16:21 DietPi systemd-fsck[259]: fsck.fat 4.2 (2021-01-31)
Apr 07 12:16:21 DietPi systemd-fsck[259]: /dev/mmcblk0p1: 376 files, 65138/258077 clusters

did you tried to connect your SD card again to your Windows box after the file system check has been passed?

I’ve just tried but got the same thing, windows opens the folder for a second then it says

D:\ is not accessible. The Volume does not contain a recognized file system. Please make sure that all required file system drivers are loaded and that the volume is not corrupted.

If I try to use Win32 Disk imager I get

An error occurred when attempting to read data from the handle. Error 23: Data error (cyclic redundancy check)

do you have a spare SD card and a possibility to connect your corrupted SD via USB to your Pi?

Yes I have another pi running diet pi

ok if possibke, connect your brocken SD card via USB connector to the 2nd Pi.

I’ll be free to try it in about 30 min, once it’s connected is there anything I should run?

Important, don’t mount the SD card. Check device name of your SD card.

lsblk -o name,fstype,label,size,ro,type,mountpoint,partuuid,uuid

Once you know the device, run another check

dosfsck /dev/sdx1

Replace sdx1 with the name of your device

Thanks for the help, which is my device? Both Pi’s are running the same size SD so I’m not sure which is the broken one connected via USB one and which is this pi’s SD card

root@PlexExtra:~# lsblk -o name,fstype,label,size,ro,type,mountpoint,partuuid,uu                                                                                                                                                             id
NAME FSTYPE LABEL   SIZE RO TYPE MOUNTPOINT PARTUUID                                                                                                                                                                                          UUID
sda               119.1G  0 disk                                                                                                                                                                                                             
├─sda1
│    vfat           128M  0 part            c26b8af2-01                                                                                                                                                                                       9041-5D00
└─sda2
     ext4           119G  0 part            c26b8af2-02                                                                                                                                                                                       14bb0923-da43-46db-919f-a1b300fdc73f
mmcblk0
│                 119.1G  0 disk                                                                                                                                                                                                             
├─mmcblk0p1
│    vfat           128M  0 part /boot      d5900763-01                                                                                                                                                                                       447A-61ED
└─mmcblk0p2
     ext4           119G  0 part /          d5900763-02                                                                                                                                                                                       0c775223-1871-4eeb-8d39-1eb6a931dc4f
root@PlexExtra:~#

Assuming the sda one I get

fsck.fat 4.2 (2021-01-31)
open: No such file or directory

For sd1 & sd2 and

fsck.fat 4.2 (2021-01-31)
open: No medium found

for sda

It is sda1 for the vfat partition.

I’ve just tried again but now I get a different result:

root@PlexExtra:~# lsblk -o name,fstype,label,size,ro,type,mountpoint,partuuid,uu                                                                                                                                                             id
NAME FSTYPE LABEL   SIZE RO TYPE MOUNTPOINT PARTUUID                                                                                                                                                                                          UUID
sda               119.1G  0 disk                                                                                                                                                                                                             
mmcblk0
│                 119.1G  0 disk                                                                                                                                                                                                             
├─mmcblk0p1
│    vfat           128M  0 part /boot      d5900763-01                                                                                                                                                                                       447A-61ED
└─mmcblk0p2
     ext4           119G  0 part /          d5900763-02                                                                                                                                                                                       0c775223-1871-4eeb-8d39-1eb6a931dc4f
root@PlexExtra:~#

Then every time after I get:

root@PlexExtra:~# lsblk -o name,fstype,label,size,ro,type,mountpoint,partuuid,uuid
NAME        FSTYPE LABEL   SIZE RO TYPE MOUNTPOINT PARTUUID                             UUID
sda                      119.1G  0 disk
mmcblk0                  119.1G  0 disk
├─mmcblk0p1 vfat           128M  0 part /boot      d5900763-01                          447A-61ED
└─mmcblk0p2 ext4           119G  0 part /          d5900763-02                          0c775223-1871-4eeb-8d39-1eb6a931dc4f

When I reboot I get the first result the first time then the second result until I reboot again.

If I do the check on sda I get

root@PlexExtra:~# dosfsck /dev/sda
fsck.fat 4.2 (2021-01-31)
Read 512 bytes at 0:Input/output error

Putting the sd back in my pi everything boots up and works as normal still :confused:

If all you are wanting to do is do a full image of the SD card
Win32 Disk Imager download | SourceForge.net
make sure you use the “read” option rather than the write :wink:

@WarHawk the SD card is already damaged in a way where no tools can read it anymore

@MichaIng any other ideas how to get check SD card further.

@AJRobson your SD might goanna boot, but could break fully any time

Yeah I figured it’s going to break at any point, luckily I can back up my Sonarr and Prowlarr configs through the web ui every day so when it finally does completely break I’ll just need to set up transmission and Plex again

probably that would be best, to save as much data as possible and to create a new install as data corruption might be to much already.

Seems like the partition table itself is broken. None of these is able to read if from external system?

fdisk -l /dev/sda
parted /dev/sda print

Kernel logs could give a hint:

dmesg -l 0,1,2,3

But when it’s physically dying, not much which can be done and probably not worth to waste much time, i.e. I agree best is, if it still boots, to rescue as much as possible as fast as possible and setup a fresh system.