Szakacsits Szabolcs writes ("Re: [Linux-NTFS-Dev] Implementing ntfsimage"):
> On Thu, 10 Apr 2003, Ian Jackson wrote:
> > So, perhaps I should have ntfsimage generate an image not containing
> > the spare boot sector, but with the `dirty' bit set, so that NT will
> > rewrite the spare ?
>
> I don't think so. For imaging that seems to be too intrusive.
>
> If you can access that sector just do it.
This is all very well, but the results can't be expressed in a
filesystem-neutral way.
Consider: the stream image format I'm planning will allow you to
efficiently represent, essentially, a sparse file. This is good
enough for all `sensible' filesystems - ie, filesystems which can be
moved to another partition using `dd' provided that the destination
partition is big enough.
So the whole thing is some kind of optimised dd.
But an NTFS volume cannot be moved to another partition using dd
unless the destination partition is _exactly_ the same size as the
source partition.
I don't want to put filesystem-specific knowledge into the image
format - before you know it there'll be weird hacks to fix up CHS
information in FAT boot sectors. I want the image format to be
exactly a representation of an optimised dd.
So that leaves precious few choices for an NTFS image generator. I
can include the spare boot sector in the image stream, but that makes
it dependent on the exact partition size (which is at least something
that I think one might reasonably put a flag in the image stream
header for). Or I can mark the filesystem dirty and not include the
spare boot sector (but still make the image say it needs 512 bytes
more than the core of the fs).
I think the best option is to take one of these two approaches at the
user's option. By default probably mark the fs dirty, as that makes
the resulting image less fragile, with options to ignore the issue and
not mark the fs dirty (ie user promises to run chkdsk themselves), and
to make the image specific to the exact partition size.
(In the case of the exact partition size specification, you can of
course tell restoreimage to restore it anyway, but that's all getting
a bit hairy.)
> If not, you can either
> a) warn the user, to run chkdsk to recovery it because Linux
> kernel couldn't access that sector due to its limitation
> or
> b) access the sector via the disk, not the partition (could be
> quite messy/error-prone considering disk geometry issues)
I think the right answer if we want to access the sector and can't is
to fail and explain why. If the user is troubled they can use the
other option - don't copy spare boot sector, mark fs as dirty.
> Anyway, don't waste time with this in the beginning, it's enough if you're
> aware of this issue when designing the format.
I think this issue is very difficult, as you can see.
Hrm, I think I may be a bit unclear here, so let me explain my current
proposal again slightly differently:
ntfsimage will have three modes:
Mode --dirty --promise-chkdsk --exact-size
(default) (unsafe)
Dirty bit in Always Copied from real Copied from real
fs image in dirty filesystem volume filesystem volume
output (changed) (ie unchanged) (ie unchanged)
Image size as fs size fs size Size of actual
declared in image + 512 + 512 partition
stream header bytes bytes
Image `exact size' Clear (ie, Clear (ie Set (ie, exact
flag in stream hdr flexible) flexible) size required)
Spare boot sector Not present Not present Last 512 bytes
location in image of image
If last sector Irrelevant Irrelevant Fail and suggest
can't be read? use of --dirty
When you're restoring, this plays out like this:
To restore to No problem No problem No problem
same size part'n chkdsk runs User runs chkdsk No chkdsk needed
To restore to No problem No problem User must give
different size chkdsk runs User must --force option
automatically run chkdsk to restoreimage
by hand and run chkdsk
Ian.
|