Linux MD problem
Kenneth Burgener
kenneth at mail1.ttak.org
Wed Jul 8 11:34:10 MDT 2009
On 7/8/2009 11:22 AM, Kenneth Burgener wrote:
> mdadm --stop /dev/md0
> mdadm --assemble /dev/md0 /dev/sdu1 /dev/sdv1 /dev/sdw1 --run
Mike,
By the way, if you are wanting to play around with mdadm without
actually using real drives you can setup a few virtual devices and play
with mdadm to your hearts content without destroying real disks:
dd if=/dev/zero of=/root/vd1 bs=1M count=100 # create virtual disk 1
dd if=/dev/zero of=/root/vd2 bs=1M count=100 # create virtual disk 2
dd if=/dev/zero of=/root/vd3 bs=1M count=100 # create virtual disk 3
dd if=/dev/zero of=/root/vd4 bs=1M count=100 # create virtual disk 4
losetup -a # show currently used loop devices
losetup /dev/loop1 /root/vd1 # use an unused loop device
losetup /dev/loop2 /root/vd2 # use an unused loop device
losetup /dev/loop3 /root/vd3 # use an unused loop device
losetup /dev/loop4 /root/vd4 # use an unused loop device
mdadm --create /dev/md2 --level raid10 --raid-devices 4 /dev/loop[1234]
# create md devices (use unused /dev/md?)
mkfs.ext3 /dev/md2 # format as ext3
mount /dev/md2 /mnt/md2 # mount if you want
now you can fail virtual disks, stop array, reassemble, fail disks, etc
to your hearts content.
# example rebuild with one less disk:
mdadm --stop /dev/md2
mdadm --assemble /dev/md2 /dev/loop[123]
When you are done, to clean up:
umount /dev/md2 # if mounted
mdadm --stop /dev/md2
losetup -d /dev/loop1
losetup -d /dev/loop2
losetup -d /dev/loop3
losetup -d /dev/loop4
rm /root/vd1
rm /root/vd2
rm /root/vd3
rm /root/vd4
More information about the PLUG
mailing list