Bug 407834 - fatresize at the end of a restore operation fails with warning
Summary: fatresize at the end of a restore operation fails with warning
Status: RESOLVED FIXED
Alias: None
Product: partitionmanager
Classification: Applications
Component: general (show other bugs)
Version: 4.0.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Andrius Štikonas
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-22 16:02 UTC by Mattia
Modified: 2020-10-04 21:23 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mattia 2019-05-22 16:02:51 UTC
At the end of a restore operation a fatresize command is always performed even if one doesn't select the option to maximize the partition.
Moreover, the fatresize command fails and produce a warning:

Restore partition from ‘/home/taurus/efi.backup’ to ‘/dev/sda2’ 
Job: Restore the file system from file ‘/home/taurus/efi.backup’ to partition ‘/dev/sda2’ 
Copying 10 blocks (104857600 bytes) from 94371840 to 73495740416, direction: right. 

Copying 10 blocks (104857600 bytes) finished. 

Closing device. This may take a few seconds. 
Restore the file system from file ‘/home/taurus/efi.backup’ to partition ‘/dev/sda2’: Success

Job: Check file system on partition ‘/dev/sda2’ 
Command: fsck.fat -a -w -v /dev/sda2 
Check file system on partition ‘/dev/sda2’: Success

Job: Maximize file system on ‘/dev/sda2’ to fill the partition 
Resizing file system from 104857600 to 204800 sectors. 

Command: fatresize --verbose --size 104857600 /dev/sda2 
Maximize file system on ‘/dev/sda2’ to fill the partition: Error

WARNING: Maximizing file system on target partition ‘/dev/sda2’ to the size of the partition failed. 
Restore partition from ‘/home/taurus/efi.backup’ to ‘/dev/sda2’: Warning
Comment 1 Andrius Štikonas 2019-05-22 16:50:10 UTC
If I remember correctly, file system is always resized at the end of 
fsck operation.

We manually run resize job in case filesystem size is less than 
partition size. GParted does that too.

Does KDE Partition Manager report that operation succeeded (since it's a 
warning only)? It wasn't clear to me from this bug.
Comment 2 Mattia 2019-05-23 15:22:17 UTC
(In reply to Andrius Štikonas from comment #1)
> Does KDE Partition Manager report that operation succeeded (since it's a 
> warning only)? It wasn't clear to me from this bug.

Yes, the final result reported by PM is that the operation succeeded. This is just a warning issued in the details log.
Comment 3 Andrius Štikonas 2020-10-04 21:21:31 UTC
Hmm, I think this might be off by 1 error in fatresize or libparted...

Trying to resize to partition size - 1 seems to work.
Comment 4 Andrius Štikonas 2020-10-04 21:23:05 UTC
Git commit 7ecdaf3ac8f63de014fce26e95444f4a420ffcb3 by Andrius Štikonas.
Committed on 04/10/2020 at 21:21.
Pushed by stikonas into branch 'master'.

Fix resizing of fat partitions.

Workaround a bug in fatresize (or libparted) where resizing to
partition length failed. Instead try to resize to length - 1.

M  +1    -1    src/fs/fat16.cpp

https://invent.kde.org/system/kpmcore/commit/7ecdaf3ac8f63de014fce26e95444f4a420ffcb3