Hi,

Martin Mokrejs wrote:

 > Hi,
 >    I am configuring a Linux under VirtualBox-5.0.0-rc3 and one of the
 > partition will be NTFS. The disk is raw disk, on host exposed as
 > /dev/sdc, on guest appears as /dev/sda.
 >
 > It seems detection of virtual drive geometry fails or mkntfs is broken.
 > Seems I can provide mkntfs with cyl/head/sect counts but what is the
 > cause?
 >
 > It seems very dangerous to blindly set starting sector to zero and
 > starting zero-ing my drive.

The starting sector of an NTFS partition is only used for booting
Windows, and it is a 32-bit field which cannot hold 5860533134.
There is no problem with a null starting sector if this not a
Windows system partition.

Likewise you cannot encode 5860533134 into C/H/S values (even
manually !), and they are only used for booting Windows.

Both are values to be stored in the boot sector of the NTFS
partition (not the boot sector of the drive).

[...]

 > Command (? for help): p
 > Disk /dev/sdc: 5860533168 sectors, 2.7 TiB
 > Logical sector size: 512 bytes
 > Disk identifier (GUID): 407277B2-867C-4BB2-A6B1-A8E5102D023D
 > Partition table holds up to 128 entries
 > First usable sector is 34, last usable sector is 5860533134
 > Partitions will be aligned on 8-sector boundaries
 > Total free space is 3951 sectors (1.9 MiB)

This is unusual, so far all the 3TB drives I have heard of
have 4K sectors. As a consequence in your case the number
of sectors does not fit into a 32-bit word.

[...]

 > linux_host# mkntfs -n /dev/sdc5
 > Running in READ-ONLY mode!
 > The partition start sector specified for /dev/sdc5 and the
 >  automatically determined value is too large.  It has been set to 0.
 > Cluster size has been automatically set to 4096 bytes.
 > To boot from a device, Windows needs the 'partition start sector',
 >  the 'sectors per track' and the 'number of heads' to be set.
 > Windows will not be able to boot from this device.
 > Initializing device with zeroes: 100% - Done.
 > Creating NTFS volume structures.
 > mkntfs completed successfully. Have a nice day.
 > linux_host#

To find the partition start sector, mkntfs relies on the
ioctl call HDIO_GETGEO, which on a 32-bit system can only
deliver 32-bit values. On a 64-bit CPU you can get bigger
values, but you cannot store 5860533168 into the 32-bit
field defined for storing the partition starting sector
in the NTFS boot sector.

Anyway, storing zero is a reasonable action.

 > Above I show it with "-n" option but initally I ran the command 
without it.
 > so, maybe beginning of my /dev/sdc drive was deleted?

/dev/sdc was not deleted (see below). mkntfs is protected
by system from writing outside the partition it is directed
to format.

 >
 > Expert command (m for help): d
 >
 > First sector: offset = 0, size = 512 bytes.
 > 00000000  eb 63 90 d0 bc 00 7c 8e  c0 8e d8 be 00 7c bf 00
 > 00000010  06 b9 00 02 fc f3 a4 50  68 1c 06 cb fb b9 04 00
[...]
 > 00000180  47 52 55 42 20 00 47 65  6f 6d 00 48 61 72 64 20

This does not look like an NTFS partition, it is a grub boot
sector, "47 52 55 42" (at 180) means "GRUB".

 > PMBR: offset = 0, size = 512 bytes.
 > 00000000  eb 63 90 d0 bc 00 7c 8e  c0 8e d8 be 00 7c bf 00
 > 00000010  06 b9 00 02 fc f3 a4 50  68 1c 06 cb fb b9 04 00
[...]
 > 00000180  47 52 55 42 20 00 47 65  6f 6d 00 48 61 72 64 20

This is the same data.

You should have dumped the beginning of /dev/sdc5 to locate
an NTFS partition with the fields related to the geometry of
the drive left unfilled.

Main question : did you format /dev/sdc5 and is it usable ?

Regards

Jean-Pierre


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
ntfs-3g-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel

Reply via email to