Unlock write-protected disks on the UDM Pro.
This loadable kernel module enables users of the UDM Pro to mount the write-protected disks as read-write. Ubiquiti uses a custom kernel module to mark the disks as write-protected to prevent users from modifying the disks. This kernel module overrides this kernel setting and marks the disks as read-write.
Note that it is not possible to remount the root filesystem as read-write with this kernel module as the root partition is a read-only SquashFS image. If you really must make changes to the root partition, you must extract the SquashFS image, apply the changes, rebuild the SquahsFS image and overwrite the partition.
Download the source code by running the following code in your command prompt:
$ git clone https://github.com/fabianishere/udm-unlock.git
or simply grab a copy of the source code as a Zip file.
Before you start, make sure you have installed the following packages for the build environment:
sudo apt install gcc-aarch64-linux-gnu
Now navigate to the root directory of this repository, export the path to the Linux kernel sources against you wish to build and apply the supplied patch:
export KERNEL=/root/linux
git -C $KERNEL apply 0001-ubnt-Add-switchable-write-protection-functionality-f.patch
Then, build the module using make
:
make
This will build udm_unlock.ko
which can be loaded into the Linux kernel.
Warning You may render your device unusable by messing with the partitions of your device. Make sure you know what you are doing and ensure you have a backup!
To start, make sure you have loaded the kernel module:
insmod udm_unlock.ko
Then, unlock one of the disks as follows:
echo 1 > /sys/class/block/sdb1/udm_unlock
To lock the disk again, you may write zero to the sysfs file:
echo 0 > /sys/class/block/sdb1/udm_unlock
The code is released under the GPLv2 license. See COPYING.txt.