2

For testing purpose I need to simulate a crash of the disk (by detaching it) while other processes are using it.
I tried:

umount -f /srv/node/d1/

It doesn't want to unmount it. It shows me the next message:

umount: /srv/node/d1: target is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))

There several processes which I don't want to stop manually because it will not be a crash. Does somebody know how to just detach a disk in linux? It would be more easy to detach it physically but I am using a virtual machine with virtual disks.

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
Oleksandr
  • 1,049

1 Answers1

1

It will be easier to use device mapper doing a linear remapping to the underlying disk and mounting from there as you can then simulate the disk crashing by switching device mapper to return the error target (e.g. through the use of dmsetup wipe_table). See https://unix.stackexchange.com/a/144200/134856 for this and other (such as using scsi_debug) disk error simulation techniques.

Anon
  • 3,794