diff --git a/src/core/lvmdevice.cpp b/src/core/lvmdevice.cpp
index 80b4125..91ce148 100644
--- a/src/core/lvmdevice.cpp
+++ b/src/core/lvmdevice.cpp
@@ -282,13 +282,14 @@ bool LvmDevice::createLV(Report& report, LvmDevice& dev, Partition& part, const
return (cmd.run(-1) && cmd.exitCode() == 0);
}
-bool LvmDevice::resizeLv(Report& report, LvmDevice& dev, Partition& part)
+bool LvmDevice::resizeLV(Report& report, LvmDevice& dev, Partition& part)
{
Q_UNUSED(dev);
- //TODO: through tests
+ //TODO: through tests and add warning that it could currupt the user data.
ExternalCommand cmd(report, QStringLiteral("lvm"),
{ QStringLiteral("lvresize"),
- //QStringLiteral("--yes"), // this command could corrupt user data
+ QStringLiteral("--force"), // this command could corrupt user data
+ QStringLiteral("--yes"),
QStringLiteral("--extents"),
QString::number(part.length()),
part.partitionPath()});
diff --git a/src/core/lvmdevice.h b/src/core/lvmdevice.h
index a03e2af..158d4e4 100644
--- a/src/core/lvmdevice.h
+++ b/src/core/lvmdevice.h
@@ -63,7 +63,7 @@ public:
static bool removeLV(Report& report, LvmDevice& dev, Partition& part);
static bool createLV(Report& report, LvmDevice& dev, Partition& part, const QString& lvname);
- static bool resizeLv(Report& report, LvmDevice& dev, Partition& part);
+ static bool resizeLV(Report& report, LvmDevice& dev, Partition& part);
static bool removePV(Report& report, LvmDevice& dev, const QString& pvPath);
static bool insertPV(Report& report, LvmDevice& dev, const QString& pvPath);
diff --git a/src/jobs/setpartgeometryjob.cpp b/src/jobs/setpartgeometryjob.cpp
index b55e93d..90ee232 100644
--- a/src/jobs/setpartgeometryjob.cpp
+++ b/src/jobs/setpartgeometryjob.cpp
@@ -25,6 +25,7 @@
#include "core/partition.h"
#include "core/device.h"
+#include "core/lvmdevice.h"
#include "util/report.h"
@@ -77,9 +78,12 @@ bool SetPartGeometryJob::run(Report& parent)
} else
report->line() << xi18nc("@info:progress", "Could not open device %1 while trying to resize/move partition %2.", device().deviceNode(), partition().deviceNode());
} else if (device().type() == Device::LVM_Device) {
+ LvmDevice& dev = dynamic_cast(device());
//TODO: resize given LVM LV
partition().setFirstSector(newStart());
partition().setLastSector(newStart() + newLength() - 1);
+
+ rval = LvmDevice::resizeLV(*report, dev, partition());
}
jobFinished(*report, rval);