need some help very strange behavior mdadm writes data to non raid disk?
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 33 lines · NeilBrown
Quoted 18 lines · Jelle de Jong
This message contains the following attachment(s):
debug-mdadm.txt
setup-mdadm.txtDear Neil,
Thank you for creating mdadm. I am creating my first raid1 array and got some very confusing issues.
My raid1 md0 array should consist out of disks:
/dev/sda1/dev/sdb1These are 749GB ext3 partitions in mirroring mode.
However when I reboot my system, mdadm tells me everything is fine and is correctly using sda1 and sdb1.
Quoted 7 lines
But it is not using a 749GB partition, it is using the same partition size as my
/dev/sdc1? and when I write a test file to the root dir and then mount/dev/sdc1the file is there also. So md0 is directly connected with/dev/sdc1. It does not make any sens to me.Can you please look at my debug en setup file that i created and maybe see something that is going wrong?
It is fairly clear that you are still booting off
/dev/sdc1and that is being mounted as the root filesystem.
You probably need to run "mkinitramfs" or something like that to create a new ramfs which mounts/dev/md0instead of/dev/sdc.
Quoted 5 lines
If you don't know how to do that, trying asking on
[email protected]NeilBrown
Thank you for your eye opener :-D
I totally overlooked the grub menu file. I know have a working system, I removed the /dev/sdc1 and now running on raid array only :-D
Thank for your support.
PS. I attached my complete configuration routine as attachment, if you see something wrong/dangerous/advice please notify me.
Kind regards,
Jelle de Jong
# information:
# http://www.howtoforge.com/software-raid1-grub-boot-debian-etch-p4
apt-get install mdadm
# step 1: setup partitions sizes on the first disk parted /dev/sda mklabel msdos mkpart primary 0 749GB mkpart primary 749GB 750GB toggle 1 boot print quit
# step 2: copy partition table from sda to sdb sfdisk -d /dev/sda | sfdisk /dev/sdb
# step 3: create raid mirroring setup mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1 mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sda2 /dev/sdb2
# step 4: create file systems on the first disk partitions mkfs.ext3 /dev/md0 mkswap /dev/md1
# step 5: create the mdadm configuration file # mdadm --detail --scan --verbose > /etc/mdadm.conf mdadm --detail --scan --verbose > /etc/mdadm/mdadm.conf dpkg-reconfigure mdadm
# step 6: watch how the reconstruction of the array's watch cat /proc/mdstat
# step 7: change fstab cat > /etc/fstab << "EOF" UUID=10a11e44-a958-4d14-ae56-adf9af7c5c28 / reiserfs notail 0 1 UUID=89162427-3092-48af-93f0-9123a4e031ea none swap sw 0 0 /dev/md0 /media/disk ext3 defaults 0 0 /dev/md1 none swap sw 0 0 proc /proc proc defaults 0 0 EOF
# step 8: create mount directory and mount disks mkdir /media/disk mount -a touch /media/disk/test.txt ls -hal /media/disk
# step 8: reboot the system and check raid disk are mounted shutdown -r now ls -hal /media/disk
# step 9: setup boot flags on disk parted /dev/sdc toggle 1 boot print quit
# step 10: change fstab cat > /etc/fstab << "EOF" /dev/md0 / ext3 defaults 0 1 /dev/md1 none swap sw 0 0 proc /proc proc defaults 0 0 EOF
# step 11: setup grub to boot from raid array find='# groot=.*' replace='# groot=(hd0,0)' sed -i -e "s%$find%$replace%g" /boot/grub/menu.lst find='# kopt=root=.* ro' replace='# kopt=root=/dev/sdc1 ro' sed -i -e "s%$find%$replace%g" /boot/grub/menu.lst find='# defoptions=.*' replace='# defoptions=quiet noresume' sed -i -e "s,$find,$replace,g" /boot/grub/menu.lst update-grub
update-initramfs -u
# step 12: install bootloaders on disks grub root (hd0,0) setup (hd0) root (hd1,0) setup (hd1) root (hd2,0) setup (hd2) quit
# step 13: change to runlevel 1 to prepare for copying init 1
# step 14: copy root directory rsync -aqxP / /media/disk # cp -ax / /media/disk
# step 15: reboot the system shutdown -r now
-- -- -- --
# notes:
tune2fs -j
sfdisk -d /dev/sdb > partitions.sdb
sfdisk /dev/sdb < partitions.sdb
mdadm -S /dev/md0
mdadm -S /dev/md1
mdadm -S /dev/md2
mdadm /dev/md0 --fail /dev/sda1 --remove /dev/sda1 mdadm /dev/md1 --fail /dev/sda2 --remove /dev/sda2 mdadm /dev/md2 --fail /dev/sda3 --remove /dev/sda3
mdadm /dev/md0 --fail /dev/sdb1 --remove /dev/sdb1 mdadm /dev/md1 --fail /dev/sdb2 --remove /dev/sdb2 mdadm /dev/md2 --fail /dev/sdb3 --remove /dev/sdb3
mdadm --zero-superblock /dev/sdb1
mdadm --zero-superblock /dev/sdb2
mdadm --zero-superblock /dev/sdb3