I'm intending to do a raw backup (alike DD do if I'm not mistaken) of the SD card on a Windows machine and than zipping it. For that reason I would like to clear all unused sectors before making the copy, as than the zipping will result in the smallest possible file.
Q: Does Stretch have a program available which can do that, and if so which is it ?
The PI seems to work thisaway - please correct me if you know better .
1/. It needs first partition as VFAT containing some boot level stuff.
2/. Everything else is just files in an EXT4 partion
3/. There is no 'boot sector' as such.
4/. The ext4 partiton is in use mounted as root
5/. the vfat partion is mounted as /boot.
6/. The ONLY info OUTSIDE of files that is on te SD card iare te partition UUIDS which are used by fstab and mount to mount the partitions. You can get roynd that anyway by editing fstab to use te raw device types..e.g. /dev/mmcblk0p2 on / and /dev/mmcblk0p1 on /boot
If you do that you have a bootable system irrespetive of partition UUID
# ??? how come no users accessible OS?
You can allegedly ssh into LibreElec. It is a stripped down linux.
So most basic linux comnnads should be there somewhere.
Well in any case using - say - a live linux DVD to boot an intel class machine, and an SD card reader, its no big deal to mount both partitions on the SD card, and file copy their contents onto the host machines disk.
Then you have essentially all the file level info. Which you can zip up.
To create a bootable image in a new SD card, you use a live linux boot system, to create a 40Mbyte vfat partition on a new SD card and format the rest as ext4
Then unzip and copy the files to the partrtions, eject the card and put it in a Pi and boot it..
All political activity makes complete sense once the proposition that
all government is basically a self-legalising protection racket, is
Not what you asked for, but I have used 'partimage' on linux systems for years. It will back up the used sectors of a partition. It can also compress the image and/or backup over the network. It is linux only, and seems not to be in the raspbian repository. You could use a linux live cd on your win machine to do it - or you could download the source and build it on your raspbian. I first became aware of partimage several years ago when I wanted to upgrade the hard drive on a laptop. Copied out the image, partitioned the new drive and copied back - as I recall it can restore an image to a larger partition with no hassle.
You can also try rsync: which is a Raspbian package and will copy data to any other partitions and ignore cruft on the source:
- use a partitioning utility to set up partitions on the new SD-card (in a USB-SD card adapter or a USB-connected HDD
- use rsync to copy the partition contents across.
- boot off the new SD card.
You can also use any archiving system such as tar for the EXT4 partition and ZIP for the FAT partition. Don't use zip for the EXT4 partition because it will play merry hell with Linux permissions and file ownership.
Any of these will only copy the contents of directories and files, while ignoring anything that isn't part of a directory or file.