Linux Blu-ray backup storageCategory: Linux
I use BD-RE disks as a backup storage (combined with HDDs and cloud storage).
Because the usual way of using optical media implies wiping the whole disk to remove/add/change a file, I decided to experiment with different solutions.
Actually, you can just:
And have a FAT32 fs with read/write access on a DVD-RW/BD-RE. But FAT32 has limitations and using anything other than FAT is quite slow.
So I decidet to try using
tar. Originally developed for magnetic tape storage, it seemed like a great solution.
And turns out it really is a great solution. It is very fast, yet flexible. You can even use compression if you want.
Here are some commands I use:
Use optical media as tar archive path (without the need to specify -f option):
List files on disk:
Create new archive on disk:
Add files to disk:
Delete files from disk:
Check used space on disk:
Check awailable space on disk in MB:
Extract to a folder:
-b 2048 is used to increase the size of portions of data that are fed to the disk drive. The default size (20x512 bytes, equivalent to
-b 20) is too small, which leads to very slow write speeds, caused by constand buffer uderruns. Alternatively you can use
--record-size=1M. Anything above 64kb should work, but 1M is my recommendation.
Turns out F2FS works a lot better than any other option, even tar. It doesn't thrash the optical head on writing lots of small files, yet provides a very convenient interface for managing files. After formatting, you can just mount it with the following flags, and use like any flash drive.
Note the nobarrier mount option. In essence, a barrier forbids the writing of any blocks after the barrier until all blocks written before the barrier are committed to the media. By using barriers, filesystems can make sure that their on-disk structures remain consistent at all times. As optical disks perform better with uninterrupted linear writes and also produce less errors, we don't want our caches to be fully flushed after every single atomic transaction. Even though Blu-ray has lossless linking, every time you begin writing to the disk, there is a small imprecision, which is corrected by the built-in error correction. Barriers are mostly important in case of a sudden power loss, so use a UPS.
You can also experiment with async and flush_merge options, for even better performance.