Skip to content
Stephan Eggermont edited this page Dec 11, 2020 · 3 revisions

Notes on locking on Linux

Might have race conditions :(

USB stick FAT32 does not support locking on Ubuntu 20.04LTS. Format as ext4 (named it usb)

Make a mount point

sudo mkdir /media/usblock

list devices

sudo fdisk -l

Disk /dev/sdc: 7,53 GiB, 8069316608 bytes, 15760384 sectors
Disk model: USB Flash Disk  
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot Start      End  Sectors  Size Id Type
/dev/sdc1           2 15760383 15760382  7,5G  7 HPFS/NTFS/exFAT

might have to unmount the usb stick as it is automatically mounted

sudo umount /media/stephan/usb

mount usb stick with mandatory locking:

sudo mount /dev/sdc1 /media/usblock -o mand
Clone this wiki locally