You are not logged in.

#1 2012-08-20 07:01:56

gondsman
Member
Registered: 2009-07-27
Posts: 85

[SOLVED] Backup gone wrong

I really thought my days as "newbie" were over, but from the mistake I made I deserve to post in this section again. smile
I wanted to give another distribution a try, so I backed up everything in my root and home partitions and formatted everything. Now I'm trying to go back to my backup but I clearly missed something.
I didn't have enough space in an ext partition to save everything, so I saved my backup using the tar command (and the -p flag). Everything was indeed saved, but I discovered later that there are things ("capabilities") that tar doesn't save. So I recovered everything but the system doesn't even boot. The easy solution would be to use pacman to reinstall every package in the system, so that everything would have the right attributes again. Unfortunately pacman can't install packages (I accessed the installation with a chroot) as it complains it cannot calculate free space on the device. Is there a way to make pacman work again? I can recover everything from there.
Well, at least I didn't lose any data, if I can't get anything to work it shouldn't be too long to just reinstall everything.
Thanks in advance!

Last edited by gondsman (2012-08-20 22:56:26)

Offline

#2 2012-08-20 12:23:24

tr!x0r
Member
From: Belgium
Registered: 2010-12-31
Posts: 55
Website

Re: [SOLVED] Backup gone wrong

How about you live boot and install the base and base-devel again? Next you can copy the programs you need?
I think this might be the easiest solution for you.


Remember, when using Linux, you're the one in control
http://www.linux-answered.com

Offline

#3 2012-08-20 13:48:18

DSpider
Member
From: Romania
Registered: 2009-08-23
Posts: 2,273

Re: [SOLVED] Backup gone wrong

So I recovered everything but the system doesn't even boot.

Unless you have a separate boot partition, you also need to reinstall the bootloader if you want it to actually boot. Because simply restoring the files doesn't automatically mean that it's bootable. For example, if you had the boot partition mounted on the other Linux distribution, it probably overwrote your kernel (vmlinuz-linux, the bootloader's config file, etc).


Next time use rsync, or, if you plan on restoring it to the same partition (and if you have enough space), make a dd backup of the partition.

# dd if=/dev/sdxY of=/media/some_folder/backup.img

Then, to restore it, just reverse the "if" (input file) and "of" (output file):

# dd if=/media/some_folder/backup.img of=/dev/sdxY

Same for the MBR (the first 440 bytes).


"How to Succeed with Linux"

I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).

Offline

#4 2012-08-20 14:07:25

gondsman
Member
Registered: 2009-07-27
Posts: 85

Re: [SOLVED] Backup gone wrong

Thanks, I will remember to use rsync next time! smile
I use syslinux as a bootloader, so when I restored my backup I also reinstalled the MBR part with dd. That doesn't seem to be enough to get the system to boot, the bios still complains not finding an operating system. I'm pretty sure the MBR part was copied successfully, because if I flag the first partition (which contains windows for dual booting) as "boot", windows does start normally, because (I guess) syslinux boots the first partition flagged as "boot" it can find. I just found out I can run pacman -r to use pacman from a livecd without chrooting. If I'm correct that should be enough to solve the issue, reinstalling base and base-devel and then reinstalling everything else from a chroot environment, as tr!x0r suggested. I'll post the results later tonight.
Thanks again!

Offline

#5 2012-08-20 14:16:51

DSpider
Member
From: Romania
Registered: 2009-08-23
Posts: 2,273

Re: [SOLVED] Backup gone wrong

Syslinux needs 3 things:

1. Files installed (usually done so that ldlinux.sys is updated). -- Do not confuse this pacman -S syslinux.
2. The boot code installed in the MBR (usually written with dd).
3. The boot flag set on the partition with the Syslinux files.


For a manual install this is the first step:

# extlinux --install /boot/syslinux

For the MBR and setting the boot flag on the first partition of /dev/sdx:

# dd bs=440 conv=notrunc count=1 if=/usr/lib/syslinux/mbr.bin of=/dev/sdx
# parted /dev/sdx toggle 1 boot

Last edited by DSpider (2012-08-20 14:19:13)


"How to Succeed with Linux"

I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).

Offline

#6 2012-08-20 15:19:11

gondsman
Member
Registered: 2009-07-27
Posts: 85

Re: [SOLVED] Backup gone wrong

Oh, of course, I was missing this part "The ldlinux.sys file has the immutable attribute set, which prevents it from being deleted or overwritten. This is because the sector location of the file must not change or else Syslinux has to be reinstalled."! That's why it doesn't boot!
Ok, plenty of things to try tonight smile
Thanks a lot, I'll report back.

Offline

#7 2012-08-20 15:54:47

DSpider
Member
From: Romania
Registered: 2009-08-23
Posts: 2,273

Re: [SOLVED] Backup gone wrong

Here's something else to try: pop in the Arch install media, hover over "Boot existing OS" and press Tab.

Syslinux starts counting drives from zero and partitions from one. If you're booting from a LiveUSB, "hd0 0" is the USB stick.


"How to Succeed with Linux"

I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).

Offline

#8 2012-08-20 22:55:57

gondsman
Member
Registered: 2009-07-27
Posts: 85

Re: [SOLVED] Backup gone wrong

Success! I reinstalled the base group with an Arch livecd, then chrooted in my installation and reinstalled every package from there (using the --asdeps when needed). Then I reinstalled syslinux following the wiki and everything seems to work now!
Thanks all for the help! smile

Offline

#9 2012-08-21 06:07:25

tr!x0r
Member
From: Belgium
Registered: 2010-12-31
Posts: 55
Website

Re: [SOLVED] Backup gone wrong

Gondsman

Congrats on fixing the problem. Admit, this is what makes Linux fun :-)


Remember, when using Linux, you're the one in control
http://www.linux-answered.com

Offline

#10 2012-08-21 07:24:43

gondsman
Member
Registered: 2009-07-27
Posts: 85

Re: [SOLVED] Backup gone wrong

Eheh, up to a certain point, yes, otherwise I wouldn't be using Arch. smile Now back to try to make my PC work with systemd...

Offline

Board footer

Powered by FluxBB