OSDN Git Service

Reserved a single sector for the backup boot sector
authorJean-Pierre André <jpandre@users.sourceforge.net>
Tue, 30 Jul 2013 08:35:13 +0000 (10:35 +0200)
committerJean-Pierre André <jpandre@users.sourceforge.net>
Tue, 30 Jul 2013 08:35:13 +0000 (10:35 +0200)
Reserve a single sector, instead of a full cluster, for the backup boot
sector.

ntfsprogs/ntfsresize.c

index 08b4ec4..6f54181 100644 (file)
@@ -4401,13 +4401,12 @@ int main(int argc, char **argv)
                opt.reliable_size = 1;
        }
 
-       /* Take the integer part: don't make the volume bigger than requested */
-       new_size = opt.bytes / vol->cluster_size;
-
        /* Backup boot sector at the end of device isn't counted in NTFS
           volume size thus we have to reserve space for it. */
-       if (new_size)
-               --new_size;
+       if (opt.bytes > vol->sector_size)
+               new_size = (opt.bytes - vol->sector_size) / vol->cluster_size;
+       else
+               new_size = 0;
 
        if (!opt.info && !opt.infombonly) {
                print_vol_size("New volume size    ", vol_size(vol, new_size));