Skip to contentSkip to conversation

BTRFS, encrypted LVM and disk write cache ?

DISCUSSION Swâmi Petaramesh 3 participants 9 messages May 12, 2011 – May 13, 2011 Btrfs file system

lore
Share & tools
lore
#0 lore raw

Hi list,

I'm a new BTRFS user and will try not to ask FAQs ;-)

I'm currently using Btrfs v0.19 on stock Ubuntu Natty (kernel 2.6.38) and use a BTRFS inside an encrypted LVM.

The wiki "gotchas" page https://btrfs.wiki.kernel.org/index.php/Gotchas
states :
=C2=AB btrfs volumes on top of dm-crypt block devices (and possibly LVM= )
require write-caching to be turned off on the underlying HDD. Failing t= o
do so, in the event of a power failure, may result in corruption not ye= t
handled by btrfs code. (2.6.33) =C2=BB

=2E..So I've turned my write cache off, but I notice this is stated for kernel 2.6.33, so wonder if this still is an issue with 2.6.38, or has it been addressed since ?

Thanks in advance for your help.

Kind regards.

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#1 lore raw
Quoted 8 lines · On Thu, May 12, 2011 at 07:45:25AM +0200, Sw=E2mi Petaramesh wrote:

Hi list,
=20
I'm a new BTRFS user and will try not to ask FAQs ;-)
=20
I'm currently using Btrfs v0.19 on stock Ubuntu Natty (kernel 2.6.38) and use a BTRFS inside an encrypted LVM.
=20
The wiki "gotchas" page https://btrfs.wiki.kernel.org/index.php/Gotch=

as

Quoted 3 lines

states :
=AB btrfs volumes on top of dm-crypt block devices (and possibly LVM) require write-caching to be turned off on the underlying HDD. Failing=

to

Quoted 1 line

do so, in the event of a power failure, may result in corruption not =

yet

Quoted 4 lines

handled by btrfs code. (2.6.33) =BB
=20
...So I've turned my write cache off, but I notice this is stated for kernel 2.6.33, so wonder if this still is an issue with 2.6.38, or ha=

s

Quoted 3 lines

it been addressed since ?
=20
Thanks in advance for your help.

If you mount and start writing and don't see a message in dmesg about d= isabling
barriers then you should be good to go. Thanks,

Josef
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw

Hi,

Le jeudi 12 mai 2011 =C3=A0 11:42 -0400, Josef Bacik a =C3=A9crit :

Quoted 2 lines
Quoted 2 lines

=20
...So I've turned my write cache off, but I notice this is stated f=

or

Quoted 1 line
Quoted 1 line

kernel 2.6.33, so wonder if this still is an issue with 2.6.38, or =

has

Quoted 3 lines
Quoted 1 line

it been addressed since ?

If you mount and start writing and don't see a message in dmesg about=

disabling

Quoted 1 line

barriers then you should be good to go. Thanks,

I've turned disk cache back on and don't see no such messages in my logs... So I assume I should be safe ?

However shifting from ext3 to BTRFS has been enough to turn my perfectl= y
stable system into a perfectly unstable and crash-prone system :-/

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 1 line · On Fri, May 13, 2011 at 4:36 AM, Sw=E2mi Petaramesh <[email protected]= rg>…

However shifting from ext3 to BTRFS has been enough to turn my perfec=

tly

Quoted 1 line

stable system into a perfectly unstable and crash-prone system :-/

Well, first of all, btrfs is still under heavy development. Add to that the fact that you use Ubuntu Natty, which also have some known bugs. There should be some hints there on what the outcome would be :P

Anyway, I'm using linux-image-2.6.38-9-generic from natty-proposed, with btrfs as "/", separate /boot/grub on ext4, and Corsair Force SSD. It works great so far. If you're used to ext4 speed, then you'll notice that btrfs is considerably slower. That's why I use SSD to add some I/O speed (currently booting to gnome classic desktop only takes about 30 seconds).

So in summary, if you have problems but still want to try btrfs, try upgrading your kernel. If you think it's too slow to be usable, then the best you can try right now is use SSD.

--=20
=46ajar
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

Hi Fajar,

Le vendredi 13 mai 2011 =C3=A0 13:54 +0700, Fajar A. Nugraha a =C3=A9cr= it :

Quoted 1 line

Well, first of all, btrfs is still under heavy development.

The wiki https://btrfs.wiki.kernel.org/index.php/Main_Page says in bold= :

=C2=AB Btrfs is under heavy development, but every effort is being made=
to
keep the filesystem stable and fast. As of 2.6.31, we only plan to make forward compatible disk format changes, and many users have been experimenting with Btrfs on their systems with good results. =C2=BB

Adding to the fact that it comes included with the stock and distro kernels... That gives a bit contradictory signals... "Should I stay or should I go ?"

Looks a bit like legal babble boiling down to =C2=AB Yes, it is suppose= d to
work and be usable, so please use it, just be so kind no to sue us if you run into trouble. Not our fault, we won't accept any liability. =C2= =BB

Quoted 1 line

Add to that the fact that you use Ubuntu Natty, which also have some =

known

Quoted 1 line

bugs. There should be some hints there on what the outcome would be :=

P

Every distro has bugs. However Natty's kernel never ever hanged my system until I shifted to using BTRFS... I won't relate BTRFS issues to using Natty unless there is some evidence pointing in this direction...

Not wanting to troll, of course, uh... ;-)

Quoted 1 line

If you're used to ext4 speed, then you'll notice that btrfs is consid=

erably

Quoted 1 line

slower. That's why I use SSD to add some I/O speed (currently booting=

to gnome

Quoted 1 line

classic desktop only takes about 30 seconds).

Well, I noticed it's slower, still usable for me anyway, I'm a patient guy ;-) Anyway an SSD is not an option to me, financially speaking ;-)

Kind regards.

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw
Quoted 2 lines · On Fri, May 13, 2011 at 3:59 PM, Sw=E2mi Petaramesh <[email protected]= rg>…

Adding to the fact that it comes included with the stock and distro kernels... That gives a bit contradictory signals... "Should I stay o=

r

Quoted 3 lines

should I go ?"

Looks a bit like legal babble boiling down to =AB Yes, it is supposed=

to

Quoted 2 lines

work and be usable, so please use it, just be so kind no to sue us if you run into trouble. Not our fault, we won't accept any liability. =BB

Something like that.
Note also since it's in heavy development, even a small difference in kernel version can make a difference between whether a bug is present or not, so it's advisable to always try latest kernel version.

Quoted 2 lines
Quoted 2 lines

Add to that the fact that you use Ubuntu Natty, which also have some=

known

Quoted 1 line
Quoted 1 line

bugs. There should be some hints there on what the outcome would be =

:P

Quoted 3 lines

Every distro has bugs. However Natty's kernel never ever hanged my system until I shifted to using BTRFS... I won't relate BTRFS issues =

to

Quoted 1 line

using Natty unless there is some evidence pointing in this direction.=

=2E.

Quoted 2 lines

Not wanting to troll, of course, uh... ;-)

No troll taken.

Just wanted to point out that since Natty is new and has known bugs (which might include kernel package as well), if you encounter problems try to use latest available kernel for Natty first. If it doesn't work, try latest vanilla kernel from kernel.org. For example, IIRC 2.6.38 has a bug in that you can't use mount option "subvol=3D..." if the fs/subvolume is newly created, while 2.6.39 works fine. At least that's what I experienced, so now I use subvolid to select subvolume.

Quoted 2 lines
Quoted 2 lines

If you're used to ext4 speed, then you'll notice that btrfs is consi=

derably

Quoted 1 line
Quoted 1 line

slower. That's why I use SSD to add some I/O speed (currently bootin=

g to gnome

Quoted 3 lines
Quoted 1 line

classic desktop only takes about 30 seconds).

Well, I noticed it's slower, still usable for me anyway, I'm a patien=

t

Quoted 1 line

guy ;-) Anyway an SSD is not an option to me, financially speaking ;-=

)

A 60GB Corsair Force should be about $140. Highly recommended. Higher capacities provide even better cost/GB.

--=20
=46ajar
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw

Le vendredi 13 mai 2011 =C3=A0 16:16 +0700, Fajar A. Nugraha a =C3=A9cr= it :

Quoted 1 line

IIRC 2.6.38 has a bug in that you can't use mount option "subvol=3D..=

=2E"

Quoted 3 lines

if the fs/subvolume is newly created, while 2.6.39 works fine. At least that's what I experienced, so now I use subvolid to select subvolume.

# uname -a
Linux tethys 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:50 UTC
2011 i686 i686 i386 GNU/Linux
# grep btrfs fstab
/dev/VG1/TETHYS	/		btrfs	subvol=3DUBUNTU,compress=3Dzlib,relatime	0 0
/dev/sda2	/boot		btrfs	compress=3Dzlib,relatime			0 0
/dev/VG1/TETHYS	/home		btrfs	subvol=3DHOME,compress=3Dzlib,relatime	0 0
/dev/VG1/TETHYS	/tmp		btrfs	subvol=3DTMP,compress=3Dzlib,relatime	0 0
/dev/VG1/TETHYS	/var		btrfs	subvol=3DVAR,compress=3Dzlib,relatime	0 0
# mount | grep btrfs
/dev/mapper/VG1-TETHYS on / type btrfs
(rw,relatime,subvol=3DUBUNTU,compress=3Dzlib)
/dev/mapper/VG1-TETHYS on /tmp type btrfs
(rw,relatime,subvol=3DTMP,compress=3Dzlib)
/dev/mapper/VG1-TETHYS on /home type btrfs
(rw,relatime,subvol=3DHOME,compress=3Dzlib)
/dev/mapper/VG1-TETHYS on /var type btrfs
(rw,relatime,subvol=3DVAR,compress=3Dzlib)
/dev/sda2 on /boot type btrfs (rw,relatime,compress=3Dzlib)

(Maybe worth noting that /boot actually points to a subvol as well, which is set as default subvol as grub2 would seem not to manage non-default subvol)

Quoted 2 lines

A 60GB Corsair Force should be about $140. Highly recommended. Higher capacities provide even better cost/GB.

I'll note this for my next national lottery win ;-)))

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw
Quoted 4 lines · On Fri, May 13, 2011 at 4:33 PM, Sw=E2mi Petaramesh <[email protected]= rg>…
# uname -a
Linux tethys 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:50 UTC
2011 i686 i686 i386 GNU/Linux
Quoted 11 lines
# mount | grep btrfs
/dev/mapper/VG1-TETHYS on / type btrfs
(rw,relatime,subvol=3DUBUNTU,compress=3Dzlib)
/dev/mapper/VG1-TETHYS on /tmp type btrfs
(rw,relatime,subvol=3DTMP,compress=3Dzlib)
/dev/mapper/VG1-TETHYS on /home type btrfs
(rw,relatime,subvol=3DHOME,compress=3Dzlib)
/dev/mapper/VG1-TETHYS on /var type btrfs
(rw,relatime,subvol=3DVAR,compress=3Dzlib)
/dev/sda2 on /boot type btrfs (rw,relatime,compress=3Dzlib)

Weird.

$ sudo btrfs su li /
ID 256 top level 5 path natty
ID 258 top level 5 path home
$ sudo mount /dev/sda2 -o subvol=3Dhome /mnt/tmp
$ ls /mnt/tmp
$ sudo umount /mnt/tmp
$ sudo mount /dev/sda2 -o subvolid=3D258 /mnt/tmp
$ ls /mnt/tmp
user
$ sudo umount /mnt/tmp
$ uname -a
Linux HP 2.6.38-9-generic #43-Ubuntu SMP Thu Apr 28 15:25:15 UTC 2011
i686 i686 i386 GNU/Linux

I don't even know what got mounted when I use "-o subvol=3Dhome" since all of my subvolumes have some files/directory on it, while the mount shows nothing on it :P

--=20
=46ajar
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw
In reply to Fajar A. Nugraha

Le vendredi 13 mai 2011 =C3=A0 16:16 +0700, Fajar A. Nugraha a =C3=A9cr= it :

Quoted 1 line

if you encounter problems try to use latest available kernel for Natt=

y

Quoted 1 line

first. If it doesn't work, try latest vanilla kernel from kernel.org.=

=20

When I was younger I used to spend days compiling and installing and testing things, and playing with custom kernels, then system upgrades were a week of nightmares, and my wife would kill me and my kids would sell drugs and burn cars instead of doing their homework etc...

Now I'm more of the "If it ain't broke, don't fix it !" kind, and try t= o
stick as much as possible to my official distro packages as long as I don't run into damn hell unsolvable issues that force me to enter the DIY-source-tree-compile-nightmare again... And keep in peace with my wife and sleep with her at night rather than compile kernels ;-)

In other words, I will consider using an experimental or non-Ubuntu kernel when my filesystem breaks to the point I get no other option but a complete system reinstallation... Otherwise I'll expect kernel improvements in Ubuntu 11.10 ;-)

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html