FAQ SearchLogin
Tuxera Home
View unanswered posts | View active topics It is currently Fri May 07, 2021 02:03



Post new topic Reply to topic  [ 3 posts ] 
ntfsresize fails to backup boot sector 
Author Message

Joined: Tue May 17, 2011 21:33
Posts: 5
Post ntfsresize fails to backup boot sector
After resizing the filesystem, the last sector does not have a copy of the boot sector as it should.


Thu May 23, 2013 21:00
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: ntfsresize fails to backup boot sector
Hi,

Quote:
After resizing the filesystem, the last sector does not have a copy of the boot sector as it should.

Yes, and I consider this to be impossible in most cases :

The backup boot sector has to be the last sector of a partition, not the last sector of the file system, but in the usual situation (downsizing), the partition is not yet created and its last sector is coarsely defined. The partition size given to ntfsresize is often defined as a megabyte quantity, so will the subsequent partition definition and a different approximation for a megabyte may be applied. Moreover an alignment unknown to ntfsresize may be forced on this partition definition.

Currently ntfsresize marks the file system to be chkdsk'ed at next Windows mounting, which fixes the backup bootsector. If the file system is not to be mounted on Windows, ntfsfix can be used to set the backup boot sector (and the chkdsk mark can be removed by option -d). Of course both chkdsk and ntfsresize have to be started after the partition is resized.

ntfsresize could set the backup boot sector when expanding the file system, because the partition has to be expanded first, and its size is then known to ntfsresize.

It would also be reasonable to set the backup boot sector when the partition size given to ntfsresize is precisely defined as a sector count. This might be useful when both ntfsresize and the partition editor are controlled by an upper layer tool (such as gparted).

Can you describe your need more precisely ?

Regards

Jean-Pierre


Thu May 23, 2013 22:01
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: ntfsresize fails to backup boot sector
Hi,

Attached is a proposed patch for setting the backup boot sector when :
- either the size argument is defined as a number of bytes with no multiplier suffix, and is a multiple of the sector size,
- or when the size is not defined (which means to fill the partition).

The first case is for assuming the partition will later be set to the same size, the second case is for assuming the partition will not be resized.

** edit **

The first case above was supposed to meet the needs for a higher level tool defining the same value for ntfsresize and a partition editor. However in the issue reported in viewtopic.php?f=2&t=30136 I see that the command issued by gparted was
Code:
ntfsresize -P --force --force /dev/sdb1 -s 542112711167

and 542112711167 is obviously not the partition size as expected by ntfsresize, so the below patch will be of no use.

Regards

Jean-Pierre


Attachments:
backup-bootsector.patch.gz [832 Bytes]
Downloaded 843 times
Fri May 24, 2013 15:45
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Original forum style by Vjacheslav Trushkin.