[testcase] test your fs/storage stack (was Re: [patch] ext2/3:document conditions when reliable operation is possible)

From: Pavel Machek
Date: Sat Aug 29 2009 - 06:30:57 EST



>> So instead of fixing or at least documenting known software deficiency
>> in Linux MD stack, you'll try to surpress that information so that
>> people use more of raid5 setups?
>>
>> Perhaps the better documentation will push them to RAID1, or maybe
>> make them buy an UPS?
>
> people aren't objecting to better documentation, they are objecting to
> misleading documentation.

Actually Ric is. He's trying hard to make RAID5 look better than it
really is.

> for flash drives the danger is very straightforward (although even then
> you have to note that it depends heavily on the firmware of the device,
> some will loose lots of data, some won't loose any)

I have not seen one that works :-(.

> you are generalizing that since you have lost data on flash drives, all
> flash drives are dangerous.

Do the flash manufacturers claim they do not cause collateral damage
during powerfail? If not, they probably are dangerous.

Anyway, you wanted a test, and one is attached. It normally takes like
4 unplugs to uncover problems.

> but the super simplified statement you keep trying to make is
> significantly overstating and oversimplifying the problem.

Offer better docs? You are right that it does not lose whole stripe,
it merely loses random block on same stripe, but result for journaling
filesystem is similar.
Pavel


--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#!/bin/bash
#
# Copyright 2008 Pavel Machek <pavel@xxxxxxx>, GPLv2
#
# vfat is broken with filesize=0
#
#

if [ .$MOUNTOPTS = . ]; then
# ext3 is needed, or you need to disable caches using hdparm.
# odirsync is needed, else modify fstest.worker to fsync the directory.
MOUNTOPTS="-o dirsync"
fi
if [ .$BDEV = . ]; then
# BDEV=/dev/sdb3
BDEV=/dev/nd0
fi

export FILESIZE=4000
export NUMFILES=4000

waitforcard() {
umount /mnt
echo Waiting for card:
while ! mount $BDEV $MOUNTOPTS /mnt 2> /dev/null; do
echo -n .
sleep 1
done
# hdparm -W0 $BDEV
echo
}

mkdir delme.fstest
cd delme.fstest

waitforcard
rm tmp.* final.* /mnt/tmp.* /mnt/final.*

while true; do
../fstest.work
echo
waitforcard
echo Testing: fsck....
umount /mnt
fsck -fy $BDEV
echo Testing....
waitforcard
for A in final.*; do
echo -n $A " "
cmp $A /mnt/$A || exit
done
echo
done
#!/bin/bash
#
# Copyright 2008 Pavel Machek <pavel@xxxxxxx>, GPLv2
#

echo "Writing test files: "
for A in `seq $NUMFILES`; do
echo -n $A " "
rm final.$A
cat /dev/urandom | head -c $FILESIZE > tmp.$A
dd conv=fsync if=tmp.$A of=/mnt/final.$A 2> /dev/zero || exit
# cat /mnt/final.$A > /dev/null || exit
# sync should not be needed, as dd asks for fsync
# sync
mv tmp.$A final.$A
done