util-linux (blockdev)
The standard Linux utility set. Its blockdev command can mark a block device read-only before it is mounted.
Not maintained No code changes since May 2020; test it on your kernel before use. Based on the last code update recorded on 24 Nov 2026.
Released 21 Feb 2017. Choose the file for your system on the release page.
Files come directly from github.com/msuhanov/Linux-write-blocker. Digital Forensic Tools does not host or modify them.
Software write blocking on Linux means telling the kernel to treat an evidence drive as read-only before anything can write to it. The Linux Write Blocker project adds a kernel patch and helper scripts for this, and the standard blockdev command and read-only mount options cover simpler cases.
What you need. A Linux computer and root rights. To use the project's patch you must apply it to a kernel source and compile your own kernel. The project says it was written for Linux 3.15.1 and works on some newer versions, and a version for Linux 4.10 exists. The blockdev command and mount options need no patch and are part of standard Linux.
Read the project's README before you start. It lists races, live system issues and bypass risks. Plan your method on paper and check your lab policy on software blockers.
Turn off automatic mounting and the automatic start of RAID, fake RAID and LVM volumes before you connect evidence. The project warns that the system may write to a drive before you mark it read-only. On live systems, protect all devices early in the boot.
Local udev rules go in /etc/udev/rules.d and files must end in .rules. They are read in name order, so a name starting with 01 runs early. The project's 01-forensic-readonly.rules uses its helper scripts. Check the paths in it first.
Connect the drive, find its device name, and set the parent device read-only. Marking only a partition is not enough, says the project. The device name below is only an example.
sudo blockdev --setro /dev/sdb
Ask the system for the read-only status of the device. It prints 1 when the device is read-only. The manual notes that a file system that is already mounted read-write is not affected until it is remounted.
sudo blockdev --getro /dev/sdb
Before real evidence, test your setup with a spare drive. Hash it, try to write to it as a test, and hash it again. The hash must not change. Record the test in your lab notes and repeat it when the system or kernel changes.
Make the image from the whole device with an imaging tool. If you must mount, add the read-only options. For ext3 and ext4 add noload, so the journal is not replayed. For ntfs-3g the project gives the ro option.
sudo mount -o ro,noload /dev/sdb1 /mnt/evidence
blockdev --setro /dev/sdXMarks a device read-only. Use the parent device, not only a partition.blockdev --getro /dev/sdXPrints 1 if the device is read-only, 0 if not.blockdev --setrw /dev/sdXMarks the device read-write again.mount -o ro,noloadMounts read-only and, for ext3 and ext4, skips the journal replay that would write to the device.wrtblk-ioerrProject helper that marks a device and its child devices read-only, for faulty drives.Where policy allows it, a tested software method lets you read a drive on a Linux computer.
Setting every device read-only early in the boot lowers the risk that the live system writes to evidence.
Read-only mount options with the device flag reduce the chance of writes such as journal replay.
The project includes discussion and validation work in its research and validation folders, so students can see how a blocker is tested.
Written in our own words from the Linux Write Blocker project's README and the Linux manual pages. Last reviewed 24 Nov 2026.
The standard Linux utility set. Its blockdev command can mark a block device read-only before it is mounted.
A live Linux distribution for forensics with write-blocking by default and a large tool set.