linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jelle de Jong <jelledejong@powercraft.nl>
To: linux-raid@vger.kernel.org
Cc: NeilBrown <neilb@suse.de>
Subject: Re: need some help very strange behavior mdadm writes data to non raid disk?
Date: Sun, 15 Jun 2008 17:46:38 +0200	[thread overview]
Message-ID: <4855395E.2060106@powercraft.nl> (raw)
In-Reply-To: <38924.192.168.1.70.1213526332.squirrel@neil.brown.name>

[-- Attachment #1: Type: text/plain, Size: 1646 bytes --]

NeilBrown wrote:
> On Sun, June 15, 2008 7:27 pm, Jelle de Jong wrote:
>> This message contains the following attachment(s):
>> debug-mdadm.txt
>> setup-mdadm.txt
>>
>> Dear 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/sdb1
>>
>> These 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.
>>
>> 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/sdc1 the 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/sdc1 and 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/md0 instead of /dev/sdc.
> 
> If you don't know how to do that, trying asking on
>    linux-raid@vger.kernel.org
> 
> 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

[-- Attachment #2: set-up - server ashley - mdadm raid.txt --]
[-- Type: text/plain, Size: 3141 bytes --]

# 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

       reply	other threads:[~2008-06-15 15:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4854E067.5030205@powercraft.nl>
     [not found] ` <38924.192.168.1.70.1213526332.squirrel@neil.brown.name>
2008-06-15 15:46   ` Jelle de Jong [this message]
2008-06-15  9:33 need some help very strange behavior mdadm writes data to non raid disk? Jelle de Jong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4855395E.2060106@powercraft.nl \
    --to=jelledejong@powercraft.nl \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).