maharmstone/ntfs2btrfs

ntfs2btrfs doesn't check for available free space before calculating checksums

Closed this issue · 4 comments

trying to convert 500 GB NTFS partition to BTRFS, ntfs2btrfs calculates checksums for 225 minutes than reports it does not have enough disk space to create new chunk.

Partition is on external , slow USB HDD.

Reproducible: Always

Steps to Reproduce:
1.$ sudo time ntfs2btrfs /dev/sda2
2.
3.
Actual Results:
Fails after claculating checksums for 225 minutes.

Expected Results:
Checks if required free space is available and only then decides to continue or not with the checksuming.

Also, say how much free space is needed.

$ sudo time ntfs2btrfs /dev/sda2
Using Zstd compression.
Using CRC32C for checksums.
Processing inode 75351 / 75351 (100.0%)
Mapped 70600 inodes directly.
Rewrote 0 inodes.
Inlined 2 inodes.
Updating directory sizes
Calculating checksums 122119535 / 122119535 (100.0%)
Could not find enough space to create new chunk. Try clearing a few gigabytes of space, or defragging.
Command exited with non-zero status 1
225.87user 541.41system 3:34:54elapsed 5%CPU (0avgtext+0avgdata 300756maxresident)k
977478568inputs+520outputs (3876762major+7855270minor)pagefaults 0swaps

Try clearing a few gigabytes of space, or defragging.

Did you do what it advised?

I've cleaned up i've cleaned up 20 GB. Due to the long time needed to calculate checksums (almost 4 hours for 500 GB external USB HDD), i can only find out if this is enough after trying it later this day. (Can't do it right now.)
I believe that given a certain amount of data, we can do at least an estimate of how much free space is needed, and if that estimate is not available, application can either stop or ask the user if it wants to continue anyway (informing it about the risks...).
After second attempt i'll report back.

After freeing 20 GB (4%) it completed successfully.

$ sudo time ntfs2btrfs /dev/sda2
[sudo] password for cornel:
Using Zstd compression.
Using CRC32C for checksums.
Processing inode 73542 / 73542 (100.0%)
Mapped 68917 inodes directly.
Rewrote 0 inodes.
Inlined 2 inodes.
Updating directory sizes
Calculating checksums 117234192 / 117234192 (100.0%)
190.31user 448.59system 3:26:18elapsed 5%CPU (0avgtext+0avgdata 1174276maxresident)k
938946264inputs+1163496outputs (3792699major+7427573minor)pagefaults 0swaps

To be clear, when it says "free space" it means free space for the metadata, most of which will be the checksums themselves.

If you want to submit a patch that estimates how much free space will be required in advance, be my guest, but it's not something I'm planning on working on.