Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
BTRFS compression attribute
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
The_Great_Sephiroth
Veteran
Veteran


Joined: 03 Oct 2014
Posts: 1364
Location: Fayetteville, NC, USA

PostPosted: Sun Apr 02, 2017 8:24 pm    Post subject: BTRFS compression attribute Reply with quote

I have a quick question for somebody more familiar with the compression functionality of BTRFS than myself. I created a large BTRFS partition and made some subvolumes in preparation for installing Gentoo. I have @boot, @root, @portage, @source, and @home. Currently compression per subvolume is not supported but is in the works. The team recommends working around this by setting the +c flag on the root subvolume directory. The thing is, I want to use zlib for portage and source and lzo for root and home. How can I tell it what to compress with when setting the directory attribute? The boot subvolume will not be compressed.
_________________
Ever picture systemd as what runs "The Borg"?
Back to top
View user's profile Send private message
Zucca
Veteran
Veteran


Joined: 14 Jun 2007
Posts: 1519
Location: KUUSANKOSKI, Finland

PostPosted: Sun Apr 02, 2017 9:04 pm    Post subject: Reply with quote

sh:
btrfs property set /usr/share/portage compression zlib
...might do it. At least +c attribute is inherited by all files inside the directory.
You'll need to use find -command or simialr to then adjust it to files currently inside the directory. And then iirc you need to balance the whole btrfs filesystem to rewrite all the files as compressed ones...

EDIT: This topic got my interest so I went and asked from the #btrfs:
Quote:
Can I set +c on a directory and then 'btrfs property
set /that/same/directory compression zlib' so that
all files inside it are compressed with zlib even if
I've set lzo as the default compression format?

And the answer came:
Quote:
I think so.
Actually, I'd recommend not using the mount options
at all,
and controlling everything using chattr +c and btrfs
prop set.


So... Try it out?
_________________
..: Zucca :..

Code:
ERROR: '--failure' is not an option. Aborting...
Back to top
View user's profile Send private message
The_Great_Sephiroth
Veteran
Veteran


Joined: 03 Oct 2014
Posts: 1364
Location: Fayetteville, NC, USA

PostPosted: Sun Apr 02, 2017 10:25 pm    Post subject: Reply with quote

Thanks, will be trying it shortly.
_________________
Ever picture systemd as what runs "The Borg"?
Back to top
View user's profile Send private message
The_Great_Sephiroth
Veteran
Veteran


Joined: 03 Oct 2014
Posts: 1364
Location: Fayetteville, NC, USA

PostPosted: Mon Apr 03, 2017 12:47 am    Post subject: Reply with quote

It APPEARS to work. Going to try a few more tests and if all goes well I will install to this setup.
_________________
Ever picture systemd as what runs "The Borg"?
Back to top
View user's profile Send private message
The_Great_Sephiroth
Veteran
Veteran


Joined: 03 Oct 2014
Posts: 1364
Location: Fayetteville, NC, USA

PostPosted: Tue Apr 04, 2017 5:31 pm    Post subject: Reply with quote

This appears to have worked. Not only that, but I wanted to report GRUB working with this configuration without a hitch. I have three partitions (GPT style). One for GRUB, one for the system which is BTRFS, and a small, 4GB swap partition on the end of the disk. I formated the system partition as BTRFS and made @boot, @root, @portage, @source, and @home subvolumes. Built BTRFS support into my kernel (I do not use an initrd) and it boots fine. Just added "subvol=@whatever" to the mount points in fstab.
_________________
Ever picture systemd as what runs "The Borg"?
Back to top
View user's profile Send private message
Zucca
Veteran
Veteran


Joined: 14 Jun 2007
Posts: 1519
Location: KUUSANKOSKI, Finland

PostPosted: Wed Apr 05, 2017 8:54 am    Post subject: Reply with quote

I should too set zlib compression to /usr/src, /usr/portage, /var/log ... at least. However if using systemd then journald can compress the jounal files by itself, if set.

Also something to consider if using SSD is the controller doing its own compression. I don't know if that's the case anymore, but earlier it was. I wonder if the hw compression can be disabled using hdparm or similar...
_________________
..: Zucca :..

Code:
ERROR: '--failure' is not an option. Aborting...
Back to top
View user's profile Send private message
dweezil-n0xad
Apprentice
Apprentice


Joined: 30 Oct 2006
Posts: 156
Location: Ostend, Belgium

PostPosted: Tue Sep 12, 2017 4:11 pm    Post subject: Reply with quote

Interesting, I used the new compsize tool to find compression type/ratio on a file or set of files in btrfs to see the difference for portage
/usr/portage is a btrfs subvolume.

results:
Code:
 # btrfs property set /usr/portage compression lzo
 # btrfs property get /usr/portage compression
compression=lzo
 # emaint sync -r gentoo
>>> Syncing repository 'gentoo' into '/usr/portage'...
/usr/bin/git clone --depth 1 https://github.com/gentoo-mirror/gentoo.git .
<snip>
 # ./compsize /usr/portage
Processed 142043 files.
Type       Perc     Disk Usage   Uncompressed Referenced 
Data        77%      230M         295M         295M       
none       100%      109M         109M         109M       
lzo         64%      120M         185M         185M       
 # rm /usr/portage/* -rf
 # rm /usr/portage/.git* -rf
 # btrfs property set /usr/portage compression zlib
 # btrfs property get /usr/portage compression
compression=zlib
 # emaint sync -r gentoo
>>> Syncing repository 'gentoo' into '/usr/portage'...
/usr/bin/git clone --depth 1 https://github.com/gentoo-mirror/gentoo.git .
<snip>
 # ./compsize /usr/portage
Processed 142043 files.
Type       Perc     Disk Usage   Uncompressed Referenced 
Data        64%      189M         293M         293M       
none       100%       79M          79M          79M       
zlib        51%      110M         214M         214M       
 

_________________
i7-4790K | 16GB DDR3 | GTX 970 | 500GB SSD
ASUS N56VV | i7-3630QM | 12GB DDR3 | GT 750M | 256GB SSD
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum