SUMMARY enlarging mounted btrfs partition with "Align" option checked leads to data loss. I just wanted to enlarge the root partition, and I had the free space to do so. Btrfs allows online resize so I used this tool to do it. After I started the task, I noticed that the tool was also moving the whole partition to "align" it. I think the "align" checkbox is checked by default, and it's also hidden in the default interface behind an "advanced" button. I did not realize that this would destroy the partition, so I didn't terminate the task. The partition was lost and the system crashed. I had to reload a partition image from backups. STEPS TO REPRODUCE 1. resize an unaligned and mounted btrfs partition that is in use (ideally a root partition of a test system), with the "Align" option checked. 2. Wait 3. profit OBSERVED RESULT The partition is trashed EXPECTED RESULT "Align" option is disabled for mounted resize of filesystems. I'm sure moving around a mounted ext4 or xfs partition to "align" it is equally bad, so just disable that if the filesystem is mounted. SOFTWARE/OS VERSIONS Linux/KDE Plasma: OpenSuse Tumbleweed (available in About System) KDE Frameworks 5.62.0 Qt 5.13.1 (built against 5.13.1)
Regarding disabling if it's mounted, that's not possible. Btrfs does not support offline resizing at all, to resize btrfs partition we mount it anyway. Instead of disabling it, it's better to investigate whether it is reproducible and what causes this bug.
Ok, I tested this on my system. I'll disable automatic realignment. I slightly misunderstood your initial comment, so ignore my first comment that it's not possible. (What's not possible is not mounting btrfs in order to resize but moving partitions can only be done when they are not mounted)
Git commit 0b5e5040ebb3c172ea9c70af660e73957fc1334e by Andrius Štikonas. Committed on 05/10/2019 at 10:52. Pushed by stikonas into branch 'master'. Do not align partitions if they are mounted. Moving data when partitions are mounted is almost guaranteed to cause data loss. M +3 -1 src/gui/partresizerwidget.h https://invent.kde.org/kde/kpmcore/commit/0b5e5040ebb3c172ea9c70af660e73957fc1334e
I'll try to release a new bug fix version of kpmcore too.
Git commit 40b65438f0608a1913cd5b6232232fed78d50bdc by Andrius Štikonas. Committed on 05/10/2019 at 11:08. Pushed by stikonas into branch '4.0'. Do not align partitions if they are mounted. Moving data when partitions are mounted is almost guaranteed to cause data loss. M +3 -1 src/gui/partresizerwidget.h https://invent.kde.org/kde/kpmcore/commit/40b65438f0608a1913cd5b6232232fed78d50bdc
Thank you!