I would like to make use of Btrfs' transparent compression on an external drive.
- Which tool is best for formatting the drive? Disk Utility or GParted?
- How do I activate the compression? During formatting or when I mount the drive? I guess at mount time. I'm using usbmount to automatically mount newly attached devices, because nobody is logged in on the desktop. Would I have to set general default options somewhere in a system configuration file to get Btrfs mounted with compression, or would I specify this via FS_MOUNTOPTIONS in /etc/usbmount/usbmount.conf and how?
Thanks!
Format and enable LZO
I would avoid using any GUI to format;-)
mkfs.btrfs device
is good enough, depending on how you would like to make use of Btrfs features:You can make use of the compression by adding the option when mounting, for example:
The good thing about Btrfs is that LZO compression can also be enabled on a
subvol
basis, very flexible;-) For exampleNOTE: You can add compression to existing Btrfs file systems at any time, just add the option when mounting and do a
defragment
to apply compression to existing data.BTW: 2 best Btrfs docs out there:
http://www.funtoo.org/wiki/BTRFS_Fun
http://docs.oracle.com/cd/E37670_01/E37355/html/ol_btrfs.html
Make use of LZO compression:
http://www.oracle.com/technetwork/articles/servers-storage-admin/advanced-btrfs-1734952.html
USB Auto Mount
I am not too sure about this, will let other blokes answer it;-)
I'd prefer to write a simple shell script to do the mount because I won't attach the USB HDD to the computer all the time.
As the formatting and enabling LZO compression question is answered already, here is the answer to the Question how to automatically set the compression mount option on automount.
This solution also works if you have btrfs on a LUKS-encrypted disk.
USB Automount
lsblk -o UUID,MOUNTPOINT
to find the UUID of the block device the filesystem is on, e.g.6e642696-3cb4-4d4e-86a6-2fae2b9295cc
Add a line to your /etc/fstab referencing the UUID and specifying the additional mount option:
mount