Hi Jean-Pierre, thank you for your quick answer. Comments below.
Jean-Pierre André wrote: > 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. Well, in my case my aim was to use it only for data, so fine with me, but, would you please make the message from mkntfs clearer? Also, could it include the actually obtained value, so 5860533134 in my case? And explain the 32-bit issue? > 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). OK, it wasn't clear this is about relative sector count since the beginning of the NTFS partition. Please make it clear it is about NTFS boot sector value, as you explained further below. Here is what I got actually, and was scared mkntfs just zapped beginning of my /dev/sdc (thought the 0 position was absolute). gentoo64 ~ # mkfs.ntfs /dev/sda5 The partition start sector specified for /dev/sda5 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: 0%^C^X^X^X^C^C^C gentoo64 ~ # gdisk /dev/sda GPT fdisk (gdisk) version 1.0.0 Partition table scan: MBR: protective BSD: not present APM: not present GPT: present Found valid GPT with protective MBR; using GPT. Command (? for help): Command (? for help): Found valid GPT with protective MBR; using GPT. Command (? for help): p Disk /dev/sda: 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) Number Start (sector) End (sector) Size Code Name 1 2048 602111 293.0 MiB EF02 BIOS boot partition 2 602112 1220939 302.2 MiB EF00 EFI System 3 1220940 4290238574 2.0 TiB 8300 rootfs 4 4290240512 4357349375 32.0 GiB 8200 swap 5 4357349376 5860533134 716.8 GiB 0700 ntfs Command (? for help): q > > 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. Hmm, this is Lacie D2 QUADRA 3TB drive, pretty expensive one with eSATA, FireWire, USB3.0. So I should look for a firmware flash? ;-) My oldest 4k drive is WD10TPVT and it also reports 512/512 sector sizes. For example here: http://patchwork.ozlabs.org/patch/153542/ > > 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. OK, here is what I see from within the VirtualBox instance: gentoo64 ~ # smartctl -a /dev/sda smartctl 6.3 2014-07-26 r3976 [x86_64-linux-4.0.4-gentoo-default-pciehp] (local build) Copyright (C) 2002-14, Bruce Allen, Christian Franke, www.smartmontools.org === START OF INFORMATION SECTION === Device Model: VBOX HARDDISK Serial Number: VB7c1f95bd-ad2bd74d Firmware Version: 1.0 User Capacity: 3,000,592,982,016 bytes [3.00 TB] Sector Size: 512 bytes logical/physical Device is: Not in smartctl database [for details use: -P showall] ATA Version is: ATA/ATAPI-6 published, ANSI INCITS 361-2002 Local Time is: Sat May 23 13:32:41 2015 CEST SMART support is: Unavailable - device lacks SMART capability. ... > > 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. Well I just dumped the GPT partition layout which I showed above using "gdisk p" and "fdisk p" commands. Actually, I dumped the MBR cousin, right? ;-) I think in this case only the layout of /dev/sdc5 (or /dev/sda5 from withing VirtualBox) is relevant here. Seems you do not any problems with the partitioning layout, good. ;-) > 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. Aha. How? Via dd with offset=4357349376-1 ? > > Main question : did you format /dev/sdc5 and is it usable ? I did not let it continue, I was so scared to zap my raw drive ... ;-) I will first resolve with you what is in the NTFS boot block .;-) Martin ------------------------------------------------------------------------------ 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 ntfs-3g-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel