[I'm not sure this is a real bug, but here we go ...]
[https://bugzilla.redhat.com/show_bug.cgi?id=895946]

It was reported to me that when you resize a filesystem down to a
smaller size then back up to the original size, the number of blocks
(as reported by statvfs) is one less than expected.

Attached is a small guestfish script that demonstrates this:

  $ /tmp/ntfsresize.sh 
  blocks: 25568
  Resizing filesystem to 10000 blocks ...
  blocks: 9999
  Resizing filesystem to original (full) size ...
  blocks: 25567

Here is the ntfsresize command that libguestfs runs:
https://github.com/libguestfs/libguestfs/blob/master/daemon/ntfs.c#L69

(Note we're using a rather old version of ntfs-3g,
ntfs-3g-2012.1.15-5.fc18.x86_64.  I'm going to try a more recent
version shortly).

Is this expected?  I imagine that one block could "go missing" for the
superblock or whatever overhead.  However it's rather unusual that the
size changes from the original size.

Rich.

----------------------------------------------------------------------
#!/bin/bash -

set -e
#set -x
#export LIBGUESTFS_TRACE=1

guestfish -N fs:ntfs <<EOF

mount /dev/sda1 /
statvfs / | grep ^blocks:
umount /

echo Resizing filesystem to 10000 blocks ...
ntfsresize /dev/sda1 size:$((10000*4096)) force:true

mount /dev/sda1 /
statvfs / | grep ^blocks:
umount /

echo Resizing filesystem to original (full) size ...
ntfsresize /dev/sda1 force:true

mount /dev/sda1 /
statvfs / | grep ^blocks:
umount /

EOF
----------------------------------------------------------------------

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
ntfs-3g-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel

Reply via email to