Ticket #11862 (reopened enhancement)

Opened 4 years ago

Last modified 12 months ago

VirtualBox freezes on btrfs / add check for COW

Reported by: Cova Owned by:
Priority: major Component: other
Version: VirtualBox 4.2.12 Keywords: btrfs
Cc: Guest type: Windows
Host type: Linux


On a linux machine with btrfs filesystem, installation of a guest goes just fine but at first restart the guest freezes with popup showing "20%" during launch phase. Installing the same machine on XFS, no problems at all. I've seen similar reports, but with slightly different behaviours and declared fixed. host machine: linux 3.9.5 x86_64 (gentoo) guests: W8/W7 64bit attached: vbox.log of failed session


Win7-2013-06-11-21-00-15.log.gz Download (6.0 KB) - added by Cova 4 years ago.

Change History

Changed 4 years ago by Cova


comment:1 follow-up: ↓ 2 Changed 4 years ago by michael

Was this a one-time occurrence or is it reproducible?

comment:2 in reply to: ↑ 1 Changed 4 years ago by Cova

Replying to michael:

Was this a one-time occurrence or is it reproducible?

Happens every time, always reproducible.

I can add that I tested both packages available on gentoo (one built from sources, the other using binary from virtualbox site) and the behaviour is the same.

comment:3 Changed 4 years ago by Ufven

I'm experiencing the same issue running Fedora 19 and btrfs. However, if I enable "Use host I/O cache" on the VM's SATA controller, the problem goes away.

comment:4 Changed 4 years ago by frank

In that case I assume that there is some problem when opening files with O_DIRECT on btrfs. We saw such problems with EXT4 and XFS before with older Linux kernels.

comment:5 Changed 4 years ago by Cova

After some day, I'm no longer able to reproduce the issue. I don't know if this is relevant, as I've got no time to check kernels changelog, but I changed kernel and now I'm running on 3.10 and I'm not able to reproduce the same behaviour.

comment:6 Changed 4 years ago by frank

  • Status changed from new to closed
  • Resolution set to fixed

Thanks, let's close this ticket then.

comment:7 Changed 3 years ago by zerolagtime

I experienced this same problem on BTRFS with Ubuntu Trusty (14.04) on the 3.13.0 kernel and btrfs-tools 3.12. During any virtual machine operation, the system would thrash the disk very badly. Eventually, it would get so bad that the whole system would freeze.

I did some digging on the btrfs wiki and discovered that Copy-On-Write (COW) causes this pain for any virtualization solution ( All I did was go to the location of every VDI and type chattr +C file.vdi and on the whole directory. The VM was powered off while I did this.

During the next boot, it was quite fast and the thrashing was gone.

Now, I also took the advice from above and also marked it to use the hosts I/O cache, but that didn't fix it.

comment:8 Changed 3 years ago by zerolagtime

  • Status changed from closed to reopened
  • Resolution fixed deleted

Please add a check when opening a virtual machine image under Linux. If any images are stored on a BTRFS filesystem, and the COW flag is not activated, put up a warning flag that a file system flag may severely degrade performance. Offer to suspend the system, change the attribute on all applicable files, and then resume the system.

This applied even under VirtualBox 4.3.18.

comment:9 Changed 3 years ago by frank

  • Type changed from defect to enhancement
  • Summary changed from virtualbox 4.2.12 r84980 freezes on btrfs (linux kernel 3.9.5) to VirtualBox freezes on btrfs / add check for COW

I think this check makes sense. Actually a feature request...

comment:10 Changed 2 years ago by krichter

little update on the symptoms on a Linux 3.19 host with 4.3.20 and 4.3.22: after moving the VM folder from one btrfs filesystem to another (btrfs) the hang moves to a point in time after boot, i.e. the starting of the VM succeeds, but then the guest boot hangs.

comment:11 Changed 22 months ago by hnhn

+1 for the warning dialog (seeing the issue on 4.3.32, 5.0.8, 5.0.10).

comment:12 Changed 21 months ago by rsd

Please this is more important than an enhancement.

When creating a image (.vdi file) please add the no Copy on Write attribute while it still empty.

chattr +C only works it the file is empty, so it is a major pain to work around full images.

Right now the solution has being the one pointed here: [ ]

Using this script to correct the image:

touch $T
chattr +C $T
dd if=$F of=$T bs=1M
rm $F
mv $T $F

comment:13 Changed 12 months ago by rfkrocktk-oracle

I am also affected by this in bug #15728.

If there's a bug in BTRFS, I'd be happy to bisect/debug the kernel and submit a patch for it. Is there any consensus on the exact nature of the problem, so I can have a good starting point for my search?

Alternatively, is there a way for us to have VirtualBox do the chattr +C fix if it detects that the VirtualBox VMs folder is on a BTRFS filesystem? Is there a mount flag we can use to disable CoW on BTRFS?

Note: See TracTickets for help on using tickets.
ContactPrivacy policyTerms of Use