SOLVED: Software-RAID1 on sarge (AMD64) (was: Re: install-mbr on amd64?)

2006-05-28 Thread Kilian
root=/dev/sda1
alias=2
# END /etc/lilo.conf

That way, we still have LinuxOLD with which we can boot non-RAID
if it doesn't work out. If RAID is woking, this is strongly
discouraged, as it will cause problems with synchronization if we
boot directly from a disk out of a RAID array.


13. Run lilo
First, run

$ lilo -t -v

to see what lilo would do. If everything is OK do:

$ lilo -v
$ lilo -v -R RAID

When I ran this, lilo complained:

  Fatal: Filesystem would be destroyed by LILO boot sector: /dev/md0

Digging in the lilo sources revealed that lilo would spit out this
error if it discovers XFS, NTFS or SWAP on the boot sector of the
device and that it can be forced to go on anyway with the -F flag.
So I ran:

$ lilo -F -v
$ lilo -F -v -R RAID

and everything was OK.


14. Reboot and see if the system comes up properly. If it does, again
run

$ /lilo -v -F

Otherwise, on the next reboot, the non-RAID image would be booted
because we specified it with the -R flag.

Then reboot. Done:

 | $ mount
 | /dev/md0 on / type xfs (rw)
 | proc on /proc type proc (rw)
 | sysfs on /sys type sysfs (rw)
 | devpts on /dev/pts type devpts (rw,gid=5,mode=620)
 | tmpfs on /dev/shm type tmpfs (rw)
 | usbfs on /proc/bus/usb type usbfs (rw)

 |  $ cat /proc/mdstat
 | Personalities : [linear] [raid0] [raid1] [raid5] [raid4] [raid6]
 | [multipath]
 | md1 : active raid1 sdb2[1] sda2[0]
 |   1951808 blocks [2/2] [UU]
 |
 | md0 : active raid1 sdb1[1] sda1[0]
 |   154336320 blocks [2/2] [UU]
 |
 | unused devices: none


Because we use the raid-extra-boot=/dev/sda,/dev/sdb directive in 
lilo.conf, lilo writes the MBR on /dev/sda AND /dev/sdb. If the first 
disk fails, you can still boot from the second this way.


The MBRs are completely identical:

 | $ dd if=/dev/sda bs=512 count=1 | od -v | head -n 12
 | 1+0 records in
 | 1+0 records out
 | 512 bytes transferred in 0.44 seconds (11608020 bytes/sec)
 | 000 165772 000441 000665 044514 047514 003026 142057 042165
 | 020 00 00 00 00 122212 16 000203 070200
 | 040 027616 001121 140270 107007 136320 004000 051373 003123
 | 060 176126 154216 166461 134140 011000 033263 010315 130141
 | 100 164015 000547 005260 061350 130001 164114 000535 017140
 | 120 17 177372 001165 171210 000273 105002 017166 150211
 | 140 162200 030200 074340 036012 071420 173006 016106 072500
 | 160 104056 063362 073213 063030 173011 021564 132122 131010
 | 200 051600 011715 071133 007525 145266 077672 041000 030546
 | 220 040300 070350 063000 133473 000670 001564 167742 051532
 | 240 073212 137037 40 045350 132000 063231 077601 046374
 | 260 046111 072517 057047 100150 003410 155461 032350 072400
 |
 |
 | $ dd if=/dev/sdb bs=512 count=1 | od -v | head -n 12
 | 1+0 records in
 | 1+0 records out
 | 512 bytes transferred in 0.43 seconds (11930465 bytes/sec)
 | 000 165772 000441 000665 044514 047514 003026 142057 042165
 | 020 00 00 00 00 000534 034756 000203 070201
 | 040 027616 001121 140270 107007 136320 004000 051373 003123
 | 060 176126 154216 166461 134140 011000 033263 010315 130141
 | 100 164015 000547 005260 061350 130001 164114 000535 017140
 | 120 17 177372 001165 171210 000273 105002 017166 150211
 | 140 162200 030200 074340 036012 071420 173006 016106 072500
 | 160 104056 063362 073213 063030 173011 021564 132122 131010
 | 200 051600 011715 071133 007525 145266 077672 041000 030546
 | 220 040300 070350 063000 133473 000670 001564 167742 051532
 | 240 073212 137037 40 045350 132000 063231 077601 046374
 | 260 046111 072517 057047 100150 003410 155461 032350 072400



Thanks for all the help that I got, your comments are greatly appreciated!

-- Kilian


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: SOLVED: Software-RAID1 on sarge (AMD64)

2006-05-28 Thread Kilian

Michal Schmidt wrote:

Goswin von Brederlow wrote:

Kilian [EMAIL PROTECTED] writes:

5.  Copy the existing Debian system to the new RAID

 $ mkdir -p /mnt/newroot
 $ mount /dev/md0 /mnt/newroot
 $ cd /
 $ find . -xdev | cpio -pm /mnt/newroot


Fun, fun. A copy of /proc. That's a few Gig wasted depending on the
size of /proc/kcore.


Umm, that's prevented by the -xdev option, isn't it?


It is, since -xdev prevents find from descending directories on other 
filesystems, which is exactly what /proc is.


-- Kilian


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: SOLVED: Software-RAID1 on sarge (AMD64)

2006-05-28 Thread Kilian

Goswin von Brederlow wrote:

Kilian [EMAIL PROTECTED] writes:


In the last few days, I was struggling to convert a remote machine
with two identical SATA disks (sda and sdb) to a Software RAID
1. Especially the boot-part was tricky as I had no console access to
the machine. The whole procedure was done remotely via SSH. I use the
md tools (mdadm) and lilo as bootloader. I chose LILO because IMHO
it's more straightforward in this setup than GRUB and I have no other
Operating Systems I would want to boot.

The system was installed on the first disk, the second one has not
been used before. Those are the steps I went through:


1.  Install a Software-RAID capable kernel and boot the system with it;
 Install the md tools: 'apt-get install mdadm';


Meaning any Debian kernel. :)


True, mine had it as a module though, which meant initrd, and since I 
was working remote, I didn't want to bring in another pitfall which 
meant compiling the kernel with RAID support built into it.



2.  partition the second harddrive (sdb). I created two partitions, a
 large one at the beginning of the disk (sdb1) and a small
 swap-partition at the end (sdb2). I do not use separate /boot
 partitions.


NOTE: disk speed differs by around a factor of 2 between start and
end. Which one is the fast one can depend on the disk but usualy the
start is. Better swap there.


I didn't know that, thanks for the hint!


 NOTE: I do not use two swap spaces on the two disks; instead, I
 create a RAID array consisting of the two smaller partitions on the
 two discs and create the swap space on it. In case of a disk
 failure, I don't need to reboot the system because the swap space
 is also on RAID. Otherwise, a disk failure would toast one swap
 space, probably leaving the system in a unusable state until
 rebooted.


It would cause processes to segfault all over and take down the system.


I knew there was a reason ;-)


 Important: both partitions need to be of the type 0xFD Linux raid
 autodetect


Actualy not. mdadm can work just as well without it. Doesn't hurt though.


Didn't know that either, thanks.

[...]

 I use XFS as filesystem because it has such nice features as online
 resizing etc and is, IMHO, very stable and mature. Of course you can
 use whatever you like.


As does ext3, even more so.


Let's not start a filesystem flamewar, you'd propably win ;-)


5.  Copy the existing Debian system to the new RAID

 $ mkdir -p /mnt/newroot
 $ mount /dev/md0 /mnt/newroot
 $ cd /
 $ find . -xdev | cpio -pm /mnt/newroot


Fun, fun. A copy of /proc. That's a few Gig wasted depending on the
size of /proc/kcore.


As pointed out by Michael Schmidt, -xdev takes care of that. Of course 
if there are several filesystems on the original disk, you'd have to 
copy each separately.


Thanks for your suggestions!

-- Kilian


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: install-mbr on amd64?

2006-05-20 Thread Kilian

Goswin von Brederlow wrote:

Kilian [EMAIL PROTECTED] writes:


Goswin von Brederlow wrote:

[...]

I went ahead and fixed mbr up for amd64. Apart from the obvious
(Build-depends, gcc -m32) I also fixed up some of the more serious
warnings and included running the testsuite as much as possible.
The package compiles but someone has to risk his/her system and
install the mbr now.

Thanks a lot for your work! I'd be willing to do that, unfortunately
it doesn't compile on my box; I get:

Making all in harness
make[1]: Entering directory `/usr/local/src/mbr-1.1.5.orig/harness'
gcc -DPACKAGE=\mbr\ -DVERSION=\1.1.5\  -I. -I.  -Wall
-Wstrict-prototypes -Wmissing-prototypes -g -c bios.c


Did you apply the patch?


Here is what I did:

 $ apt-get source mbr
 $ tar xzvf mbr_1.1.5.orig.tar.gz
 $ cd mbr-1.1.5.orig
 $ zcat ../mbr_1.1.5-2.diff.gz | patch -p1
 $ patch -p1  ../mbr-x86_64.patch   # your patch
 $ ./configure
 $ make

Both patches applied smoothly, no rejects at all.


This should be gcc -m32 there. Without it it will create 64bit code
which won't work.


Hm. Should this flag '-m32' be in your patch? Because I don't find it 
there..



In file included from bios.c:2:
vm86.h:4:22: asm/vm86.h: No such file or directory


sh-3.1# cat /usr/include/asm/vm86.h 
/* All asm/ files are generated and point to the corresponding

 * file in asm-x86_64 or asm-i386.
 */

#ifdef __i386__
# include asm-i386/vm86.h
#else
# error This header is not available for x86_64
#endif


$ cat /usr/include/asm/vm86.h
cat: /usr/include/asm/vm86.h: No such file or directory

sh-3.1# dpkg -S /usr/include/asm/vm86.h 
linux-kernel-headers: /usr/include/asm/vm86.h


$ dpkg -S /usr/include/i386-linux/asm/vm86.h
linux-kernel-headers: /usr/include/i386-linux/asm/vm86.h


And you don't seem to be on sid. I don't have that file either on
sarge so it won't work there.


OK, does that mean that there is no reasonable way I can get mbr on 
sarge to compile?



http://mrvn.homeip.net/mbr/mbr_1.1.5-2.1_amd64.deb


This won't install here:

$ dpkg -i mbr_1.1.5-2.1_amd64.deb
(Reading database ... 18347 files and directories currently installed.)
Preparing to replace mbr 1.1.5-2.1 (using mbr_1.1.5-2.1_amd64.deb) ...
Unpacking replacement mbr ...
dpkg: dependency problems prevent configuration of mbr:
 mbr depends on libc6-i386 (= 2.3.5-1); however:
  Package libc6-i386 is not installed.
dpkg: error processing mbr (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mbr


And I can't install libc6-i386 on my system:

Package libc6-i386 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package libc6-i386 has no installation candidate


I'm really stuck. Apparently lilo would be the best choice because it 
supports md-devices, right? But I can't use lilo because I don't have a 
working install-mbr.


I would give grub a try, but I am not quite sure about the steps 
required for this. First off, the NEWS says that since 0.90 - 
2001-07-11, Linux software RAID support is added (only for RAID-1). 
Well great, I have (or better want) a RAID-1. But everything I read 
about grub and RAID talks of sda/sdb or the like, not of mdX. Does grub 
support it, but not really, or what?


Now, is it sufficient if I run

  grub-install --root-directory=/boot --no-floppy /dev/sda
  grub-install --root-directory=/boot --no-floppy /dev/sdb

? There exists no menu.lst, device.map or whatever on my system yet, do 
I have to manually set them up before running grub-install? If yes, how 
should they look like? I would figure device.map needs to state


  (hd0) /dev/sda
  (hd1) /dev/sdb

But how does menu.lst have to look like?

My fstab for the RAID system will look like this:

 /dev/md0   /boot   xfs defaults0  0
 /dev/md1   noneswapswap
 /dev/md2   /   xfs defaults0  0
 /dev/md3   /home   xfs defaults0  0
 /dev/md4   /varxfs defaults0  0
 /dev/md5   /var/logxfs defaults0  0
 /dev/md6   /var/tmpxfs defaults0  0
 /dev/md7   /tmpxfs defaults0  0
 proc   /proc   proc

Thanks very much for your time, I really appreciate the help I've gotten 
from all you guys so far very much!


-- Kilian


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: install-mbr on amd64?

2006-05-19 Thread Kilian

Goswin von Brederlow wrote:

tag 330190 + patch
thanks

Kilian [EMAIL PROTECTED] writes:


Dear All,

I'm trying to set up a software RAID 1 (two disks) with Debian on a
system with an AMD x86_64 Athlon processor. To install the MBR on both
discs, I need install-mbr (http://packages.debian.org/stable/base/mbr)
if I'm correct, but this package does not exist in the amd64 port... I
then tried to compile it myself, which fails, obviously, because the
package has not been ported to x86_64 yet as it seems (and I lack the
knowledge to do so...).

I'm a bit stuck now.. what other tools can I use?

Thanks for any hint!

Greetz,
Kilian


I went ahead and fixed mbr up for amd64. Apart from the obvious
(Build-depends, gcc -m32) I also fixed up some of the more serious
warnings and included running the testsuite as much as possible.

The package compiles but someone has to risk his/her system and
install the mbr now.


Thanks a lot for your work! I'd be willing to do that, unfortunately it 
doesn't compile on my box; I get:


Making all in harness
make[1]: Entering directory `/usr/local/src/mbr-1.1.5.orig/harness'
gcc -DPACKAGE=\mbr\ -DVERSION=\1.1.5\  -I. -I.  -Wall 
-Wstrict-prototypes -Wmissing-prototypes -g -c bios.c

In file included from bios.c:2:
vm86.h:4:22: asm/vm86.h: No such file or directory
bios.c: In function `handle_int_10':
bios.c:73: error: dereferencing pointer to incomplete type
[...]
bios.c: In function `handle_int_e4':
bios.c:243: error: dereferencing pointer to incomplete type
bios.c:243: error: dereferencing pointer to incomplete type
make[1]: *** [bios.o] Error 1
make[1]: Leaving directory `/usr/local/src/mbr-1.1.5.orig/harness'
make: *** [all-recursive] Error 1

Obviously, asm/vm86.h is not found; I located this file in 
/usr/include/i386-linux/asm, tried to be ugly and changed the include 
statement in bios.c to the full path of vm86.h, but then I get:


Making all in harness
make[1]: Entering directory `/usr/local/src/mbr-1.1.5.orig/harness'
gcc -DPACKAGE=\mbr\ -DVERSION=\1.1.5\  -I. -I.  -Wall 
-Wstrict-prototypes -Wmissing-prototypes -g -c bios.c

bios.c: In function `handle_int_13':
bios.c:103: error: `CF' undeclared (first use in this function)
bios.c:103: error: (Each undeclared identifier is reported only once
bios.c:103: error: for each function it appears in.)
bios.c: In function `handle_int_16':
bios.c:214: error: `ZF' undeclared (first use in this function)
make[1]: *** [bios.o] Error 1
make[1]: Leaving directory `/usr/local/src/mbr-1.1.5.orig/harness'
make: *** [all-recursive] Error 1

I'm really sorry but my knowledge does not go that far as making a smart 
interpretation of the above... can you help?


Linux 2.6.8-11-amd64-k8, x86_64, Debian Sarge, gcc version 3.3.5 (Debian 
1:3.3.5-13)


Thanks a lot!

-- Kilian


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



install-mbr on amd64?

2006-05-18 Thread Kilian

Dear All,

I'm trying to set up a software RAID 1 (two disks) with Debian on a 
system with an AMD x86_64 Athlon processor. To install the MBR on both 
discs, I need install-mbr (http://packages.debian.org/stable/base/mbr) 
if I'm correct, but this package does not exist in the amd64 port... I 
then tried to compile it myself, which fails, obviously, because the 
package has not been ported to x86_64 yet as it seems (and I lack the 
knowledge to do so...).


I'm a bit stuck now.. what other tools can I use?

Thanks for any hint!

Greetz,
Kilian


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: install-mbr on amd64?

2006-05-18 Thread Kilian

Scott Reese wrote:

Kilian wrote:

Dear All,

I'm trying to set up a software RAID 1 (two disks) with Debian on a
system with an AMD x86_64 Athlon processor. To install the MBR on both
discs, I need install-mbr (http://packages.debian.org/stable/base/mbr)
if I'm correct, but this package does not exist in the amd64 port... I
then tried to compile it myself, which fails, obviously, because the
package has not been ported to x86_64 yet as it seems (and I lack the
knowledge to do so...).

I'm a bit stuck now.. what other tools can I use?



You don't say what boot loader you're using, but if you are using grub,
you can simply install the MBR to the second disk using the grub terminal.


Thanks a lot for your reply!

I'm using lilo as bootloader, but as grub is way more modern, I might 
just switch to grub.


The thing is, the machine I'm working on is remote and I have no console 
access, so everything is a bit tricky. It's already running, has two 
identical SATA disks, the second one (sdb) is not used. What I want to 
do is create a RAID 1 array with only sdb (but with the possibility to 
add sda later). Then I boot from this new RAID array, repartition sda 
and add it to the RAID array. I've gotten so far as setting up the RAID 
array, chrooting into it and bootstrap a Debian system on it, compile an 
new kernel, but when it comes to set up bootloaders, the howto I'm using 
http://juerd.nl/site.plp/debianraid tells me to run:


 $ lilo
 $ install-mbr /dev/sda
 $ install-mbr /dev/sdb

Do you think I could accomplish the same result by only using grub?

-- Kilian


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]