This message contains the following attachment(s):
debug-mdadm.txt
setup-mdadm.txt
Hello everybody
Thank you for supporting 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 disk 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 somebody please look at my debug en setup file that i created and
maybe see something that is going wrong?
Thanks in advance,
Jelle de Jong
ps. I am mailing this address directly please cc me in a reply
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
# 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 1
/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: change to runlevel 1 to prepare for copying
init 1
# step 9: copy root directory
rsync -aqxP / /media/disk
# cp -ax / /mnt/newroot
# step 10: setup boot flags on disk
parted /dev/sdc
toggle 1 boot
print
quit
# step 11: 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 12: 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
touch /testfile-a.txt
ls -hal /testfile-a.txt
-rw------- 1 root root 0 2008-06-15 11:10 /testfile-a.txt
mount /dev/sda1 /media/sda1/
mount: unknown filesystem type 'linux_raid_member'
mount /dev/sdb1 /media/sdb1/
mount: unknown filesystem type 'linux_raid_member'
mount /dev/sdc1 /media/sdc1/
ls -hal /media/sdc1/testfile-a.txt
-rw------- 1 root root 0 2008-06-15 11:10 /media/sdc1/testfile-a.txt
-- -- -- -- --
df -hal
Filesystem Size Used Avail Use% Mounted on
/dev/md0 296G 284G 12G 97% /
/dev/sdc1 296G 284G 12G 97% /media/sdc1
df -halT
Filesystem Type Size Used Avail Use% Mounted on
/dev/md0 ext3 296G 284G 12G 97% /
/dev/sdc1 reiserfs 296G 284G 12G 97% /media/sdc1
-- -- -- -- --
cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md0 : active raid1 sda1[0] sdb1[1]
731447360 blocks [2/2] [UU]
md1 : active raid1 sda2[0] sdb2[1]
1124480 blocks [2/2] [UU]
unused devices: <none>
-- -- -- -- --
cat /etc/fstab
/dev/md0 / ext3 defaults 0 1
/dev/md1 none swap sw 0 0
proc /proc proc defaults 0 0
-- -- -- -- --
cat /etc/mdadm/mdadm.conf
ARRAY /dev/md1 level=raid1 num-devices=2 UUID=a8df884e:703cf3bc:109b2f78:2d361e62
devices=/dev/sda2,/dev/sdb2
ARRAY /dev/md0 level=raid1 num-devices=2 UUID=da5e027a:506d3587:109b2f78:2d361e62
devices=/dev/sda1,/dev/sdb1
-- -- -- -- --
fdisk -l
Disk /dev/sda: 750.1 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00010329
Device Boot Start End Blocks Id System
/dev/sda1 * 1 91061 731447451 83 Linux
/dev/sda2 91062 91201 1124550 83 Linux
Disk /dev/sdb: 750.1 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00010329
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 91061 731447451 83 Linux
/dev/sdb2 91062 91201 1124550 83 Linux
Disk /dev/md1: 1151 MB, 1151467520 bytes
2 heads, 4 sectors/track, 281120 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0xe8eb5d88
Disk /dev/md1 doesn't contain a valid partition table
Disk /dev/md0: 749.0 GB, 749002096640 bytes
2 heads, 4 sectors/track, 182861840 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000
Disk /dev/md0 doesn't contain a valid partition table
Disk /dev/sdc: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0004e3f2
Device Boot Start End Blocks Id System
/dev/sdc1 1 38562 309749233+ 83 Linux
/dev/sdc2 38563 38913 2819407+ 82 Linux swap / Solaris
-- -- -- -- --