0

I am trying to create a script for my coworkers to use in the field that will stress the internal disks to a Linux server. I plan to put some logic in for finding the /dev/sd's available and such. But I wanted to put in a write test. I am aware that fio will blast away data existing on a /dev/ device and I don't want that. I was thinking I could instead create a file with dd and run fio against that file. Essentially it should still stress the drive and put it under load, but retain all the data.

I figure I would create a file the 90% of the size of the remaining space on the partition, so that I can hopefully cause more arm actuating while the disk is under stress.

With this plan shouldn't destroy data on the disk correct?

basic commands I plan to run:

create 10 GB file

dd if=/dev/zero of=myFileSystem.img bs=512 count=19531250

start fio

device=myFileSystem.img runtime=30 fio default.fio

TaylorSanchez
  • 171
  • 1
  • 7
  • 1
    Why do you need to stress the drive? – ewwhite Mar 09 '15 at 23:41
  • And wouldn't a "proper" benchmarking tool such as Bonnie++ be more suitable? – HBruijn Mar 09 '15 at 23:44
  • you need to do the test inside your vm. – c4f4t0r Mar 10 '15 at 07:51
  • There is a lot of paperwork involved with getting Bonnie++ to be used in the field. fio is already approved and I have been instructed to use that. – TaylorSanchez Mar 10 '15 at 14:56
  • I didn't realize fio already creates its own file if the --filename=/directory/file doesn't already exist. So the dd is not necessary. Although it was just as slow as dd to allocate large files, I imagine its writing to every block, where I would prefer it to create the file regardless of what data is already contained there. – TaylorSanchez Mar 10 '15 at 14:59
  • It looks like fallocate may be what I want: http://stackoverflow.com/questions/257844/quickly-create-a-large-file-on-a-linux-system – TaylorSanchez Mar 10 '15 at 15:02

1 Answers1

0

# df -T Filesystem Type 1K-blocks Used Available Use% Mounted on /dev/sda2 ext3 30969600 23578008 5818428 81% / devtmpfs devtmpfs 3937216 180 3937036 1% /dev tmpfs tmpfs 3937216 0 3937216 0% /dev/shm /dev/sdc1 ext3 864658784 44030960 776705716 6% /mnt

# size=641168811k fioFilename=/mnt/diskStressTempFile.1427125883.52 runtime=28800 fio defaultFile.fio

# cat defaultFile.fio

[global]
ioengine=libaio
direct=1
iodepth=64
rw=randread
time_based=1
runtime=${runtime}
filename=${fioFilename}
size=${size}

[default]
name=default
blocksize_range=1k-4M

It is really slow to create the file though. It is pretty much doing a dd if=/dev/zero of=/mnt/diskStressTempFile.1427125883.52

fallocate is a better way to create a large file if you don't care about the contents beforehand. Unfortunately it seems that isn't available on the OS I am working with.

TaylorSanchez
  • 171
  • 1
  • 7