You are not logged in.

#1 2009-11-27 21:44:12

Mad Max
Member
From: Germany
Registered: 2009-03-09
Posts: 39
Website

[SOLVED] Arch Partition restored from Image / GRUB issues

Hi guys,

I have just restored 2-day-old image of Arch linux. Clonezilla was used to create and restore that image. Restoring procedure went OK.
Now comes the problem: my GRUB doesn't load anymore. Since it is a matter of minutes, I've booted Arch live-cd and tried to reinstall grub manually:

mount -t ext4 /dev/sda1 /mnt
mount -t proc proc /mnt/proc
mount -t sysfs sys /mnt/sys
mount -o bind /dev /mnt/dev

chroot /mnt /bin/bash

grub-install /dev/sda

Mounting sda1 was flawless, but here comes an (not unusual) error:

The file /boot/grub/stage1 not read correctly

Booting that partition directly from live-cd didn't succeed either. So, here is my output of fdisk -l:

Disk /dev/sda : 200.0 GB, 20079647616 bytes
255 heads, 65 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xee3402bb

Device   Boot   Start      End      Blocks        Id       System
/dev/sda1        1         3917     31463271       7       HPFS/NTFS
/dev/sda2  *     3918      7834     31463302+      7       HPFS/NTFS
/dev/sda3        7835      24321    132431827+     5       Extended
/dev/sda5        7835      7965     1052226        82      Linux swap / Solaris
/dev/sda6        7966      24321    131379538+     7       HPFS/NTFS

As you can see, sda1 wasn't recognized as linux partition, but as NTFS. However, this IS an ext4 partition, since manual mountig (see above) went OK and I was able to access my data there. Do you have a clue, why this happened and how I can fix it? I was so dumb to delete my previous Arch-images, so I have only this one.

My partition table:

sda1 - primary, not active, linux/ext4
sda2 - primary, active, WinXP/NTFS
sda5 - logical, linux swap
sda6 - logical, data container/NTFS

Please, I need your help!

Last edited by Mad Max (2009-12-02 12:10:10)

Offline

#2 2009-11-27 21:51:57

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: [SOLVED] Arch Partition restored from Image / GRUB issues

I don't know how to fix your issue, but just a comment that you can safely ignore the fact that fdisk reports it as a NTFS partition: this is only the interpretation of the "Id" (in the previous column); you can change that with fdisk; but it is totally ignored by linux.

If you installed grub to MBR (it seems so; 'grub-install /dev/sda' does that), that you can't boot 'a partition'. You can try booting it by editing an entry in livecd's grub - changing the place where it looks for the kernel and initrd to /dev/sda1 (actually to the grub's notation - so something like (hd0,1)), and of course the 'root=/dev/sda1' parameter to the kernel. In principle it should boot your arch as usual from /dev/sda1. Then try reinstalling grub.

Offline

#3 2009-11-27 22:48:23

Mad Max
Member
From: Germany
Registered: 2009-03-09
Posts: 39
Website

Re: [SOLVED] Arch Partition restored from Image / GRUB issues

bender02 wrote:

I don't know how to fix your issue, but just a comment that you can safely ignore the fact that fdisk reports it as a NTFS partition: this is only the interpretation of the "Id" (in the previous column); you can change that with fdisk; but it is totally ignored by linux.

If you installed grub to MBR (it seems so; 'grub-install /dev/sda' does that), that you can't boot 'a partition'. You can try booting it by editing an entry in livecd's grub - changing the place where it looks for the kernel and initrd to /dev/sda1 (actually to the grub's notation - so something like (hd0,1)), and of course the 'root=/dev/sda1' parameter to the kernel. In principle it should boot your arch as usual from /dev/sda1. Then try reinstalling grub.

Thanks for your rapid response!
I hac already changed kernel parameter 'root=/dev/sda1' and my intention, that this issue must somehow relate to the file system, was because of following output (on trying to boot that my Arch partition from livecd) :

root (hd0,0)
Filesystem type unknown, partition type 0x7
kernel /vmlinuz26 root=/dev/sda1 ro
setup (hd0)
Error 17: Cannot mount selected partition

Offline

#4 2009-11-28 05:05:09

Gen2ly
Member
From: Sevierville, TN
Registered: 2009-03-06
Posts: 1,529
Website

Re: [SOLVED] Arch Partition restored from Image / GRUB issues

Well, the problem is not with your partitions, at least not yet.  YOU could try the manual grub install which is more reliable.  Obviously, the BIOS isn't seeing the GRUB program on the MBR which is the first problem to fix.


Setting Up a Scripting Environment | Proud donor to wikipedia - link

Offline

#5 2009-11-28 16:02:32

IgnorantGuru
Member
Registered: 2009-11-09
Posts: 640
Website

Re: [SOLVED] Arch Partition restored from Image / GRUB issues

You could try this method for installing grub to the MBR if you haven't already
http://en.wikibooks.org/wiki/How_To_Bac … _Partition

But it doesn't sound like sda was restored correctly.  maybe try

e2fsck -f /dev/sda1

to see if the filesystem has problems in it.

If you can mount and access the files, you could also copy the whole filesystem to another freshly formatted partition, eg:

cp -ax /mnt/source/. /mnt/target/.
# be sure to includes the dots

Then reinstall grub and let it find its root on the new partition.

Also, I assume grub v1 can do ext4?  I don't use ext4 so I don't know.  The above copy method could also copy the filesystem to ext3 if you think that would help.

Offline

#6 2009-11-28 16:53:26

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: [SOLVED] Arch Partition restored from Image / GRUB issues

I've run into problems using grub-install from inside a chroot. You might try jumping out of it and manually specifying the root directory as such:

install-grub /dev/sda --root-directory=/mnt

edit: oops, forgot an '='.

Last edited by falconindy (2009-11-28 17:28:00)

Offline

#7 2009-11-30 11:37:35

Mad Max
Member
From: Germany
Registered: 2009-03-09
Posts: 39
Website

Re: [SOLVED] Arch Partition restored from Image / GRUB issues

Hi guys, thank you for all the support!

But here we go:

1. Tried to install grub with manual root, as you suggested:

grub-install /dev/sda --root-directory=/mnt

The file /mnt/boot/grub/stage1 not read correctly.

So, no change here. Does (not) work exactly the same as with chroot...

2. Checked with e2fsck:

2.a: on mounted sda1:

e2fsck -f /dev/sda1

/dev/sda1: recovering journal
/e2fsck: Bad magic number in super-block while trying to re-open /dev/sda1
/e2fsck: io manager magic bad!

2.b: on unmounted sda1:

e2fsck: Superblock invalid, trying to backup blocks...
Superblock has an invalid journal (inode8).
Clear<y>? cancelled!

ef2sck: Illegal inode number while checking ext4 journal for /dev/sda1

Well, I am at the end of my Knowledge here: it seems to be an issue with the filesystem, but e2fsck obviously sees it as ext3, while it is ext4.
Mounting itself went without issues...

Offline

#8 2009-11-30 12:02:09

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: [SOLVED] Arch Partition restored from Image / GRUB issues

BTW, running e2fsck on a mounted partition is dangerous (unless it's mounted read-only), you're likely to damage it even more.

And e2fsck recognizes it's ext4 - it says it is "checking ext4 journal".

So, if you still have the backups, why don't you try to let e2fsck to fix the errors it finds?

Offline

#9 2009-11-30 15:49:23

IgnorantGuru
Member
Registered: 2009-11-09
Posts: 640
Website

Re: [SOLVED] Arch Partition restored from Image / GRUB issues

Yeah sounds like sda1 was not restored properly by Clonezilla - maybe an ext4 support problem.  I'll second bender02 and suggest you see if it can repair the filesystem (and do indeed unmount the partition first - I should have added that, and e2fsck should give you a big warning about that as well).

Offline

#10 2009-11-30 15:58:25

Mad Max
Member
From: Germany
Registered: 2009-03-09
Posts: 39
Website

Re: [SOLVED] Arch Partition restored from Image / GRUB issues

bender02 wrote:

And e2fsck recognizes it's ext4 - it says it is "checking ext4 journal".

So, if you still have the backups, why don't you try to let e2fsck to fix the errors it finds?

Sorry, was my fault: what it finds, is ext3:

e2fsck: Illegal inode number while checking ext3 journal for /dev/sda1

There are 250 errors, it finds. All about journalling. It seems, that Clonzilla has messed up my image, despite it's claims for being successful...

Offline

#11 2009-11-30 16:11:11

IgnorantGuru
Member
Registered: 2009-11-09
Posts: 640
Website

Re: [SOLVED] Arch Partition restored from Image / GRUB issues

You could try Clonezilla again, but odds are you'll get the same result.

If the data is critical and e2fsck doesn't repair it, you could try copying some of it off the partition.  You might get corrupt files that way though.

I use the partimage program on SystemRescueCD for my partition backups.  I've never had it fail me, though I haven't ever tried it with ext4.  It does support it though. (I'm waiting for ext4 to mature a little more.)

Offline

#12 2009-11-30 16:42:59

Mad Max
Member
From: Germany
Registered: 2009-03-09
Posts: 39
Website

Re: [SOLVED] Arch Partition restored from Image / GRUB issues

IgnorantGuru wrote:

You could try Clonezilla again, but odds are you'll get the same result.

If the data is critical and e2fsck doesn't repair it, you could try copying some of it off the partition.  You might get corrupt files that way though.

I use the partimage program on SystemRescueCD for my partition backups.  I've never had it fail me, though I haven't ever tried it with ext4.  It does support it though. (I'm waiting for ext4 to mature a little more.)

I've considered to use it too, but it's imaging capabilites are provided by partimage, and this, on it's turn, can't do ext4 (partimage homepage).

I'm seeking for a good non-incremental backup solution (e.g. Acronis TrueImage), that boots from CD, right now. Partclone doesn't have bootable images, to my knowledge.

What similar solution do you guys use for your complete backups?

Offline

#13 2009-11-30 17:00:03

IgnorantGuru
Member
Registered: 2009-11-09
Posts: 640
Website

Re: [SOLVED] Arch Partition restored from Image / GRUB issues

Mad Max wrote:

I've considered to use it too, but it's imaging capabilites are provided by partimage, and this, on it's turn, can't do ext4 (partimage homepage).

Ah, I didn't know that - I just knew sysresccd had ext4 support.  I'm sure the partimage folks are working on it.

You could just use dd to copy the entire partition.  It wastes space (copies even the empty blocks) and doesn't compress, but people do use it for that.  Or you could just copy the files to another partition with

cp -ax /mnt/source/. /mnt/target/.
# be sure to includes the dots

Or even tar them to save space.  The copy method above has always worked reliably for me for moving a system from one partition to another, or even one filesystem type to another.

Offline

#14 2009-12-01 01:44:08

Gen2ly
Member
From: Sevierville, TN
Registered: 2009-03-06
Posts: 1,529
Website

Re: [SOLVED] Arch Partition restored from Image / GRUB issues

To restore the backup the files are gzipped and then split.  You can put split files together again by:

cat  sdb2.ext4-ptcl-img.gz.* sdb2.ext4-ptcl-img.gz

For example.  Then decompress them by:

gunzip -dc sdb2.ext4-ptcl-img.gz

Kinda bummed to see this, I just backup my drive with clonezilla sad.

Last edited by Gen2ly (2009-12-01 10:22:26)


Setting Up a Scripting Environment | Proud donor to wikipedia - link

Offline

#15 2009-12-01 01:56:12

Gen2ly
Member
From: Sevierville, TN
Registered: 2009-03-06
Posts: 1,529
Website

Re: [SOLVED] Arch Partition restored from Image / GRUB issues

Oh, just for future reference you can dd a drive and gzip it.  It's done by:

dd if=/dev/sda bs=1024k conv=noerror,sync | gzip -c > 2009-11-backup.dd.gz

For example.  You can zero unused blocks beforehand by:

dd if=/dev/zero of=hugefile; sync; rm hugefile; sync

(thanks to Daenyth for that last one).  Which will make the backup a lot smaller.  It will take quite a bit of time to backup because dd has to read every block.

Last edited by Gen2ly (2009-12-01 01:56:34)


Setting Up a Scripting Environment | Proud donor to wikipedia - link

Offline

#16 2009-12-01 05:28:37

synthead
Member
Registered: 2006-05-09
Posts: 1,337

Re: [SOLVED] Arch Partition restored from Image / GRUB issues

In a live session, try running cfdisk on /dev/sda as root and change the type of your boot partition back to 83 (Linux).

I also found that you need to install diffutils onto the Arch live session to use grub-install.

Offline

#17 2009-12-01 08:23:09

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: [SOLVED] Arch Partition restored from Image / GRUB issues

synthead wrote:

In a live session, try running cfdisk on /dev/sda as root and change the type of your boot partition back to 83 (Linux).

Sure you can do that, but linux completely ignores the partition types as far as I know.

Offline

#18 2009-12-02 12:40:33

Mad Max
Member
From: Germany
Registered: 2009-03-09
Posts: 39
Website

Re: [SOLVED] Arch Partition restored from Image / GRUB issues

OK, guys, I fugured out the problem!

All this hassle was because of the "active"-flag: I did an Clonezilla-image from the Arch-partition (sda1) and then formatted it. In order to boot an XP from sda2, I obviously set it active. To make this story short: at that time, when I restored my Arch-partition back, sda2 still had an active flag on it, so Clonezilla did manage to restore partition, but messed up with those active-flags on it. Maybe it is because I checked "clone the hidden data btw. MBR and the first partition"-option, when I was making that image, I don't really know. But, after I set my sda1 "bootable" with cfdisk and restored it once again, everything went flawless and even my old grub was restored automatically.

One thing still bothers me though: I am pretty sure, that sda2 had an active flag all the time. I mean, even before I did an Arch-image. So why did Clonezilla want sda1 to be active, in order to restore my grub, is still a big mystery to me. 

Well, I hope all of you, who read this thread, could understand, what I wrote here. Thank you all for all the support! I hope, it could be helpful for you somehow in the future.

Offline

#19 2009-12-02 15:03:37

synthead
Member
Registered: 2006-05-09
Posts: 1,337

Re: [SOLVED] Arch Partition restored from Image / GRUB issues

That's really interesting.  I'm glad you got it fixed!  Might head your way to the Clonezilla page and file a bug report too wink

Offline

#20 2009-12-02 16:01:46

IgnorantGuru
Member
Registered: 2009-11-09
Posts: 640
Website

Re: [SOLVED] Arch Partition restored from Image / GRUB issues

That's good you have it working.  I tend to think changing the active flag was just a coincidence and it had no effect on the problem.  Maybe just restoring it a second time did the trick.  Grub ignores the active flag in the partition table so it shouldn't make any difference.

Offline

#21 2009-12-02 17:12:09

Mad Max
Member
From: Germany
Registered: 2009-03-09
Posts: 39
Website

Re: [SOLVED] Arch Partition restored from Image / GRUB issues

IgnorantGuru wrote:

That's good you have it working.  I tend to think changing the active flag was just a coincidence and it had no effect on the problem.  Maybe just restoring it a second time did the trick.  Grub ignores the active flag in the partition table so it shouldn't make any difference.

That's what I thought, before this issue came up... This active-flag was the least I would think of, but... Anyways, just restored it (for testing sake) with "wrong" flags again [sda2 - active, sda1 - not] and got the same issue. smile Funny, huh?

[EDIT] I don't think it is grub, that causing that problem, but Clonezilla, that clones MBR and hidden data btw. MBR and the first partition statically "as is"...

Last edited by Mad Max (2009-12-02 17:48:02)

Offline

#22 2009-12-02 18:43:09

IgnorantGuru
Member
Registered: 2009-11-09
Posts: 640
Website

Re: [SOLVED] Arch Partition restored from Image / GRUB issues

That is strange - sounds like a Clonezilla bug.  ext4 filesystem corrupted if active setting changed?

Offline

#23 2009-12-02 19:20:52

Mad Max
Member
From: Germany
Registered: 2009-03-09
Posts: 39
Website

Re: [SOLVED] Arch Partition restored from Image / GRUB issues

IgnorantGuru wrote:

That is strange - sounds like a Clonezilla bug.  ext4 filesystem corrupted if active setting changed?

It's hard to say, but according to e2fsck, there are journalling errors and it recognizing that partition only as ext3. But partition still can be mounted manually (mount -t ext4 /dev/sda1 /mnt), so I don't think it is corrupted, but smth with journalling is...

Offline

Board footer

Powered by FluxBB