util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Karel Zak <kzak@redhat.com>
To: Theodore Ts'o <tytso@mit.edu>
Cc: Mike Fleetwood <mike.fleetwood@googlemail.com>,
	util-linux@vger.kernel.org
Subject: Re: blkid identifying whole disk ntfs as both ntfs and msdos partition table
Date: Tue, 2 Jul 2019 21:06:44 +0200	[thread overview]
Message-ID: <20190702190644.57acag2rfaclu5e7@ws.net.home> (raw)
In-Reply-To: <20190702181439.GB3032@mit.edu>

On Tue, Jul 02, 2019 at 02:14:39PM -0400, Theodore Ts'o wrote:
> On Tue, Jul 02, 2019 at 11:43:34AM +0100, Mike Fleetwood wrote:
> > Hi,
> > 
> > Tested with mkntfs from ntfsprogs and blkid and wipefs from util-linux git HEAD.
> > Test case:
> > 
> > # mkntfs -Q -F /dev/sdb
> > /dev/sdb is entire device, not just one partition.
> > mkntfs forced anyway.
> > Cluster size has been automatically set to 4096 bytes.
> > Creating NTFS volume structures.
> > mkntfs completed successfully. Have a nice day.
> > # ./blkid --version
> > lt-blkid from util-linux 2.34.24-e3bb9  (libblkid 2.34.24, 14-Jun-2019)
> > # ./blkid /dev/sdb
> > /dev/sdb: UUID="3B64D28A5CF89146" TYPE="ntfs" PTTYPE="dos"
> > # ./wipefs /dev/sdb
> > DEVICE OFFSET TYPE UUID             LABEL
> > sdb    0x3    ntfs 3B64D28A5CF89146
> > sdb    0x1fe  dos

 Thanks for your report Mike.

> So what we call the dos partition table, Microsoft calls the "boot
> sector", and it's not necessarily a partition table at all.  (Note
> also that normally, Microsoft won't let you put an ntfs file system on
> the whole disk --- and you had to force this with mkntfs -F.  It's
> actually a bad idea, because some versions of Windows will see what it
> thinks is an empty disk, and the contents of that whole disk file
> system can be very easily overwritten by a confused Windows OS.)
> 
> You can see this in include/layout.h in the ntfs-3g sources.
> 
> This is a pretty broad and general confusion; fdisk will get confused
> and think it is an empty dos partition table, and blkid will as well.
> I suspect the right answer here is if the oem_id is "NTFS ", we should
> not consider it a dos partition table at all, even if there is an "end
> of boot sector" magic value of 0xaa55 at the end of the sector.

 Well, our MBR detection is more sophisticated check for 0xaa55 magic
 ;-) but NTFS is not in the game now. I'll fix it. We need extra check
 for NTFS (as we already use for some FATs or GPT+PMBR).

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

  reply	other threads:[~2019-07-02 19:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-02 10:43 blkid identifying whole disk ntfs as both ntfs and msdos partition table Mike Fleetwood
2019-07-02 18:14 ` Theodore Ts'o
2019-07-02 19:06   ` Karel Zak [this message]
2019-07-17 11:16 ` Karel Zak
2019-07-18 20:10   ` Mike Fleetwood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190702190644.57acag2rfaclu5e7@ws.net.home \
    --to=kzak@redhat.com \
    --cc=mike.fleetwood@googlemail.com \
    --cc=tytso@mit.edu \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).