lkml.org 
[lkml]   [2009]   [Aug]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [testcase] test your fs/storage stack (was Re: [patch] ext2/3: document conditions when reliable operation is possible)
On Sat, 29 Aug 2009, Pavel Machek wrote:

>> 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 :-(.

so let's get broader testing (including testing the SSDs as well as the
thumb drives)

>> 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.

I think that every single one of them will tell you to not unplug the
drive while writing to it. in fact, I'll bet they all tell you to not
unplug the drive without unmounting ('ejecting') it at the OS level.

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

Ok, help me understand this.

I copy these two files to a system, change them to point at the correct
device, run them and unplug the drive while it's running.

when I plug the device back in, how do I tell if it lost something
unexpected? since you are writing from urandom I have no idea what data
_should_ be on the drive, so how can I detect that a data block has been
corrupted?

David Lang#!/bin/bash

#

# Copyright 2008 Pavel Machek <pavel@suse.cz>, 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@suse.cz>, 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

\
 
 \ /
  Last update: 2009-08-29 18:39    [W:0.176 / U:0.664 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site