You are not logged in.

#1 2013-05-01 13:22:50

pogeymanz
Member
Registered: 2008-03-11
Posts: 1,020

Reinstalling packages to get btrfs to compress the files?

I recently upgraded most of my partitions to btrfs. I turned on compression in fstab, but it will only compress newly created files, which makes sense.

Lets say I have firefox installed. If I do pacman -S firefox, I assume it will actually rewrite the files and not just skip over ones that are already there, right?

Assuming this is the case, what would be a good way to reinstall all of my packages without screwing up the dependency tree?

Maybe I'll have to do two commands:
sudo pacman -S $(pacman -Qqe)
sudo pacman -S --asdeps $(pacman -Qqd)

Does that seem right?

Last edited by pogeymanz (2013-05-01 14:09:41)

Offline

#2 2013-05-01 14:02:41

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Reinstalling packages to get btrfs to compress the files?

Running "find / -xdev -type f -exec btrfs fi defrag '{}' \;" should compress everything compressible.

Last edited by lucke (2013-05-01 14:04:02)

Offline

#3 2013-05-01 14:24:43

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Reinstalling packages to get btrfs to compress the files?

Do what lucke is telling you.  This is a legit use of the "btrfs filesystem defrag <path>" command.  You may just want to run that on / and just have it do the whole damn disk.  It wouldn't hurt anyway, as if files are incompressible (or compress very poorly), they are marked as such and are stored on disk in non-compressed format. 

As a side note, I have started using btrfs with lzo compression (not sure if it is actually advantageous on a two SSD btrfs raid0 system).  I have heard that Linux 3.9.* will actually greatly increase the speed of lzo compression.  This is exciting, and I have been using miffe's mainline repo to test it out.  As suspected, I coulnd't tell of any speed boost to an already fast ssd based system.  But my initrd is lzop compressed as well, and that actually had been quite a bit faster (not that the second it saves is really all that significant in the grand scheme of things, but a second off of an already ~4-5 second boot is pretty amazing).

Offline

#4 2013-05-01 14:27:49

pogeymanz
Member
Registered: 2008-03-11
Posts: 1,020

Re: Reinstalling packages to get btrfs to compress the files?

Great. That's good to hear.

I have seen that command before in the context of defragging, but it actually rewrites all the files? Even if they aren't fragmented?

I have a spinny disk, so I hoping that this will give me a little boost- especially because I'm running kde, so there are tons of library files to load.

Offline

#5 2013-05-01 14:38:39

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Reinstalling packages to get btrfs to compress the files?

I think that it wouldn't rewrite non-fragmented files unnecessarily if you were not mounted with compress=<on|lzo|gzip>.  But since you have mounted it as such, it rewrites all the things!  At least this is what I gathered from reading about btrfs quite a bit over the past few days.  I cannot recall where I found that information, and for all I know it could be totally wrong. But that is my impression.

Offline

#6 2013-05-01 14:44:13

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,842
Website

Re: Reinstalling packages to get btrfs to compress the files?

WonderWoofy wrote:

I cannot recall where I found that information, and for all I know it could be totally wrong.

You might have seen it here: https://bbs.archlinux.org/viewtopic.php … 1#p1266151


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#7 2013-05-01 14:48:55

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Reinstalling packages to get btrfs to compress the files?

Maybe adding "-l 1" to the defrag command would assure all files are acted upon.

Offline

#8 2013-05-01 14:51:01

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,842
Website

Re: Reinstalling packages to get btrfs to compress the files?

^ Not sure if that'd work. There's the compress-force mount option though: https://btrfs.wiki.kernel.org/index.php … ion_ratios

EDIT: I think I may have misunderstood why you were suggesting -l 1

Last edited by WorMzy (2013-05-01 14:55:01)


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#9 2013-05-01 14:55:28

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Reinstalling packages to get btrfs to compress the files?

lucke wrote:

Maybe adding "-l 1" to the defrag command would assure all files are acted upon.

Wow, reading the man pages reveals some handy tricks! 

man 8 btrfs wrote:

filesystem defragment -c[zlib|lzo] [-l len] [-s start] [-t size] -[vf] <file>|<dir> [<file>|<dir>...]

              Defragment file data and/or directory metadata. To defragment all files in a directory you have to specify each one on its own or
              use your shell wildcards.

              The start position and the number of bytes to defragment can be specified by start and len. Any extent bigger than threshold will
              be considered already defragged. Use 0 to take the kernel default, and use 1 to say every single extent must be rewritten. You
              can also turn on compression in defragment operations.


Edit: Width formatting...

Last edited by WonderWoofy (2013-05-01 14:56:50)

Offline

#10 2013-05-01 15:02:56

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Reinstalling packages to get btrfs to compress the files?

Quick testing reveals that regular defrag and defrag with "-l 1" don't compress an uncompressed file with one extent on a filesystem remounted with compression, but -clzo does compress it.

Last edited by lucke (2013-05-01 15:09:30)

Offline

Board footer

Powered by FluxBB