Hi,
I am testing this new system (freeNAS if anyone is interested)
and I want to test how it handles failed and/or corrupted disks.
can anyone please instruct me on how I can simulate (or actually corrupt- it is a testing environment so no worries) such a thing?
thanks in advance
That first example is quite boring. This VMDK will not boot - and if it just contains data it will not show any partitions.
The next example assumes a NTFS - one partition data disk. Here the damage is more interesting and less predictable.
### create a backup to be able to revert the corruption
dd if=name-flat.vmdk bs=1M count=10 of=first-MB-of-name-flat-vmdk.bin skip=4
### overwrite first mb with zeroes
dd if=/dev/zero bs=1M count=10 seek=4 of=name-flat.vmdk conv=notrunc
### revert changes
dd if=first-MB-of-name-flat-vmdk.bin of=name-flat.vmdk bs=1M seek=4 count=10 conv=notrunc
In this case the filetable is ok, the NTFS-bootsector is still ok but probably the MFT is corrupt so in real life this VMDK would probably need a massive chkdsk repair.
I hope the examples show how inject zeroes into a flat.vmdk.
For more real life corruption use this approach and inject zeroes to several locations and enjoy yourself.
Hi,
I don't think you can deliberately corrupt the vmdk, maybe possible to recreate logic volumes if it is a Linux vm.
In order to test the system, it is good to use iometer or HDDSCAN tools.
Regards,
thanks for the reply,
I specifically want to corrupt the disk to test how the system handles failed disks (from alert and rebuild perspective)
IO measurements is less of an issue at this time
Here is a very easy AND revertable way to corrupt a VMDK in ESXi.
connect via putty to the esxi and change directory to VM directory
Assume you want to "corrupt" name.vmdk ....
### create a backup to be able to revert the corruption
dd if=name-flat.vmdk bs=1M count=1 of=first-MB-of-name-flat-vmdk.bin
### overwrite first mb with zeroes
dd if=/dev/zero bs=1M count=1 of=name-flat.vmdk conv=notrunc
### revert changes
dd if=first-MB-of-name-flat-vmdk.bin of=name-flat.vmdk bs=1M seek=0 count=1 conv=notrunc
To the VM this will look like the partitiontable has been lost
That first example is quite boring. This VMDK will not boot - and if it just contains data it will not show any partitions.
The next example assumes a NTFS - one partition data disk. Here the damage is more interesting and less predictable.
### create a backup to be able to revert the corruption
dd if=name-flat.vmdk bs=1M count=10 of=first-MB-of-name-flat-vmdk.bin skip=4
### overwrite first mb with zeroes
dd if=/dev/zero bs=1M count=10 seek=4 of=name-flat.vmdk conv=notrunc
### revert changes
dd if=first-MB-of-name-flat-vmdk.bin of=name-flat.vmdk bs=1M seek=4 count=10 conv=notrunc
In this case the filetable is ok, the NTFS-bootsector is still ok but probably the MFT is corrupt so in real life this VMDK would probably need a massive chkdsk repair.
I hope the examples show how inject zeroes into a flat.vmdk.
For more real life corruption use this approach and inject zeroes to several locations and enjoy yourself.
thank you very much.
very helpful!