I'm testing some NAS setups using virtualbox, with several virtual hard drives, and software raid.
I would like to test the behavior under certain fails, and I would like to simulate that one of the hard disks broke and there's need to rebuild the RAID...
Would it be enough to do a
cat /proc/urandom > /virtualdisk
Or as the virtual disks are containers, VBox couldn't use it and would break the VirtualBox machine?
I don't know that you can fail a hard drive this way in VBox (or any VM -- They're typically designed to pretend hardware is perfect). You can try it and see but the results could be pretty awful...
A better strategy might be to shut down the VM & remove the disk, power on & do stuff, then shutdown & re-add the disk. Another option is to use the software RAID administration tools to mark a drive as failed (almost all of them support this AFAIK), scribble on it from within the VM, then re-add it & watch the rebuild.
All told however the only real test of a drive failure is to put the OS on real hardware and yank out one of the disks -- This is the only way to know for sure how your OS will react on a given piece of hardware with associated controller quirks.
I'd just open up the host OS, and move one of the virtual disk set files someplace else, and watch what happens. That would emulate one of the member disks suddenly not being available.
But as said earlier, that shows how the NAS behaves in that virtualized environment. It may or may not give the identical behavior in a physical configuration.