BTRFS on Ubuntu CLI changes to RO after 1 hour with errors
Expected behavior
Mounted volume remains as RW medium
Observed behavior
BTRFS volume changes from itself from RW to RO. Probably due to errors according to the logs.
Steps to reproduce
- Mounting:
veracrypt --text --keyfiles="" --pim=0 --protect-hidden=no /dev/disk/by-id/ata-xxxxxxxxxxxxxxxxxx /mnt/sda/ --slot=1 -
cat /proc/mounts: /dev/mapper/veracrypt1 /mnt/sda btrfs rw,relatime,space_cache,subvolid=5,subvol=/ 0 0Device is working and mounted as rw - Wait around 1 hour of HDD writing usage
-
cat /proc/mounts: /dev/mapper/veracrypt1 /mnt/sda btrfs ro,relatime,space_cache,subvolid=5,subvol=/ 0 0Device changed to RO - Logs shown:
[27171.656786] BTRFS error (device dm-0): bdev /dev/mapper/veracrypt1 errs: wr 146, rd 26, flush 0, corrupt 64, gen 0
[27171.656929] BTRFS error (device dm-0): bdev /dev/mapper/veracrypt1 errs: wr 146, rd 27, flush 0, corrupt 64, gen 0
[31589.599659] BTRFS error (device dm-0): bdev /dev/mapper/veracrypt1 errs: wr 146, rd 28, flush 0, corrupt 64, gen 0
[31589.599744] BTRFS error (device dm-0): bdev /dev/mapper/veracrypt1 errs: wr 146, rd 29, flush 0, corrupt 64, gen 0
Steps already tried to solve the problem
- First I thought the systemd service which is responsible for dismounting causes issues. So I removed the systemd service but with no difference.
- I booted the machine several times and the error appears reliably after around 1 hour of usage.
- Often it's not possible to dismount the device even with veracrypt -d --force or umount --force. umount --lazy dismount caused an instable, unusable state. Only a reboot solves this issue.
- btrfs check /mnt/sda is giving me
ERROR: not a regular file or block device: /mnt/sdaObviously/dev/disk/by-id/ata-xxxxxxxxxxxxxxxxxxwon't help me since it's veracrpy encrypted. I don't see any way to use btrfs check being mounted or not mounted.
Additional notes
- I've already read
https://sourceforge.net/p/veracrypt/discussion/features/thread/6e8b64e40f/ - It seems the general Linux documentation is very sparse and hard to find. Could that improved? Is there any so far?
Your Environment
VeraCrypt version: VeraCrypt 1.25.4
Operating system and version: Ubuntu 20.04.3 LTS focal CLI only
System type: 64-bit
First, you should make sure, that your drive isn't failing, causing the errors.
Doing the offline fs check:
After mounting the volume, unmount the filesystem again. This way, the volume remains mounted without mounted fs.
In the GUI, there is an actual option for skipping mounting the fs, but I do not know how to achieve this at volume mount time. So, it seems we have to do this additional step:
sudo umount /mnt/sda
Now you can do an offline check of your filesystem:
sudo btrfs check /dev/mapper/veracrypt1
Example:
tehreal@home:~$ sudo btrfs check /dev/mapper/veracrypt1
Opening filesystem to check...
Checking filesystem on /dev/mapper/veracrypt1
UUID: 00000000-0000-0000-0000-000000000000
[1/7] checking root items
[2/7] checking extents
[3/7] checking free space cache
[4/7] checking fs roots
[5/7] checking only csums items (without verifying data)
[6/7] checking root refs
[7/7] checking quota groups skipped (not enabled on this FS)
found 131072 bytes used, no error found
total csum bytes: 0
total tree bytes: 131072
total fs tree bytes: 32768
total extent tree bytes: 16384
btree space waste bytes: 125409
file data blocks allocated: 0
referenced 0
Greets