Files truncated after restore from cpio backup

You have a problem with Salix? Post here and we'll do what we can to help.
Post Reply
GJones
Donor
Posts: 300
Joined: 22. Jul 2011, 23:27

Files truncated after restore from cpio backup

Post by GJones »

I wrote the following very simple backup script:

Code: Select all

#!/bin/sh
# backup.sh - a primitive backup script
# Purpose: online backup for desktops
# Usage:
#  backup.sh /path/to/backups
#

backup_name=system-backup-$(date +"F").cpio.bz2

find / \
! -path "/tmp/*" \
! -path "/sys/*" \
! -path "/proc/*" \
! -path "/home/*" \
! -path "/dev/*" \
! -name "lost+found" \
! -name $backup_name | cpio -o -H newc | bzip2 -c \
> $1/system-backup-$(date +"%F").cpio.bz2
It worked, and I was able to transplant my system to another computer! But on reboot I discovered that ldconfig would segfault whenever I ran it. Running gdb on ldconfig revealed that the executable was truncated - it had been corrupted during the backup. I had to reinstall glibc... And who knows what else broke as well.

How did this happen? I was not running any updates during the backup - glibc and other system files should have been completely untouched.

P.S. I used cpio instead of tar because the Busybox version of tar on the 13.37 install CD is broken - it doesn't restore symlinks properly. Maybe the Busybox cpio is also broken?
User avatar
gapan
Salix Wizard
Posts: 6368
Joined: 6. Jun 2009, 17:40

Re: Files truncated after restore from cpio backup

Post by gapan »

Could it be the same problem as this? http://www.salixos.org/forum/viewtopic.php?f=15&t=4077
Image
Image
GJones
Donor
Posts: 300
Joined: 22. Jul 2011, 23:27

Re: Files truncated after restore from cpio backup

Post by GJones »

Possible, but I don't think so - cpio shouldn't use gamin/FAM at all, and the archived files should not have been changing.
Post Reply