You are not logged in.

#1 2011-03-26 06:58:46

Aesir
Member
Registered: 2011-02-03
Posts: 22

Rsync Backup (may have overwritten partitions)

Hello,
so I have ran into some catastrophic trouble.  I was trying to backup my arch linux setup with rsync to my external hard drive but have instead rendered the system unbootable.  I followed these instruction https://wiki.archlinux.org/index.php/Fu … with_rsync.

First I created file "rbackup.sh"

#!/bin/sh
# rsync backup script

sudo sh -c "
    rsync -av --delete-excluded --exclude-from=backup.lst / $1;
    touch $1/BACKUP
"

then "backup.lst" with exclusions

# Include
+ /dev/console
+ /dev/initctl
+ /dev/null
+ /dev/zero

# Exclude
- /dev/*
- /proc/*
- /sys/*
- /tmp/*
- *lost+found
- /media/backup/*

Then I created directory "backup" in /media (hence it's inclusion in the last file to avoid an infinite backup loop).

# mount /dev/sdb1 /media/backup
# ./rbackup.sh /media/backup/

Then I changed the fstab in the backup drive to this (as prescribed in guide):

/dev/pts      devpts    defaults      0 0
/dev/shm      tmpfs     defaults      0 0

/dev/sdb1    /             ext3      defaults      0 1

At this point I had to leave my room for a short while so I unmounted and shut it off.  When I returned the system was unbootable.  I get the following error  at the filesystem check:

Checking File Systems                    [BUSY]
Fsck.ext3: No such file on directory while trying to open /dev/sdb1
Possibly non-existent device?

File system check failed.
Give root password for maintenance
(or type Control-D to continue):

When I type password, I immediately notice that things are wrong as bash shows root@(empty): (rather than @my alias).

And everything seems to be gone (my user in /home/ is gone) and no commands work (e.g. vi, nano, sudo, pacman, anything).  All the expected directories in / exist but it seems like things were moved to my backup. Luckily, the backup does seem to have all the files that I had asked it to copy over.  What could have happened and what should I do now?  Thank you for any help.

Last edited by Aesir (2011-03-26 07:08:53)

Offline

#2 2011-03-26 11:59:06

Spider.007
Member
Registered: 2004-06-20
Posts: 1,175

Re: Rsync Backup (may have overwritten partitions)

Well, this seems a pretty simple problem. You aren't booting into your actual system, but into a pre-boot initcpio (https://wiki.archlinux.org/index.php/Mkinitcpio) because you didn't revert your fstab.

I am assuming you want to ignore your backup and just boot into the system, so what you should do is update your fstab to reflect the original situation.

The easiest solution would be to use a bootable-stick to update your /etc/fstab, (on your actual disk) to put your original / in (probably /dev/sda1)

The harder option is to manually  update your fstab without an editor; when you are thrown into the inicpio environment, try the following:

mount /dev/sda1 /mnt
cp /mnt/etc/fstab /mnt/etc/fstab-org
cat > /mnt/etc/fstab

you are now overwriting your fstab, so just enter the one you posted in your topicstart, but substitute sdb1 for sda1. When you are done, press ctr+d to quit and save.

after rebooting, the system should come up just fine

If you are unable to boot using some alternative media, and are unable to fix it using tab, I'll explain how to chroot into the disk and use your preferred editor from there. smile

Last edited by Spider.007 (2011-03-26 11:59:46)

Offline

#3 2011-03-26 18:28:57

Aesir
Member
Registered: 2011-02-03
Posts: 22

Re: Rsync Backup (may have overwritten partitions)

Thank you for the response.  How would I edit the fstab file from the arch installation cd? This is not something I have done before and a quick google search wasn't fruitful.  Also, does this fstab look correct? I believe this is what I had, but I did not do a backup since I did not intend to edit my main fstab:

none         /dev/pts      devpts      defaults              0 0
none         /dev/shm      tmpfs       defaults              0 0

/dev/sda5    /boot         ext3        defaults,noatime      0 1
/dev/sda10   swap          swap        defaults,noatime      0 0
/dev/sda3    /             ext3        defaults,noatime      0 1
/dev/sda8    /home         ext3        defaults,noatime      0 1
/dev/sda9    /usr          ext3        defaults,noatime      0 1
/dev/sda7    /tmp          ext3        defaults,noatime      0 1
/dev/sda6    /var          reiserfs    defaults,noatime      0 1

I am unsure about the dump and check options (I believe they were all 0 1 except swap, 0 0) and the mount options (again, believe all were defaults,noatime, besides the first two).  Thank you in advance.

Last edited by Aesir (2011-03-26 18:39:10)

Offline

#4 2011-03-27 10:30:18

Spider.007
Member
Registered: 2004-06-20
Posts: 1,175

Re: Rsync Backup (may have overwritten partitions)

Editing your fstab using the installation-cd is simple, boot, then:

mount /dev/sda1 /mnt
vi /mnt/etc/fstab

you can use any editor you'd like, and in theory you can also install additional editors would you configure pacman.

Did you check if /etc/fstab- exists? It does here, but I am not sure if that is a normal, existing backup.

Regarding your proposed fstab, it looks good to me. If I were you, I would mount the different /dev/sda? partitions when booted from the install-cd to check their contents. You should be able to quickly check if the partition-contents, and proposed mount-points match.
The dump, check and mount options are less important, and the defaults should do just fine to boot from

Offline

Board footer

Powered by FluxBB