ext4 to btrfs conversion: how long can it take? space requirements?

I started btrfs-convert for my ext4 partitioned hdd. I did a fsck first which was fine. So since it is running over 4 hours now (1.) I wonder if it will ever finish ? I read multiple articles (quickly) about the conversion but none stated a space requirement. But I guess there is some considering this article: https://oss.oracle.com/projects/btrfs/dist/documentation/btrfs-converter.html

So my HDD was using 99.0% of 1.82TB before I started. (2.) If it cannot finish is it save to cancel (CTRL+C) the prozess ?

iotop indicates still that btrfs-convert is reading with ~40MB/s from my hdd and top shows that one cpu core is fully loaded by btrfs-convert. (3.)What would be the wisest decision now?

Update: Meanwhile the conversion process has finished. It took almost 3 days. I must add that in between speeds dropped to ~0-10MB/s but 100% I/O load and CPU usage dropped accordingly down. This morning (after over 2 days running) the conversion process had only ~9h CPU time. All in all everything seems fine.


btrfs-convert will create a snapshot (named ext2_saved) of the existing file system as a backup. It's hard to predict how much disk space the snapshot is going to take because btrfs is CoW...

I've converted a / for Oracle Linux 6.3 x86_64 before, it takes less than 10 mins because the file system is relatively small (data is stored on separate logical volumes). It was smooth, no issue.

In your case, the HDD has more than 1.8T data and little space left, no idea how long it is going to take (the snapshot may only use little space because the file system hasn't changed since the conversion). If iotop shows it's still running, leave it.

Only few people know what happens if you interrupt the convertion, try the btrfs mailing list;-)

Recommended readings:

https://blogs.oracle.com/wim/entry/btrfs_root_and_yum_update

5.4.6. Converting an Ext2, Ext3, or Ext4 File System to a Btrfs File System


If it cannot finish is it save to cancel (CTRL+C) the process?

I just tried to convert an 8TB file system and btrfs-convert seems to have crashed, and btfsck gave a non-specific "Error", but rolling back with btrfs-convert -r only took a minute and everything seems fine with the old ext4 system.

So, aborting btrfs-convert seems to be relatively safe.


Just chiming in with another data point:

I recently did this conversion on an Odroid XU4 (ARM thingy), with an external USB3 WD Ultra 4TB drive (5200rpm). OS is Debian Jessie, kernel 3.10.103+. Btrfs version is v3.17

The previous fs was ext4 with ~2TB used, 2TB of free space, with fairly large files (TV shows, all above several hundred mb each).

All up, the process took about 30 hours.

The btrfs-convert process bounced between 20% and 80% CPU in top, and hovered around 32MB/s in iotop.

Output was

creating btrfs metadata.
creating ext2fs image file.
cleaning up system chunk.
conversion complete.

and all files seem fine.

I'm now going to delete the ext4 backup subvolume, perform the defrag, and rebalance. Will time these too.

Update

aaand I hit a kernel bug during defrag:

btrfs filesystem defrag -v -r -f -t 32M /mnt/hdd_ultra_2

   

    Dec 13 12:24:59 Archimedes-I kernel: [3361889.858128] [c5] ------------[ cut here ]------------
    Dec 13 12:24:59 Archimedes-I kernel: [3361889.861921] [c5] kernel BUG at fs/btrfs/inode.c:873!
    Dec 13 12:24:59 Archimedes-I kernel: [3361889.867036] [c5] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
    Dec 13 12:24:59 Archimedes-I kernel: [3361889.873461] [c5] Modules linked in: btrfs xor raid6_pq cdc_ether usbnet r8152 ads7846 ina231_sensor spidev i2c_s3c2410 spi_s3c64xx fuse
    Dec 13 12:24:59 Archimedes-I kernel: [3361889.885764] [c5] CPU: 5 PID: 5730 Comm: btrfs-transacti Not tainted 3.10.103+ #1
    Dec 13 12:24:59 Archimedes-I kernel: [3361889.893339] [c5] task: c2a6eb80 ti: d1836000 task.ti: d1836000
    Dec 13 12:24:59 Archimedes-I kernel: [3361889.899641] [c5] PC is at __cow_file_range+0x518/0x610 [btrfs]
    Dec 13 12:24:59 Archimedes-I kernel: [3361889.905637] [c5] LR is at run_delalloc_nocow+0x440/0xb74 [btrfs]
    Dec 13 12:24:59 Archimedes-I kernel: [3361889.911465] [c5] pc : [<bf0c9560>]    lr : [<bf0c9a98>]    psr: 20010013
    Dec 13 12:24:59 Archimedes-I kernel: [3361889.911465] sp : d1837810  ip : 00001000  fp : d18378a4
    Dec 13 12:24:59 Archimedes-I kernel: [3361889.923720] [c5] r10: d6cd7d20  r9 : c2a59000  r8 : 000001c2
    Dec 13 12:24:59 Archimedes-I kernel: [3361889.929507] [c5] r7 : d1837a98  r6 : cd9ce1a0  r5 : c2a59000  r4 : cd9cdf60
    Dec 13 12:24:59 Archimedes-I kernel: [3361889.936627] [c5] r3 : 00000000  r2 : 000001c2  r1 : 00000000  r0 : 000001c2
    Dec 13 12:24:59 Archimedes-I kernel: [3361889.943745] [c5] Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
    Dec 13 12:24:59 Archimedes-I kernel: [3361889.951645] [c5] Control: 10c5387d  Table: 43dac06a  DAC: 00000015
    Dec 13 12:24:59 Archimedes-I kernel: [3361889.957967] [c5] CPU 1 / CLUSTER 0
    Dec 13 12:24:59 Archimedes-I kernel: [3361889.961517] [c5] DFSR: 0000081f, ADFSR: 00000000, IFSR: 00000007, AIFSR: 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361889.969170] [c5] CPUMERRSR: 00000000_00000000, L2MERRSR: 00000000_00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361889.976192] [c5]
    Dec 13 12:24:59 Archimedes-I kernel: [3361889.976192] SP: 0xd1837790:
    Dec 13 12:24:59 Archimedes-I kernel: [3361889.981217] [c5] 7790  d1837704 d6cd7af0 00000000 c2a5e000 bf0c9564 00000000 c000e818 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361889.989952] [c5] 77b0  e7100000 d1836000 d18378a4 d18377c8 c000e56c c00081cc 000001c2 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361889.998716] [c5] 77d0  000001c2 00000000 cd9cdf60 c2a59000 cd9ce1a0 d1837a98 000001c2 c2a59000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.007478] [c5] 77f0  d6cd7d20 d18378a4 00001000 d1837810 bf0c9a98 bf0c9560 20010013 ffffffff
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.016242] [c5] 7810  d45bdd78 00000000 00000000 00cc00cb d45bdd94 c061c6b4 d183784c d1837838
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.025006] [c5] 7830  c061c6b4 c00613cc c144c6e0 d477e7b8 d183786c d1837850 bf0dc3b4 c061c688
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.033769] [c5] 7850  c2a59000 cd9cdf60 d45bdd78 00000000 d1837884 d1837870 bf0e2484 bf0dc300
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.042532] [c5] 7870  d6cd7d2c 00000006 d18378a4 00000000 00000000 0013ffff d1837a98 d1837a9c
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.051297] [c5]
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.051297] FP: 0xd1837824:
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.056337] [c5] 7824  c061c6b4 d183784c d1837838 c061c6b4 c00613cc c144c6e0 d477e7b8 d183786c
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.065092] [c5] 7844  d1837850 bf0dc3b4 c061c688 c2a59000 cd9cdf60 d45bdd78 00000000 d1837884
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.073864] [c5] 7864  d1837870 bf0e2484 bf0dc300 d6cd7d2c 00000006 d18378a4 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.082627] [c5] 7884  0013ffff d1837a98 d1837a9c c2a59000 d6cd7d20 d1837984 d18378a8 bf0c9a98
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.091391] [c5] 78a4  bf0c9054 00000000 00000000 0013ffff 00000000 d1837a98 d1837a9c 00000001
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.100155] [c5] 78c4  bf0deb4c 00140000 00000000 00000000 00000002 00000000 00000000 00140000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.108918] [c5] 78e4  00000000 00000000 00000000 00140000 00000000 00000000 c144c6e0 00140000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.117681] [c5] 7904  00000000 00000000 00000000 00140000 00000000 00140000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.126437] [c5]
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.126437] R4: 0xcd9cdee0:
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.131474] [c5] dee0  c0da9518 00000000 00000000 c07eeb20 cd9cdef0 cd9cdef0 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.140232] [c5] df00  00000000 cd9cdf04 cd9cdf04 00000000 0000008a 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.148995] [c5] df20  cd9ce838 97c2a3e5 c2a59000 000001c2 00000000 00000001 00000000 ae6ed700
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.157758] [c5] df40  00050005 dead4ead ffffffff ffffffff bf14ccc4 c0a94e68 00000000 bf1449ac
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.166522] [c5] df60  c4455880 c44558f4 c44558f4 00000000 deaf1eed ffffffff ffffffff bf14cd08
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.175285] [c5] df80  c0a932c8 00000000 bf144b3c c4c50650 d4fa0170 00000000 00000020 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.184050] [c5] dfa0  cd9ce2bc d8f9ccae 00000000 00000000 00000001 07980798 dead4ead ffffffff
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.192812] [c5] dfc0  ffffffff bf14cd5c c0a933d8 00000000 bf144da4 00000000 dead4ead ffffffff
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.201576] [c5]
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.201576] R5: 0xc2a58f80:
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.206614] [c5] 8f80  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.215371] [c5] 8fa0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.224135] [c5] 8fc0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.232898] [c5] 8fe0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.241662] [c5] 9000  d45bdd78 d4f9a668 00000000 00000000 00000000 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.250425] [c5] 9020  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.259189] [c5] 9040  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.267953] [c5] 9060  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.276727] [c5]
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.276727] R6: 0xcd9ce120:
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.281754] [c5] e120  cd9ce120 cd9ce120 cd9c9d31 cd9cfc58 cd9cb3d8 00000080 00000000 f82e2a7f
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.290511] [c5] e140  00000000 00000000 000000a8 00000000 00000000 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.299275] [c5] e160  00140000 00000000 00140000 00000000 ffffffff ffffffff 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.308038] [c5] e180  00000000 00000000 0000001b 00000000 00000000 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.316802] [c5] e1a0  00008180 00000000 00000000 00000000 00000000 00000000 bf13b480 c2a5c800
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.325565] [c5] e1c0  cd9ce2bc 000001c2 00000001 00000000 00140000 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.334329] [c5] e1e0  00000000 00000000 584f4de9 27528e13 002c002c dead4ead ffffffff ffffffff
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.343092] [c5] e200  bf14a56c c0a92c68 00000000 c07eeb60 00000000 0000000c 00001e00 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.351856] [c5]
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.351856] R7: 0xd1837a18:
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.356894] [c5] 7a18  c0090e48 c008fce8 00000001 00000000 00000000 c00ea1f0 d1837a84 00000411
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.365652] [c5] 7a38  00000006 00000002 00000140 d1837b28 0000000e d1837b08 00000102 c00ea314
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.374424] [c5] 7a58  c1d2ae00 d1837b28 d1837abc d1837b0c 00000000 00000000 00000fff 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.383189] [c5] 7a78  00000000 00000000 00000000 c02897cc cd9ce1a0 00140000 c02897cc c00613cc
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.391952] [c5] 7a98  00000000 00000000 00000000 00000000 0013ffff 00000000 d1837adc 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.400706] [c5] 7ab8  d1837bb0 d1837b28 cd9ce2bc 0000000e c144c6e0 ffffffff d1837b8c d1837ae0
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.409471] [c5] 7ad8  bf0e17c0 bf0e08f8 0000000e 00000080 00000000 cd9ce1a0 00000000 00000002
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.418232] [c5] 7af8  d1837b0c 00000000 00000000 00000000 0000000e 00000000 cd9cdf90 bf0c4c2c
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.426997] [c5]
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.426997] R9: 0xc2a58f80:
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.432034] [c5] 8f80  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.440792] [c5] 8fa0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.449555] [c5] 8fc0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.458319] [c5] 8fe0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.467082] [c5] 9000  d45bdd78 d4f9a668 00000000 00000000 00000000 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.475846] [c5] 9020  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.484618] [c5] 9040  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.493381] [c5] 9060  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.502146] [c5]
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.502146] R10: 0xd6cd7ca0:
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.507284] [c5] 7ca0  00000000 00000000 00000000 d6cd7cac d6cd7ee0 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.516028] [c5] 7cc0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.524792] [c5] 7ce0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.533555] [c5] 7d00  00000000 00000000 00000000 00000000 00000001 00000000 00000008 d64eba00
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.542317] [c5] 7d20  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.551081] [c5] 7d40  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.559846] [c5] 7d60  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.568608] [c5] 7d80  00000000 00000000 00000000 00000000 d6cd7e70 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.577380] [c5] Process btrfs-transacti (pid: 5730, stack limit = 0xd1836238)
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.584782] [c5] Stack: (0xd1837810 to 0xd1838000)
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.589718] [c5] 7800:                                     d45bdd78 00000000 00000000 00cc00cb
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.598500] [c5] 7820: d45bdd94 c061c6b4 d183784c d1837838 c061c6b4 c00613cc c144c6e0 d477e7b8
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.607263] [c5] 7840: d183786c d1837850 bf0dc3b4 c061c688 c2a59000 cd9cdf60 d45bdd78 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.616026] [c5] 7860: d1837884 d1837870 bf0e2484 bf0dc300 d6cd7d2c 00000006 d18378a4 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.624789] [c5] 7880: 00000000 0013ffff d1837a98 d1837a9c c2a59000 d6cd7d20 d1837984 d18378a8
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.633552] [c5] 78a0: bf0c9a98 bf0c9054 00000000 00000000 0013ffff 00000000 d1837a98 d1837a9c
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.642317] [c5] 78c0: 00000001 bf0deb4c 00140000 00000000 00000000 00000002 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.651079] [c5] 78e0: 00140000 00000000 00000000 00000000 00140000 00000000 00000000 c144c6e0
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.659842] [c5] 7900: 00140000 00000000 00000000 00000000 00140000 00000000 00140000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.668608] [c5] 7920: 00000000 00000000 d477e7b8 cd9ce1a0 c2a59000 00000000 00140000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.677331] [c5] 7940: c1d11800 c2d99800 00000001 6c000000 00000000 00000000 d18379bc 0013ffff
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.686133] [c5] 7960: d1837a98 00000002 d1837a9c 00000000 cd9ce1a0 cd9cdf90 d18379fc d1837988
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.694896] [c5] 7980: bf0ca604 bf0c9664 0013ffff 00000000 d1837a98 00000001 d1837a9c 77817780
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.703663] [c5] 79a0: cd9ce1a0 00000000 00000001 c144c6e0 08000000 00000000 00000516 d4fa0160
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.712386] [c5] 79c0: 00000000 00000000 0013ffff 00000000 00000500 d1837a9c 00000000 d1837bb0
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.721150] [c5] 79e0: c144c6e0 00000000 d1837aa8 cd9cdf90 d1837adc d1837a00 bf0e11b4 bf0ca2a4
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.729913] [c5] 7a00: 0013ffff 00000000 d1837a98 d1837a9c d1837a6c d1837a20 c0090e48 c008fce8
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.738676] [c5] 7a20: 00000001 00000000 00000000 c00ea1f0 d1837a84 00000411 00000006 00000002
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.747439] [c5] 7a40: 00000140 d1837b28 0000000e d1837b08 00000102 c00ea314 c1d2ae00 d1837b28
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.756202] [c5] 7a60: d1837abc d1837b0c 00000000 00000000 00000fff 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.764966] [c5] 7a80: 00000000 c02897cc cd9ce1a0 00140000 c02897cc c00613cc 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.773730] [c5] 7aa0: 00000000 00000000 0013ffff 00000000 d1837adc 00000000 d1837bb0 d1837b28
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.782492] [c5] 7ac0: cd9ce2bc 0000000e c144c6e0 ffffffff d1837b8c d1837ae0 bf0e17c0 bf0e08f8
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.791267] [c5] 7ae0: 0000000e 00000080 00000000 cd9ce1a0 00000000 00000002 d1837b0c 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.800028] [c5] 7b00: 00000000 00000000 0000000e 00000000 cd9cdf90 bf0c4c2c 00000000 20010012
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.808792] [c5] 7b20: 0000000e 00000000 c144c6e0 c144c700 c144c720 c144c740 c144c760 c144c780
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.817556] [c5] 7b40: c144c7a0 c144c7c0 c144c7e0 c1bd4f00 c1d1b400 c1d28b00 c1d55700 c1d2ae00
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.826318] [c5] 7b60: 4e16a555 7fffffff 7fffffff ffffffff ffffffff 00000000 00000000 cd9ce1a0
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.835082] [c5] 7b80: d1837b9c d1837b90 bf0c48f8 bf0e1588 d1837bac d1837ba0 c00f5f08 bf0c48d4
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.843845] [c5] 7ba0: d1837be4 d1837bb0 c00ebae4 c00f5ee0 7fffffff 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.852609] [c5] 7bc0: ffffffff 7fffffff 00000001 00000000 ffffffff 7fffffff d1837c0c d1837be8
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.861373] [c5] 7be0: c00ecb58 c00eba94 ffffffff 7fffffff 00000001 0013ffff ffffffff 7fffffff
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.870137] [c5] 7c00: d1837c54 d1837c10 bf0dadac c00ecb38 ffffffff 7fffffff bf0de080 bf0dd198
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.878900] [c5] 7c20: ffffffff 7fffffff 00001008 00000000 00000050 ffffffff ffffffff 00000006
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.887663] [c5] 7c40: 00000000 cd9ce1a0 d1837d3c d1837c58 bf103748 bf0dad44 ffffffff ffffffff
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.896450] [c5] 7c60: d1837cac 00000050 00000000 00000000 00000000 60010013 d1837cd4 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.905215] [c5] 7c80: 0013ffff 00000000 00000001 00000000 00000000 cd9ce1a0 cd9cdf90 c2a59000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.913975] [c5] 7ca0: d40260c8 00000000 00000000 00000000 c014c5f0 cb594e34 cd9ce2a8 cd9ce1f0
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.922739] [c5] 7cc0: d1837cc0 d1837cc0 c2a59000 002a0029 cd9ce2a8 cb594e34 cb594e00 cb594e34
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.931502] [c5] 7ce0: c2a59000 05490548 cb594e34 00000000 00000000 c1d99800 de1de800 c2a59000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.940265] [c5] 7d00: 00001000 00000140 00000140 00000001 bf1039cc cb594e00 cb594e34 cd9ce1a0
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.949029] [c5] 7d20: d3dc5f50 c2a59000 d477e7b8 c8edef80 d1837d7c d1837d40 bf103d04 bf103010
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.957793] [c5] 7d40: d477e7b8 d3dc5f50 42000000 00000067 d1837d7c c2000000 00000066 cb594e00
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.966555] [c5] 7d60: d477e7b8 40000000 00000001 c2a5f800 d1837e04 d1837d80 bf0b0a24 bf103c80
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.975319] [c5] 7d80: 00000000 00000001 00140000 00000000 00140000 00000000 00140000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.984083] [c5] 7da0: d1837dd0 d477e7b8 d407988c 00000001 40000000 00000000 d477e7b8 c4ee4734
    Dec 13 12:24:59 Archimedes-I kernel: [3361890.992855] [c5] 7dc0: 02000000 00000009 d3dc5f50 00000000 81540000 00000001 d45bdd78 c2a5f800
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.001620] [c5] 7de0: d4027450 c2a59000 d477e7b8 c2a5f810 c2a5f9c7 c2a5fd04 d1837e64 d1837e08
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.010381] [c5] 7e00: bf0bf080 bf0b03e4 00000000 d1837e34 00000001 d4026000 c2a5b800 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.019144] [c5] 7e20: bf0c0bf8 d4026000 02a5c000 00000000 d1837e54 d45bdd78 bf112928 d477e7b8
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.027908] [c5] 7e40: d4079770 c2a59000 d4079824 00000049 00000000 d1836000 d1837eec d1837e68
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.036671] [c5] 7e60: bf0c0c28 bf0bef24 d1837ec4 d1837e78 00000000 00000001 00000001 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.045434] [c5] 7e80: 00000000 00000000 c2a6eb80 c0054a44 d1837e90 d1837e90 c06199d8 bf14cce4
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.054199] [c5] 7ea0: bf0b9344 00001364 00000000 c2a59000 d1836000 00001364 c09a24c0 d4079770
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.062968] [c5] 7ec0: 00000001 c2a59000 d1836000 00001364 c09a24c0 00000000 00000000 00001770
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.071727] [c5] 7ee0: d1837f24 d1837ef0 bf0b942c bf0c07a0 000000a8 00000000 bf0b92b0 d3081cd4
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.080489] [c5] 7f00: 00000000 c2a59000 bf0b92b0 00000000 00000000 00000000 d1837fac d1837f28
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.089214] [c5] 7f20: c0053ee0 bf0b92bc d1836000 00000000 c1e0a1c0 c2a59000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.097978] [c5] 7f40: dead4ead ffffffff ffffffff c09a0abc 00000000 00000000 c07dcc88 d1837f5c
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.106741] [c5] 7f60: d1837f5c 00000000 00000000 dead4ead ffffffff ffffffff c09a0abc 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.115504] [c5] 7f80: 00000000 c07dcc88 d1837f88 d1837f88 d3081cd4 c0053e2c 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.124267] [c5] 7fa0: 00000000 d1837fb0 c000e9a0 c0053e38 00000000 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.133030] [c5] 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.141794] [c5] 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000 000002df 00000001
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.150556] [c5] Backtrace:
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.153796] [c5] [<bf0c9048>] (__cow_file_range+0x0/0x610 [btrfs]) from [<bf0c9a98>] (run_delalloc_nocow+0x440/0xb74 [btrfs])
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.165255] [c5] [<bf0c9658>] (run_delalloc_nocow+0x0/0xb74 [btrfs]) from [<bf0ca604>] (run_delalloc_range+0x36c/0x3b8 [btrfs])
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.176917] [c5] [<bf0ca298>] (run_delalloc_range+0x0/0x3b8 [btrfs]) from [<bf0e11b4>] (__extent_writepage+0x8c8/0x9cc [btrfs])
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.188709] [c5] [<bf0e08ec>] (__extent_writepage+0x0/0x9cc [btrfs]) from [<bf0e17c0>] (extent_writepages+0x244/0x370 [btrfs])
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.200203] [c5] [<bf0e157c>] (extent_writepages+0x0/0x370 [btrfs]) from [<bf0c48f8>] (btrfs_writepages+0x30/0x34 [btrfs])
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.211234] [c5] [<bf0c48c8>] (btrfs_writepages+0x0/0x34 [btrfs]) from [<c00f5f08>] (do_writepages+0x34/0x48)
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.221126] [c5] [<c00f5ed4>] (do_writepages+0x0/0x48) from [<c00ebae4>] (__filemap_fdatawrite_range+0x5c/0x64)
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.231361] [c5] [<c00eba88>] (__filemap_fdatawrite_range+0x0/0x64) from [<c00ecb58>] (filemap_fdatawrite_range+0x2c/0x34)
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.242549] [c5]  r5:7fffffff r4:ffffffff
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.246896] [c5] [<c00ecb2c>] (filemap_fdatawrite_range+0x0/0x34) from [<bf0dadac>] (btrfs_wait_ordered_range+0x74/0x16c [btrfs])
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.258513] [c5]  r5:7fffffff r4:ffffffff
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.263003] [c5] [<bf0dad38>] (btrfs_wait_ordered_range+0x0/0x16c [btrfs]) from [<bf103748>] (__btrfs_write_out_cache+0x744/0x980 [btrfs])
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.275614] [c5] [<bf103004>] (__btrfs_write_out_cache+0x0/0x980 [btrfs]) from [<bf103d04>] (btrfs_write_out_cache+0x90/0xd0 [btrfs])
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.287762] [c5] [<bf103c74>] (btrfs_write_out_cache+0x0/0xd0 [btrfs]) from [<bf0b0a24>] (btrfs_write_dirty_block_groups+0x64c/0x75c [btrfs])
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.300613] [c5] [<bf0b03d8>] (btrfs_write_dirty_block_groups+0x0/0x75c [btrfs]) from [<bf0bf080>] (commit_cowonly_roots+0x168/0x28c [btrfs])
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.313456] [c5] [<bf0bef18>] (commit_cowonly_roots+0x0/0x28c [btrfs]) from [<bf0c0c28>] (btrfs_commit_transaction+0x494/0xbc8 [btrfs])
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.325776] [c5] [<bf0c0794>] (btrfs_commit_transaction+0x0/0xbc8 [btrfs]) from [<bf0b942c>] (transaction_kthread+0x17c/0x1dc [btrfs])
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.337835] [c5] [<bf0b92b0>] (transaction_kthread+0x0/0x1dc [btrfs]) from [<c0053ee0>] (kthread+0xb4/0xc0)
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.347542] [c5] [<c0053e2c>] (kthread+0x0/0xc0) from [<c000e9a0>] (ret_from_fork+0x14/0x20)
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.356118] [c5]  r7:00000000 r6:00000000 r5:c0053e2c r4:d3081cd4
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.362354] [c5] Code: 0a000021 e3510000 03500001 0afffece (e7f001f2)
    Dec 13 12:24:59 Archimedes-I kernel: [3361891.369058] [c5] ---[ end trace 9728a729a64094a3 ]---
    Dec 13 12:28:46 Archimedes-I kernel: [3362118.317402] [c3] btrfs: defrag_file cancelled

Another Update

After attempting to do a rebalance, the kernel oops messages kept occurring upon every mount. Eventually commands like mount and umount, and even ls, were getting stuck inside syscalls forever. btrfs check showed up quite a few errors, and the drive had zero free space left (metadata used it all).

I ended up mounting the drive with

sudo mount -o skip_balance,recovery,noatime /dev/sda1 /mnt/hdd_0

before copying all 2TB of data off the drive onto a spare ext4 disk, then rebooted, reformatted the btrfs drive, and copied everything back on.

LESSON: As of the 3.10 kernel (which is two years old), btrfs-convert isn't nice, and the kernel is buggy. Oops!

So, don't I wouldn't bother with btrfs-convert. It seems like a nice solution on paper, but it's far better just to copy all the data off the drive, format, and copy it back.


Just a data point really...

I just tried converting a 200G partition and using the btrfs-tools V4.0 and it failed - actually it seems it crashed - after reporting 'not enough free space' (partially overwriting the progress info).

# btrfs-convert -l trial /dev/trial/home
creating btrfs metadata.
not enough free space244027/    240502]
extent-tree.c:2628: btrfs_reserve_extent: Assertion `ret` failed.
btrfs-convert[0x41025d]
btrfs-convert[0x410281]
btrfs-convert(btrfs_reserve_extent+0x883)[0x41465e]
btrfs-convert(btrfs_alloc_free_block+0x63)[0x414715]
btrfs-convert(__btrfs_cow_block+0x101)[0x408edd]
btrfs-convert(btrfs_cow_block+0x89)[0x40948c]
btrfs-convert[0x409f57]
btrfs-convert[0x40a6a2]
btrfs-convert(btrfs_search_slot+0x7b3)[0x40b8a1]
btrfs-convert(btrfs_csum_file_block+0x26b)[0x417ee4]
btrfs-convert[0x42a062]
btrfs-convert[0x42a41d]
/lib/x86_64-linux-gnu/libext2fs.so.2(+0x147bd)[0x7f463c1f97bd]
/lib/x86_64-linux-gnu/libext2fs.so.2(+0x149ad)[0x7f463c1f99ad]
/lib/x86_64-linux-gnu/libext2fs.so.2(+0x154ab)[0x7f463c1fa4ab]
/lib/x86_64-linux-gnu/libext2fs.so.2(ext2fs_block_iterate2+0x2c [0x7f463c1faa7c]

fsck reported no problems and the filesystem still mounts:

# fsck -f /dev/trial/home
fsck from util-linux 2.26.2
e2fsck 1.42.12 (29-Aug-2014)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/mapper/trial-home: 240502/13107200 files (19.2% non-contiguous), 52237869/52428800 blocks

One interesting point is that the progress was reporting more than 100%, i.e 244027/240502. Perhaps someone could clarify what it was counting?

Anyway, the conclusion is that 744M out of 200G (99.7% used) is not enough free space!

FWIW, I would think that btrfs-convert would get all the metadata in place before destroying (copying and overwriting) the 1Mb which indicated it's an EXT4 filesystem. Until it does that step, there's nothing to undo; it's just been writing in free space. Perhaps this could also be confirmed?


If you enable check-summing (the default) the conversion has to calculate those values then store it in the metadata. So basically it is reading your whole HDD in the conversion... You can disable checksums in the conversion, but this disables btrfs integrity checks and data scrubbing...