[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
GRUB overwriting partition tables
From: |
René Herman |
Subject: |
GRUB overwriting partition tables |
Date: |
Wed, 29 Jul 2009 04:25:07 +0200 |
User-agent: |
Thunderbird 2.0.0.21 (X11/20090325) |
Good day.
Yesterday I installed the recent Zenwalk 6.2 beta:
http://www.zenwalk.org/modules/news/article.php?storyid=99
which is the first Zenwalk release to feature GRUB(2) instead of LILO.
Unfortunately the installation, on a dedicated test partition, destroyed
my system by breaking the partitioning.
More specifically, what happened is that not just the MBR (meaning
sector 0 here) where I chose to install GRUB2 but also sector 1 got
overwritten somehow.
Given an admittedly somewhat peculiar partitioning scheme, this had the
very bad effect of breaking the chain of logical partitions, right at
the start, and thereby rendering all logical partitions with my working
OS and data inaccessible. I managed to restore sector 1, but really only
because I also knew that my first logical was exactly 8G in size.
The trigger is most likely me not cylinder-aligning partitions. Nothing
else in Linux insists on doing such and in fact, this is how "sfdisk"
creates the chain directly. This is my partition layout:
Device Boot Start End #sectors Id System
/dev/sda1 1 692272486 692272486 85 Linux extended
/dev/sda2 692272487 976773167 284500681 7 HPFS/NTFS
/dev/sda3 0 - 0 0 Empty
/dev/sda4 0 - 0 0 Empty
/dev/sda5 2 16777217 16777216 82 Linux swap
/dev/sda6 16777219 33554434 16777216 83 Linux
/dev/sda7 33554436 50331651 16777216 83 Linux
/dev/sda8 50331653 67108868 16777216 83 Linux
/dev/sda9 67108870 379690677 312581808 83 Linux
/dev/sda10 379690679 692272486 312581808 83 Linux
Since I often have multiple operating systems installed -- at the moment
only Linux and the Windows 7 RC but sometimes also MINIX or BSD variants
-- all of which need at least 1 primary partition, I use the 0x85 "Linux
Extended" type as "the one and only true" Linux partition, with the
actual data partitions as "subpartitions" (or "slices" in BSD
terminology) on logicals inside.
Linux is also my main system, so it's the first primary, meaning the
chain of logicals also starts at the beginning of the disk. In this case:
MBR (sec0) --> EXT (sec1) --> 16777218 --> and so on.
After realizing what the problem was exactly, and knowing that /dev/sda5
was exactly 16777216 sectors in size, I could restore sector 1 but until
that point I wasn't particularly happy about seeing my partitions gone
(as an aside, not cylinder aligning but making my partitions these exact
easily remembered sizes has saved my butt several times while playing
around with beta or old operating systems).
The Zenwalk 6.2 beta install gives the possibility to install GRUB into
the MBR, into the bootblock of the install partition, /dev/sda7 in my
case, and onto a device of your own choosing. I chose the MBR and after
finishing up the installation, I rebooted only to be told by GRUB that
it couldn't find sda7. After seeing what the problem was, I actually
looked at sector 1 in a disk editor, and it indeed got overwritten.
I'm now in my main system on /dev/sda6, and am booting the beta system
on /dev/sda7 with LILO, which works fine. Below is a copy of the
"grub.cfg" as generated by the installer. GRUB version seems to be
"grub2-svn2383".
Now that I know how to fix things again, I can if really needed repeat
the process and gather any requested information while the system is
hosing itself. If any is requested, please guide me what, and when in
the process, it is needed.
Thanks in advance to anyone interested in getting to the bottom of this;
I'd like to keep running zenwalk...
Rene.
== GRUB.CFG ==
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
set default=0
set timeout=5
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/10_linux ###
menuentry "Zenwalk GNU/Linux" {
set root=
linux16 /boot/vmlinuz root=/dev/sda7 ro splash=silent
resume=/dev/sda5 vga=794
initrd16 /boot/initrd.splash
}
menuentry "Zenwalk GNU/Linux (recovery mode)" {
set root=
linux16 /boot/vmlinuz root=/dev/sda7 ro 1
initrd16 /boot/initrd.splash
}
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/30_os-prober ###
menuentry "zenwalk (on /dev/sda6)" {
set root=
linux /boot/zenwalk root=/dev/sda6 ro resume=/dev/sda5
splash=silent
initrd /boot/initrd.splash
}
### END /etc/grub.d/30_os-prober ###
### BEGIN /etc/grub.d/40_custom ###
# This file is an example on how to add custom entries
### END /etc/grub.d/40_custom ###
- GRUB overwriting partition tables,
René Herman <=