This content has been marked as final. Show 6 replies
Compression=lzo works for me.
From the mailing list of btrfs, i think the developers say the compression is all or nothing, not sure if you can just compress a subvol.
can you mount /dev/sdb1 /mnt compress=lzo and give a try ?
I have a 500GB disk mounted on /u03 where I take remote rsync backups and rotate with snapshots, and works very good.
What I have
[root@mirandaa00 u03]# du -sh OS/mirandaa0*
[root@mirandaa00 u03]# df -h /u03
Filesystem Size Used Avail Use% Mounted on
/dev/sdb 466G 55G 394G 13% /u03
[root@mirandaa00 u03]# grep btrfs /etc/fstab
UUID=1b42a625-a6b7-4bbf-b920-c334900f5111 / btrfs defaults 1 1
UUID=9d4d2956-1f84-4e6c-9c52-d8430acce13a /u03 btrfs compress=lzo 0 0
[root@mirandaa00 u03]# uname -a
Linux mirandaa00 2.6.39-300.28.1.el6uek.x86_64 #1 SMP Tue Feb 5 22:51:31 PST 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@mirandaa00 u03]# cat /etc/oracle-release
Oracle Linux Server release 6.3
[root@mirandaa00 u03]# mount -t btrfs
/dev/sda2 on / type btrfs (rw)
/dev/sdb on /u03 type btrfs (rw,compress=lzo)
Edited by: Alvaro Miranda on Feb 27, 2013 12:14 PM
You're doing much the same thing that I'm doing. I'm going to use "rdiff-backup" (which is similar to rsync, and, in fact, uses librsync to derive file diffs) to backup my Oracle VM virtual machines.
Yes, I will mount the root of the filesystem somewhere, and enable compression, and let you know if that made it work. I wasn't planning to actually USE the root mount, except for snapshotting, so i haven't been keeping it mounted.
When I started to play with btrfs, i went with create subvols for each oracle_home, so i ended having grid, db_home, oraInventory, each on his own subvol
with an script i took snapshots and was doing nice.. but I hit couple of issues.
first, I run out of space.. there is some underlying issues with extends, and subvol snapshots so I move my backups and snapshots out of /u01 and created a new /u03
then, even without snapshots, i hit the same issue.. so deleted everything, and I use just a plain disk for my /u01 and I am very conservative with my snapshots on my /u03
For the source /u01 without snapshots, you still can make reflink copies that are per file, and works very fast.. not as fast as an snapshot, but does the trick
$ du -sh dbhome_1*
$ time cp -ax dbhome_1/. dbhome_1_bkp_normalcopy
0.71 user 26.82 system 2:40.23 elapsed
$ time cp -ax --reflink=always dbhome_1/. dbhome_1_bkp_reflink
0.20 user 3.47 system 0:03.87 elapsed
the /. is important to include from that point and recursive.
For the record, I have an ssd for OS and U01.
It seems to me there is a common misunderstanding about what subvolumes and snapshots are in the context of actual data. Btrfs is a copy-on-write filesystem that maintains a B-tree structure to record data transactions and data changes. Any changes to the file system are written to free or unused disk space in order not to overwrite any existing data. When you create a snapshot you add only a small amount of additional metadata to mark a certain point in time to which you can restore to undo changes or omit changed data blocks. Snapshot and subvolumes work the same way. You can mount a snapshot or subvolume and will see a private version of data. As such a snapshot is not a full backup and perhaps similar to an incremental backup although only describing where changed data has been written, or similar to a restore point in an oracle database.
YES, you're right. You apparently have to mount the ROOT of the filesystem with the compression option, in order to get compression on any separately mounted subvolumes.
My intent was to NOT mount the root at all for normal operations. I made three subvolumes, and was going to mount each one, with compression or not, as I wished. The root would then be used only when I wanted to snapshot one of the subvolumes. But testing shows that:
1. If you mount the root with without compression the setting is inherited by all subvolumes, even if they are separately mounted WITH compression. And similarly if the root is mounted with compression, then all subvolumes are compressed, even if separately mounted WITHOUT compression, and written through the separate mount point.
2. If you do NOT mount the filesystem root, then if you mount a subvolume WITH compression, you don't get compression.
And I did one more test:
Mounted the root WITH compression.
Mounted the subvolume WITHOUT compression.
UNmounted the root.
The subvolume DID still compress.
Presumably this is all by design, but I find it somewhat counter-intuitive.
but you can have the disk you want to use for backups in a separate mount, like /u03, then inside you create volumes that will looks like directories and you can use those no need to mount them.
if you want to mount those in other path, yes you can, and won't hurt have that way.
Just run a lot of testing, in my particular case, as I have said, I have btrfs for /u01 and I rsync a copy to /u03/OS/<server>/full path