FAQ SearchLogin
Tuxera Home
View unanswered posts | View active topics It is currently Thu May 13, 2021 21:00



Post new topic Reply to topic  [ 6 posts ] 
Dirty flag and Documentation 
Author Message

Joined: Tue Nov 01, 2011 23:31
Posts: 6
Post Dirty flag and Documentation
I'm very much so wanting to remove the dirty flag from Volumes. For the life of me I can't figure out either where it's at or how to properly revert it. I spent the better part of yesterday diff'ing the $Volume MFT entries trying discover what gets changed with no real luck. Does anyone know how to accomplish this? Could someone point me in the direction of some real technical reference for NTFS MFT entries? So far all the documentation I could find falls apart at the MFT entry level(it doesn't provide the information needed to actually parse the file entries). Any help would be greatly appreciated.


Tue Nov 01, 2011 23:39
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Dirty flag and Documentation
Hi,

Quote:
I'm very much so wanting to remove the dirty flag from Volumes.

There must have been a reason why it was set in the first place...
Quote:
Does anyone know how to accomplish this?

By running chkdsk, the flag means a check is needed before mounting.
Quote:
Could someone point me in the direction of some real technical reference for NTFS MFT entries?

If you find something better than the source code of ntfs-3g, please tell me.

Regards

Jean-Pierre


Wed Nov 02, 2011 14:01
Profile

Joined: Tue Nov 01, 2011 23:31
Posts: 6
Post Re: Dirty flag and Documentation
Jean-Pierre, thank you for your response.

The dirty flag has been set by me, effectively. I'm working with an ntfsclone'd image of a sysprep'd Windows install. I'm using ntfsresize to adjust the file system to the new volume size.

I've provisioned numerous VM's this way onto a variety of different sized LVM's. So far, I have yet to see chkdsk find an issue when it runs. In your opinion, would you say running the chkdsk
is still necessary as part of my provisioning process?

Also, thanks for pointing me to the ntfs-3g source. I didn't know it was the best place for NTFS reference.


Wed Nov 02, 2011 23:47
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Dirty flag and Documentation
Hi,

Quote:
The dirty flag has been set by me, effectively. I'm working with an ntfsclone'd image of a sysprep'd Windows install. I'm using ntfsresize to adjust the file system to the new volume size

Then the dirty flag is relevant : ntfsresize has to be applied before the partition is shrunk, and it cannot determine the exact new size of the partition. Moreover the partition sizes given to ntfsresize and to the partition editor are given roughly (such as a GB count) and the partition editor has to make alignments depending on the partition model, which ntfsresize does not know.

As a consequence ntfsresize cannot create the backup boot sector on the last sector of the partition, which is very important when the normal boot sector is damaged.

Quote:
So far, I have yet to see chkdsk find an issue when it runs.

chkdsk fixes the backup boot sector silently (even if it is correct, by the way).

Recent ntfsfix'es also fix the backup boot sector, in the attached patch I have added a new option "-d" to clear the volume dirty flag provided ntfsfix can mount the partition (after fixing it). Please try, after the partition is resized by the partition editor.

Regards

Jean-Pierre


Attachments:
ntfsfix.c.patch80.gz [928 Bytes]
Downloaded 797 times
Thu Nov 03, 2011 10:03
Profile

Joined: Tue Nov 01, 2011 23:31
Posts: 6
Post Re: Dirty flag and Documentation
I'm actually only ever expanding the volume, never shrinking it. The ntfsclone image is from a Windows install onto a 10g LVM, and it's looking like we won't be provisioning onto anything less than 20g in production. Current process is:

create lvm
create the MBR and "Boot" partition with parted(interestingly I have to specify the start as 1048576b on advanced format disks, 1 or 1M or etc and parted starts it on sector 63)
use kpartx to map the boot partition
restore the image with ntfsclone
ntfsresize the restored filesystem so it fits the partition(device)
use ms-sys to make it bootable


I've actually patched ntfsresize to allow a -c option which will keep the volume clean. I'll give your patched ntfsfix a go though; I was not aware the backup boot sector was not being put in its proper place.

Thanks again.


Thu Nov 03, 2011 13:24
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Dirty flag and Documentation
Hi,

Quote:
I'm actually only ever expanding the volume, never shrinking it.

In this case the partition has to be resized first, and ntfsresize could write the backup bootsector... but it does not.
Quote:
interestingly I have to specify the start as 1048576b on advanced format disks, 1 or 1M or etc and parted starts it on sector 63

Typical of an alignment decided by the partition editor : aligning to the second track and fitting the sector per track count into a field 6 bits wide.

Note : Windows will not boot if the initial sector does not match (when ntfscloning from another partition with a different initial sector).

Regards

Jean-Pierre


Thu Nov 03, 2011 15:06
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Original forum style by Vjacheslav Trushkin.