Hello to All,
Since I understood that the SD can get corrupted, I would like to create an image of my SD, based on the latest Amanda’s backup.
- Platform information:
- Hardware: Raspberry Pi 4 Model B Rev 1.2, 4GB RAM,
- OS: Linux 5.4.51-v7l+
- openHAB version 2.5.8-1
This is the full memory system picture:
[20:39:02] backup@openhab:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 1 28.9G 0 disk /storage/usb-drive *(USB FOR THE BACKUP)
sdb 8:16 1 28.9G 0 disk *(USB FOR THE IMAGE)
mcblk0 179:0 0 29.7G 0 disk *(SD CARD)
├─mmcblk0p1 179:1 0 256M 0 part /boot
└─mmcblk0p2 179:2 0 29.5G 0 part /
zram0 254:0 0 600M 0 disk [SWAP]
zram1 254:1 0 500M 0 disk /opt/zram/zram1
zram2 254:2 0 500M 0 disk /opt/zram/zram2
Via the openhabian-conf, the Amanda server was installed and it is up and running. Every day, at 1:00 it starts to refresh the backup of the following folders (on a USB of 32GB):
Since the SD can get corrupted, it could be useful to create an image of the SD, out of the latest Amanda’s backup.
If I understood correctly, the entire SD is the /dev/mmcblk0, so it means that an image of it contains an exact copy of the running system. In case of SD corruption, with the balenaEtcher, this image can be dropped into a new SD card and the system can restart as if nothing happen.
Let me share some details of the specific configuration:
- openhab is the name of the host
- /storage/usb-b/ is the folder where to store the new image
- openhab-image is the file name of the image
By running the following command, an error appears at the end:
amfetchdump -p openhab-dir openhab /dev/mmcblk0 20200831 > /storage/usb-b/openhab-image
I get the following outcome:
[20:43:13] backup@openhab:~$ amfetchdump -p openhab-dir openhab /dev/mmcblk0 20200831 > /storage/usb-b/openhab-image
Warning: no log files found for tape openHABian-openhab-dir-013 written 2020-08-30 01:00:02
Warning: no log files found for tape openHABian-openhab-dir-012 written 2020-08-30 01:00:02
Warning: no log files found for tape openHABian-openhab-dir-011 written 2020-08-30 01:00:02
Warning: no log files found for tape openHABian-openhab-dir-010 written 2020-08-30 01:00:02
Warning: no log files found for tape openHABian-openhab-dir-001 written 2020-08-25 22:04:56
5 volume(s) needed for restoration
The following volumes are needed: openHABian-openhab-dir-014 openHABian-openhab-dir-015 openHABian-openhab-dir-016 openHABian-openhab-dir-017 openHABian-openhab-dir-018
Press enter when ready
Reading label ‘openHABian-openhab-dir-014’ filenum 5
split dumpfile: date 20200831010003 host openhab disk /dev/mmcblk0 part 1/UNKNOWN lev 0 comp N program APPLICATION
Reading label ‘openHABian-openhab-dir-015’ filenum 1
split dumpfile: date 20200831010003 host openhab disk /dev/mmcblk0 part 2/UNKNOWN lev 0 comp .gz program APPLICATION
Reading label ‘openHABian-openhab-dir-016’ filenum 1
split dumpfile: date 20200831010003 host openhab disk /dev/mmcblk0 part 3/UNKNOWN lev 0 comp .gz program APPLICATION
Reading label ‘openHABian-openhab-dir-017’ filenum 1
split dumpfile: date 20200831010003 host openhab disk /dev/mmcblk0 part 4/UNKNOWN lev 0 comp .gz program APPLICATION
Reading label ‘openHABian-openhab-dir-018’ filenum 1
split dumpfile: date 20200831010003 host openhab disk /dev/mmcblk0 part 5/UNKNOWN lev 0 comp .gz program APPLICATION
filter stderr: gzip: stdin: unexpected end of file
Error writing to fd 7: No space left on device
I assume that this error is happening because the USB memory is too small.
If there a way to set Amanda to write the no-null information only?
or is there any mean for limiting the size of the final image?
or would it be possible to resize the main partition of /dev/mmcblk0 without losing information?
In the end, the size of the real needed information stored on the /dev/mmcblk0 is much less than what Amanda is backing up so the majority of the backup is for nothing.
Is there a mean to extract the information of the /dev/mmcblk0 from the Amanda backup by using a Windows based computer without a linux installation?