Forum
[PROBLEM] System Backup - Restore Fails - Printable Version

+- Forum (http://forum.xbian.org)
+-- Forum: Software (/forum-6.html)
+--- Forum: Others (/forum-24.html)
+--- Thread: [PROBLEM] System Backup - Restore Fails (/thread-3928.html)



System Backup - Restore Fails - husntvar - 15th Sep, 2017 08:58 AM

Hi
I have a backup file done from xbian which I to restored using dd in an external pc.
However after the restore, I see the xbian logo expanding partitions but afterwards it does not boot with the error in the image.

Any help? Is there any particular process for restoring these images?



.
cmdline.txt:
telnet zswap.enabled=1 zswap.compressor=lz4 console=tty1 root=/dev/mmcblk0p2 rootflags=subvol=root/@,autodefrag,compress=lz4 rootfstype=btrfs rootwait logo.nologo quiet noswap loglevel=0 partswap startevent=mountall selinux=0 splash nohdparm net.ifnames=0 biosdevname=0 --startup-event mountall

config.txt:
# ****************************************************************
# * *
# * /boot/config.txt *
# * *
# ****************************************************************
# see /etc/default/xbian-initramfs
initramfs initramfs.gz 0x1500000
gpu_mem_1024=256
gpu_mem_512=144
gpu_mem_256=100
initial_turbo=3
hdmi_ignore_cec_init=1
disable_overscan=1
disable_splash=1
# Double power for USB ports
#max_usb_current=1
# ****************************************************************
# * Overlays. For more information please read *
# * /boot/README.overlays *
# ****************************************************************
# This parameter enables onboard sound via module snd_bcm2835.
# Module will be loaded automatically, an entry in
# /etc/modules[.xbian] has no effect and is not longer needed/
# necessary with kernel 4.4 and above.
# Please note, this setting should be commented out if a Hifiberry
# device is used.
dtparam=audio=on
# ****************************************************************
# * GPIO LIRC *
# * Please note: *
# * GPIO input pin has to be remapped for working together *
# * with Hifiberry sound cards *
# ****************************************************************
dtoverlay=lirc-rpi,debug
#dtoverlay=lirc-rpi,gpio_out_pin=17,gpio_in_pin=22,debug
# ****************************************************************
# * Hifiberry and compatible sound cards (I2S interface) *
# * May conflict with LIRC. See note above *
# ****************************************************************
#dtoverlay=hifiberry-amp
#dtoverlay=hifiberry-dac
#dtoverlay=hifiberry-dacplus
#dtoverlay=hifiberry-digi
# ****************************************************************
# * Raspberry Pi 3 onboard Bluetooth *
# ****************************************************************
# This parameter enables usage of miniuart (ttyS0) for BT.
# Please note that BT may not work properly if CPUFREQ_GOVERNOR
# is set to something else than performance (see also
# /etc/default/xbian-module-init-tools).
#dtoverlay=pi3-miniuart-bt
# Disables onboard Bluetooth
#dtoverlay=pi3-disable-bt
arm_freq=1000
core_freq=500
sdram_freq=500
over_voltage=2


RE: System Backup - Restore Fails - Nachteule - 15th Sep, 2017 10:09 PM

(15th Sep, 2017 08:58 AM)husntvar Wrote:  Hi
I have a backup file done from xbian which I to restored using dd in an external pc.
However after the restore, I see the xbian logo expanding partitions but afterwards it does not boot with the error in the image.

Your root fs ( /dev/mmcblk0p2) can not be mounted. So I suppose your image is not correct.

Probably the image generation was failing due to an error. That happens sometimes, so I added log /tmp/xbiancopy.log to control image generation and made a commit for better error detection some days ago

But there is still one issue that have to be fixed: In case of serious btrfs file system error (I had this a couple of months ago on my devel RPi3, probably because of broken devel kernel damaged fs), image generation was failing permanently because of command btrfs send refused to work. (Un)fortunately all my btrfs fs are good in health, so currently I'm not able to reproduce this issue again

Quote:Any help? Is there any particular process for restoring these images?

No, dd for restoring image is ok

You can connect a keyboard to your RPi and try to check root partition by running command

Terminal

btrfs check /dev/root

when being in recovery boot console


RE: System Backup - Restore Fails - husntvar - 16th Sep, 2017 12:25 AM

Thanks for the quick repply.

(15th Sep, 2017 10:09 PM)Nachteule Wrote:  Your root fs ( /dev/mmcblk0p2) can not be mounted. So I suppose your image is not correct.
How can I check this beforehand to prevent damage ".img"? As far as I know it was working fine.


(15th Sep, 2017 10:09 PM)Nachteule Wrote:  Probably the image generation was failing due to an error. That happens sometimes, so I added log /tmp/xbiancopy.log to control image generation and made a commit for better error detection some days ago
So I should check this frequently to check if the backups are ok. Is there any healthcheck that I can make to the img files?

(15th Sep, 2017 10:09 PM)Nachteule Wrote:  You can connect a keyboard to your RPi and try to check root partition by running command

Terminal

btrfs check /dev/root

when being in recovery boot console
Is this to check in the current image as is (the one that does not mount)?




RE: System Backup - Restore Fails - Nachteule - 16th Sep, 2017 04:11 AM

(16th Sep, 2017 12:25 AM)husntvar Wrote:  Thanks for the quick repply.

No problem Smile

Quote:
(15th Sep, 2017 10:09 PM)Nachteule Wrote:  Your root fs ( /dev/mmcblk0p2) can not be mounted. So I suppose your image is not correct.
How can I check this beforehand to prevent damage ".img"? As far as I know it was working fine.

1) check the logfile /tmp/xbiancopy.log
2) check the size of your image.

Terminal

[19:53:30][manfred@kmcubie:/media/system/backup]$ ll kmxbilr2_xbian_image-usb_2017-09-13.img
-rwxrwx---+ 1 xbmc users 4594860032 Sep 13 14:48 kmxbilr2_xbian_image-usb_2017-09-13.img
[19:53:38][manfred@kmcubie:/media/system/backup]$ du -BM kmxbilr2_xbian_image-usb_2017-09-13.img
3278M kmxbilr2_xbian_image-usb_2017-09-13.img
[19:53:42][manfred@kmcubie:/media/system/backup]$

Calculate if size of img and occupied bytes (which du reports) seems to be correct (that's what I'm doing)

3) try mount the image (please note: if you are using LZ4 compression, you have to use LZ4 enabled kernel, of course you can mount image from a running RPi)

Terminal

[19:57:29][manfred@kmcubie:/media/system/backup]$ sudo kpartx -av kmxbilr2_xbian_image-usb_2017-09-13.img
add map loop0p1 (253:1): 0 139264 linear 7:0 2048
add map loop0p2 (253:2): 0 8833024 linear 7:0 141312
[19:57:49][manfred@kmcubie:/media/system/backup]$ sudo mount /dev/mapper/loop0p2 /mnt
[19:57:55][manfred@kmcubie:/media/system/backup]$ ls -la /mnt
insgesamt 20
drwxr-xr-x 1 root root 52 Sep 13 14:17 .
drwxr-xr-x 24 root root 4096 Sep 10 01:42 ..
drwxr-xr-x 1 root root 2 Sep 13 14:17 data
drwxr-xr-x 1 root root 2 Sep 13 14:28 home
drwxr-xr-x 1 root root 2 Sep 13 14:31 modules
drwxr-xr-x 1 root root 2 Sep 13 14:46 root
drwxr-xr-x 1 root root 2 Sep 13 14:48 storage
[19:57:59][manfred@kmcubie:/media/system/backup]$

(that is one of my RPi3 devel system image)

Quote:So I should check this frequently to check if the backups are ok. Is there any healthcheck that I can make to the img files?

See above

Quote:Is this to check in the current image as is (the one that does not mount)?

Yes, hmmm, btrfs check does not report any error, about 1G data is in fs. So I'm confused why mounting of root does not work Huh

what happens if you mount root fs manually?

Terminal

mount /dev/root /rootfs ?