[Eisfair] Software-Raid-1 mit ext4

Jürgen Witt j-witt at web.de
Sa Jul 5 14:11:03 CEST 2014


Hallo Marcus,

Am 05.07.2014 12:18, schrieb Marcus Roeckrath:
>> Dokumentation). Ich bin noch beim Stand von Seite 75 bzw. 77
>
> Mich irritiert, dass Du beim mount mdX verwendet hast und hier nun wieder
> sdaX.

steht so aber in der Dokumentation (1. Bild auf Seite 75).

ich habe jetzt meine komplette Vorgehensweise noch einmal dokumentiert.

eis # sgdisk -R/dev/sdb /dev/sda
The operation has completed successfully.
eis # sgdisk -G /dev/sdb
The operation has completed successfully.
eis # mdadm --zero-superblock /dev/sdb1
eis # mdadm --zero-superblock /dev/sdb2
eis # mdadm --zero-superblock /dev/sdb3
eis # mdadm --zero-superblock /dev/sdb4
eis # mdadm --create /dev/md1 --bitmap=internal --level=1 
--metadata=0.90 --raid-disks=2 missing /dev/sdb1
mdadm: /dev/sdb1 appears to contain an ext2fs file system
     size=49088K  mtime=Sat Jul  5 12:27:53 2014
Continue creating array? y
mdadm: array /dev/md1 started.
eis # mdadm --create /dev/md2 --bitmap=internal --level=1 --raid-disks=2 
missing /dev/sdb2
mdadm: Note: this array has metadata at the start and
     may not be suitable as a boot device.  If you plan to
     store '/boot' on this device please ensure that
     your boot-loader understands md/v1.x metadata, or use
     --metadata=0.90
Continue creating array? y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md2 started.
eis # mdadm --create /dev/md3 --bitmap=internal --level=1 --raid-disks=2 
missing /dev/sdb3
mdadm: Note: this array has metadata at the start and
     may not be suitable as a boot device.  If you plan to
     store '/boot' on this device please ensure that
     your boot-loader understands md/v1.x metadata, or use
     --metadata=0.90
Continue creating array? y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md3 started.
eis # mdadm --create /dev/md4 --bitmap=internal --level=1 --raid-disks=2 
missing /dev/sdb4
mdadm: Note: this array has metadata at the start and
     may not be suitable as a boot device.  If you plan to
     store '/boot' on this device please ensure that
     your boot-loader understands md/v1.x metadata, or use
     --metadata=0.90
Continue creating array? y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md4 started.

eis # cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] 
[raid4] [multipath]
md4 : active raid1 sdb4[1]
       63426496 blocks super 1.2 [2/1] [_U]
       bitmap: 0/1 pages [0KB], 65536KB chunk

md3 : active raid1 sdb3[1]
       10477440 blocks super 1.2 [2/1] [_U]
       bitmap: 0/1 pages [0KB], 65536KB chunk

md2 : active raid1 sdb2[1]
       4143040 blocks super 1.2 [2/1] [_U]
       bitmap: 0/1 pages [0KB], 65536KB chunk

md1 : active raid1 sdb1[1]
       49088 blocks [2/1] [_U]
       bitmap: 0/1 pages [0KB], 65536KB chunk

unused devices: <none>

eis # mkfs.ext4 /dev/md1
mke2fs 1.42.8 (20-Jun-2013)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
12288 inodes, 49088 blocks
2454 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=50331648
6 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
         8193, 24577, 40961

Allocating group tables: done
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

eis # mkfs.ext4 /dev/md3
mke2fs 1.42.8 (20-Jun-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
655360 inodes, 2619360 blocks
130968 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2684354560
80 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
         32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

eis # mkfs.ext4 /dev/md4
mke2fs 1.42.8 (20-Jun-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
3964928 inodes, 15856624 blocks
792831 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
484 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
         32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 
2654208,
         4096000, 7962624, 11239424

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

eis # mkswap /dev/md2
mkswap: /dev/md2: warning: wiping old swap signature.
Setting up swapspace version 1, size = 4143036 KiB
no label, UUID=9d77e199-128c-4aa1-b201-08d91ee4d1c9

eis # sed -e 's/\/sbin\/fsck/#\/sbin\/fsck/g' \
 >            /etc/init.d/boot  > /tmp/boot && \
 >            cp /tmp/boot /etc/init.d/boot

eis # mount -t ext4 /dev/md3 /mnt
eis # mkdir -p /mnt/boot
eis # mount -t ext4 /dev/md1 /mnt/boot

eis # mount
/dev/sda3 on / type ext4 (rw,errors=remount-ro,acl,user_xattr)
/dev/sda1 on /boot type ext4 (rw,errors=remount-ro)
/dev/sda4 on /data type ext4 (rw,acl,user_xattr)
devpts on /dev/pts type devpts (rw)
usbfs on /proc/bus/usb type usbfs (rw)
/sys on /sys type sysfs (rw)
/dev/md3 on /mnt type ext4 (rw)
/dev/md1 on /mnt/boot type ext4 (rw)

eis # cd /
eis # find . -xdev | cpio -pmv /mnt
eis # cd /boot
eis # find . -xdev | cpio -pmv /mnt/boot

Die Ausgabe spare ich mir hier.

mcedit /mnt/etc/fstab

eis # cat /mnt/etc/fstab
/dev/md3 / ext4 defaults,errors=remount-ro 0 1
/dev/md1 /boot ext4 defaults,errors=remount-ro 0 1
/dev/md2 none swap sw 0 0
/dev/md4 /data ext4 defaults 0 2
proc        /proc          proc      defaults                 0 0
/dev/fd0    /media/floppy         auto      defaults,user,noauto     0 0
/dev/cdrom  /media/cdrom          iso9660   defaults,ro,user,noauto  0 0
devpts      /dev/pts       devpts    defaults                 0 0
usbfs       /proc/bus/usb  usbfs     defaults                 0 0
/sys        /sys           sysfs     defaults                 0 0

eis # cd /
eis # umount /boot
eis # mount /dev/sda1 /mnt/boot

eis # mount
/dev/sda3 on / type ext4 (rw,errors=remount-ro,acl,user_xattr)
/dev/sda4 on /data type ext4 (rw,acl,user_xattr)
devpts on /dev/pts type devpts (rw)
usbfs on /proc/bus/usb type usbfs (rw)
/sys on /sys type sysfs (rw)
/dev/md3 on /mnt type ext4 (rw)
/dev/md1 on /mnt/boot type ext4 (rw)
/dev/sda1 on /mnt/boot type ext4 (rw)

eis # mcedit /mnt/etc/lilo.conf

eis # cat /mnt/etc/lilo.conf
lba32
disk = /dev/sda
   bios = 0x80
boot = /dev/sda
read-only
prompt
timeout = 50
vga = normal
menu-scheme = wr:bw:wr:Yr
image = /boot/kernel
root = /dev/md3
label = eis
initrd = /boot/initrd.gz
append = "raid=noautodetect"
image = /boot/old-kernel
root = /dev/sda3
label = oldeis
initrd = /boot/old-initrd.gz
append = "raid=noautodetect"

eis # mkdir -p /tmp/initrd/init
eis # cd /tmp/initrd
eis # cp -a /mnt/boot/initrd.gz .
eis # gzip -d initrd.gz
eis # modprobe loop
eis # mount -o loop initrd init
eis # mcedit init/linuxrc
eis # cat init/linuxrc
#! /bin/sh
/bin/echo -e "\033[32m\033[49mLoading Input/USB/SCSI/SATA/RAID drivers 
...\033[0m"
/sbin/insmod /lib/modules/2.6.32-eisfair-1-SMP/psmouse.ko
/sbin/insmod /lib/modules/2.6.32-eisfair-1-SMP/usbcore.ko
/sbin/insmod /lib/modules/2.6.32-eisfair-1-SMP/ehci-hcd.ko
/sbin/insmod /lib/modules/2.6.32-eisfair-1-SMP/uhci-hcd.ko
/sbin/insmod /lib/modules/2.6.32-eisfair-1-SMP/ssb.ko
/sbin/insmod /lib/modules/2.6.32-eisfair-1-SMP/ohci-hcd.ko
/sbin/insmod /lib/modules/2.6.32-eisfair-1-SMP/xhci.ko
/sbin/insmod /lib/modules/2.6.32-eisfair-1-SMP/hid.ko
/sbin/insmod /lib/modules/2.6.32-eisfair-1-SMP/usbhid.ko
/sbin/insmod /lib/modules/2.6.32-eisfair-1-SMP/scsi_mod.ko
/sbin/insmod /lib/modules/2.6.32-eisfair-1-SMP/sd_mod.ko
/sbin/insmod /lib/modules/2.6.32-eisfair-1-SMP/libata.ko
/sbin/insmod /lib/modules/2.6.32-eisfair-1-SMP/ahci.ko
/bin/echo -e "\033[32m\033[49mWaiting for SCSI/SATA devices coming up 
...\033[0m"
/bin/sleep 10
/sbin/raidautorun /dev/md1

eis # umount init
eis # gzip -9 initrd
eis # cp initrd.gz /mnt/boot

eis # cd /
eis # lilo -v -v -r /mnt
LILO version 23.2 eisfair-1 (released 09-Apr-2011)
   * Copyright (C) 1992-1998 Werner Almesberger  (until v20)
   * Copyright (C) 1999-2007 John Coffman  (until v22)
   * Copyright (C) 2009-2011 Joachim Wiedorn  (since v23)
This program comes with ABSOLUTELY NO WARRANTY. This is free software
distributed under the BSD License (3-clause). Details can be found in
the file COPYING, which is distributed with this software.
Compiled at 14:19:35 on Feb  3 2013
Running Linux kernel 2.6.32-eisfair-1-SMP on i686

raid_setup returns offset = 00000000  ndisk = 0
  BIOS   VolumeID   Device
Reading boot sector from /dev/sda
pf_hard_disk_scan: ndevs=2
/boot/boot.0810 exists - no master disk volume ID record backup copy made.
   0800  39EE015C  /dev/sda
   0810  1139F0EB  /dev/sdb
device codes (user assigned pf) = 1
device codes (user assigned) = 1
device codes (BIOS assigned) = 1
device codes (canonical) = 3
mode = 0x03,  columns = 80,  rows = 25,  page = 0
Using MENU secondary loader
Calling map_insert_data
Secondary loader: 18 sectors (0x3600 dataend).
bios_boot = 0x80  bios_map = 0x80  map==boot = 0  map S/N: 39EE015C
BIOS data check was okay on the last boot

Boot image: /boot/kernel
Setup length is 23 sectors.
Mapped 4065 sectors.
Mapping RAM disk /boot/initrd.gz
RAM disk: 2384 sectors.
The initial RAM disk will be loaded in the low memory below 15M.
Added eis  *

Boot image: /boot/old-kernel
Setup length is 23 sectors.
Mapped 4094 sectors.
Mapping RAM disk /boot/old-initrd.gz
RAM disk: 2386 sectors.
The initial RAM disk will be loaded in the low memory below 15M.
Added oldeis

  BIOS   VolumeID   Device
   80    39EE015C    0800
   81    1139F0EB    0810
Writing boot sector.
/boot/boot.0800 exists - no boot sector backup copy made.
Map file size: 80896 bytes.
RAID device mask 0x0000

eis # umount /dev/sda1
eis # mount /dev/sda1 /boot
eis # cp -a /boot/initrd.gz /mnt/boot

eis # mount
/dev/sda3 on / type ext4 (rw,errors=remount-ro,acl,user_xattr)
/dev/sda4 on /data type ext4 (rw,acl,user_xattr)
devpts on /dev/pts type devpts (rw)
usbfs on /proc/bus/usb type usbfs (rw)
/sys on /sys type sysfs (rw)
/dev/md3 on /mnt type ext4 (rw)
/dev/md1 on /mnt/boot type ext4 (rw)
/dev/sda1 on /boot type ext4 (rw)

eis # reboot

Ergebnis:

raid1: raid1 set md1 active with 1 out of 2 mirrors
md1: bitmap initialized form disk: read 1/1 pages, set 1 bits
created bitmap (1 pages) for device md1
md1: detected capacity change from 0 to 50266112
md: ... autorun DONE.
EXT3-fs: unable to read superblock
EXT2-fs: unable to read superblock
EXT4-fs (md3): unable to read superblock
FAT: unable to read boot sector
VFS: Cannot open root device "903" or unknown-block(9,3)
Please append a correct "root=" boot option; here are the available 
partitions:
0800        78150744 sda driver: sd
  0801            49152 sda1
  0802            4145152 sda2
  0803           10485760 sda3
  0804           63459399 sda4
0810        78150744 sdb driver: sd
  0811            49152 sdb1
  0812            4145152 sdb2
  0813           10485760 sdb3
  0814           63459399 sdb4
Kernel panic - not syncing: VFS: Unable to mount root fs on 
unkown-block(9,3)
Pid: 1, comm: swapper Not tainted 2.6.32-eisfair-1-SMP #1

Gruß
Jürgen


Mehr Informationen über die Mailingliste Eisfair