Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic: [EN] [SOLVED] Btrfs compression  (Read 9860 times)

dfe

  • Guest
[EN] [SOLVED] Btrfs compression
« on: 2013/01/08, 00:43:11 »
Hi,

I installed 2012.2 - Riders on the Storm using one partition, which is formatted with Btrfs. Now I want to enable compression. There is no fstab entry for the disk, so what is the best way to set the appropriate mount options?
I noticed that the disk gets mounted with "space_cache" per default. Where does that come from?

Btw, does anybody know if grub2 can read from Btrfs partitions that are compressed with LZO? There were problems with it some time ago.

thanks

Offline devil

  • Administrator
  • User
  • *****
  • Posts: 4.842
Btrfs compression
« Reply #1 on: 2013/01/08, 01:58:00 »
Your partition is not in fstab? That sounds strange, if we are not speaking of a usb device. Can we see your fstab?

greetz
devil

Offline dibl

  • siduction community member
  • Global Moderator
  • User
  • *****
  • Posts: 2.358
    • Land of the Buckeye
RE: Btrfs compression
« Reply #2 on: 2013/01/08, 02:23:57 »
There has to be an /etc/fstab entry, or your partition will not be mounted on boot.

BTRFS compression is enabled with the "compress" option, like this:

Code: [Select]
UUID=c112ed57-0e33-4d4b-82c9-5c55932c529d     /mnt/DATA            btrfs        device=/dev/sdd,device=/dev/sde,compress,space_cache,inode_cache   0    0
System76 Oryx Pro, Intel Core i7-11800H, SSD 970 EVO Plus;  Asus ROG STRIX X299-E, Core i7-7740X, Nvidia GTX-1060, dual monitors, SSD 860 EVO

dfe

  • Guest
[SOLVED] Btrfs compression
« Reply #3 on: 2013/01/08, 12:38:19 »
Here is my fstab (spaces removed):
Code: [Select]
UUID=5e9fc3a3-2854-4eba-999e-d182914f5110 none swap sw 0 0
As you can see, there is only an entry for the swap partition (bug in the installer?). Still the system boots fine because the root partition gets mounted early in the boot.

If you want further information, just tell me. :)

Offline dibl

  • siduction community member
  • Global Moderator
  • User
  • *****
  • Posts: 2.358
    • Land of the Buckeye
[SOLVED] Btrfs compression
« Reply #4 on: 2013/01/08, 13:00:47 »
Let's see the output of

Code: [Select]
blkid -c /dev/null -o list

please.
System76 Oryx Pro, Intel Core i7-11800H, SSD 970 EVO Plus;  Asus ROG STRIX X299-E, Core i7-7740X, Nvidia GTX-1060, dual monitors, SSD 860 EVO

dfe

  • Guest
[SOLVED] Btrfs compression
« Reply #5 on: 2013/01/08, 13:06:21 »
blkid -c /dev/null -o list:
Code: [Select]
device     fs_type label    mount point    UUID
-------------------------------------------------------------------------------
/dev/sda1  btrfs            (in use)       9952b0b0-4ceb-4479-9158-effe64120207
/dev/sda2  swap             <swap>         5e9fc3a3-2854-4eba-999e-d182914f5110

Offline dibl

  • siduction community member
  • Global Moderator
  • User
  • *****
  • Posts: 2.358
    • Land of the Buckeye
[SOLVED] Btrfs compression
« Reply #6 on: 2013/01/08, 13:25:55 »
I would use that UUID for /dev/sda1 and make a mount line in /etc/fstab for /.  You can see how to do it from my line in the post above.  You don't need the "device=xxxx" part, since it's only one device.
System76 Oryx Pro, Intel Core i7-11800H, SSD 970 EVO Plus;  Asus ROG STRIX X299-E, Core i7-7740X, Nvidia GTX-1060, dual monitors, SSD 860 EVO

dfe

  • Guest
[SOLVED] Btrfs compression
« Reply #7 on: 2013/01/08, 13:48:58 »
Thanks, I will try it.
Still it's strange that the installer didn't added the root partition to fstab.

Offline dibl

  • siduction community member
  • Global Moderator
  • User
  • *****
  • Posts: 2.358
    • Land of the Buckeye
[SOLVED] Btrfs compression
« Reply #8 on: 2013/01/08, 15:15:38 »
I don't know how that works, either. I have only used btrfs for a data partition, not for the OS -- obviously there's something different about the way it is being installed when you do it from the live CD.  I'm sure you have read the wiki and the numerous ubuntu posts about it.  As usual, the arch folks have some good documentation, too:

https://wiki.archlinux.org/index.php/Installing_on_Btrfs_root
System76 Oryx Pro, Intel Core i7-11800H, SSD 970 EVO Plus;  Asus ROG STRIX X299-E, Core i7-7740X, Nvidia GTX-1060, dual monitors, SSD 860 EVO

Offline dibl

  • siduction community member
  • Global Moderator
  • User
  • *****
  • Posts: 2.358
    • Land of the Buckeye
[SOLVED] Btrfs compression
« Reply #9 on: 2013/01/08, 19:44:02 »
BTW, after considering it for awhile, I would suppose that a btrfs filesystem using compression will probably slow your OS down, as compared to ext4.  You can let us know ....

 :)
System76 Oryx Pro, Intel Core i7-11800H, SSD 970 EVO Plus;  Asus ROG STRIX X299-E, Core i7-7740X, Nvidia GTX-1060, dual monitors, SSD 860 EVO

dfe

  • Guest
[SOLVED] Btrfs compression
« Reply #10 on: 2013/01/08, 21:33:51 »
Using compression should actually boost performance. At least if you have a decent CPU.
Here's a benchmark with pretty impressive results:
http://www.phoronix.com/scan.php?page=article&item=linux_btrfs_options&num=1

Offline dibl

  • siduction community member
  • Global Moderator
  • User
  • *****
  • Posts: 2.358
    • Land of the Buckeye
[SOLVED] Btrfs compression
« Reply #11 on: 2013/01/08, 22:19:02 »
Verrrrry interesting --- thanks!  It is counter-intuitive -- at least to my mind, that compressing and decompressing on the fly would result in faster performance, but there you have it.  I haven't changed my /etc/fstab since zlib was the only compression available.  It looks like I could pick up a bit of performance by changing it to lzo.  Although I'm not sure what "better performance" means when playing music and watching videos and such .....    :lol:
System76 Oryx Pro, Intel Core i7-11800H, SSD 970 EVO Plus;  Asus ROG STRIX X299-E, Core i7-7740X, Nvidia GTX-1060, dual monitors, SSD 860 EVO

timc

  • Guest
[SOLVED] Btrfs compression
« Reply #12 on: 2013/01/08, 22:55:30 »
There are currently two types of compression used by btrfs. lzo gives less compression and an overall performance boost. zlib gives more compression at the cost of performance.

I use lzo on my root filesystem. I have not done any benchmarks, but performance feels very good. I have not tried zlib compression, but obviously it would be best used for mass storage where high compression is needed and performance doesn't really matter.

https://btrfs.wiki.kernel.org/index.php/Compression

Tim

Offline agaida

  • User
  • Posts: 1.760
    • http://g-com.eu
[SOLVED] Btrfs compression
« Reply #13 on: 2013/01/09, 02:26:27 »
dibl: transparent compression can improve read performance in mech. devices. Real geeks use ssd to boot, eventually with hardware compression :)
There's this special biologist word we use for "stable". It's "dead". ~ Jack Cohen

Offline dibl

  • siduction community member
  • Global Moderator
  • User
  • *****
  • Posts: 2.358
    • Land of the Buckeye
[SOLVED] Btrfs compression
« Reply #14 on: 2013/01/09, 02:37:07 »
Yep, Alf, this geek uses a SSD to boot, and a cheap one!:

Code: [Select]
root@imerabox:/home/don# blkid -c /dev/null -o list
device                        fs_type     label        mount point                       UUID
------------------------------------------------------------------------------------------------------------------------------
/dev/sda1                     ext4                     /                                 bea3a748-3411-4024-acd0-39f3882ddaf9
/dev/sda2                     ext4        SDA2         /mnt/SDA2                         8cfe2acc-7572-4b45-b25f-ed021bb1d78b
/dev/sdb1                     ext4        revodata     /mnt/REVODATA                     ec21f5b3-7fd4-4f4b-af8d-cf787b147ae8
/dev/sdc1                     ext2                     /boot                             ac7da829-aebb-46f0-806c-04a4d81a945a
/dev/sdc2                     swap                     <swap>                            0d939b7d-48f1-47dd-aebe-77e7bd8c3503
/dev/sdd                      btrfs                    (in use)                          c112ed57-0e33-4d4b-82c9-5c55932c529d
/dev/sde                      btrfs                    (in use)                          c112ed57-0e33-4d4b-82c9-5c55932c529d
root@imerabox:/home/don#



Code: [Select]
root@imerabox:/home/don# hdparm -iI /dev/sdc

/dev/sdc:

 Model=KINGSTON SS100S216G, FwRev=D100719a, SerialNo=16GAA0002142
 Config={ Fixed }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=0
 BuffType=unknown, BuffSize=unknown, MaxMultSect=16, MultSect=16
 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=31277232
 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio3 pio4
 DMA modes:  mdma0 mdma1 mdma2
 UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5
 AdvancedPM=yes: unknown setting WriteCache=enabled
 Drive conforms to: Unspecified:  ATA/ATAPI-4,5,6,7

 * signifies the current active mode


ATA device, with non-removable media
        Model Number:       KINGSTON SS100S216G                    
        Serial Number:      16GAA0002142        
        Firmware Revision:  D100719a
        Transport:          Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6
Standards:
        Supported: 8 7 6 5
        Likely used: 8
Configuration:
        Logical         max     current
        cylinders       16383   16383
        heads           16      16
        sectors/track   63      63
        --
        CHS current addressable sectors:   16514064
        LBA    user addressable sectors:   31277232
        LBA48  user addressable sectors:   31277232
        Logical  Sector size:                   512 bytes
        Physical Sector size:                   512 bytes
        Logical Sector-0 offset:                  0 bytes
        device size with M = 1024*1024:       15272 MBytes
        device size with M = 1000*1000:       16013 MBytes (16 GB)
        cache/buffer size  = unknown
        Form Factor: 2.5 inch
        Nominal Media Rotation Rate: Solid State Device
Capabilities:
        LBA, IORDY(can be disabled)
        Queue depth: 32
        Standby timer values: spec'd by Standard, no device specific minimum
        R/W multiple sector transfer: Max = 16  Current = 16
        Advanced power management level: 254
        DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 *udma5
             Cycle time: min=120ns recommended=120ns
        PIO: pio0 pio1 pio2 pio3 pio4
             Cycle time: no flow control=120ns  IORDY flow control=120ns
Commands/features:
        Enabled Supported:
           *    SMART feature set
                Security Mode feature set
           *    Power Management feature set
           *    Write cache
           *    Look-ahead
           *    Host Protected Area feature set
           *    WRITE_BUFFER command
           *    READ_BUFFER command
           *    DOWNLOAD_MICROCODE
           *    Advanced Power Management feature set
                SET_MAX security extension
           *    48-bit Address feature set
           *    Device Configuration Overlay feature set
           *    Mandatory FLUSH_CACHE
           *    FLUSH_CACHE_EXT
           *    SMART error logging
           *    SMART self-test
           *    General Purpose Logging feature set
           *    WRITE_{DMA|MULTIPLE}_FUA_EXT
           *    WRITE_UNCORRECTABLE_EXT command
           *    Gen1 signaling speed (1.5Gb/s)
           *    Gen2 signaling speed (3.0Gb/s)
           *    Native Command Queueing (NCQ)
           *    Phy event counters
           *    DMA Setup Auto-Activate optimization
           *    Software settings preservation
           *    Data Set Management TRIM supported (limit unknown)
Security:
        Master password revision code = 65534
                supported
        not     enabled
        not     locked
        not     frozen
        not     expired: security count
                supported: enhanced erase
        12min for SECURITY ERASE UNIT. 12min for ENHANCED SECURITY ERASE UNIT.
Checksum: correct
System76 Oryx Pro, Intel Core i7-11800H, SSD 970 EVO Plus;  Asus ROG STRIX X299-E, Core i7-7740X, Nvidia GTX-1060, dual monitors, SSD 860 EVO