[opensuse] Is anyone having issues with fdisk making partitions bigger than the physical drive?

Details: from Leap 42.2 - Using a Sata-USB bridge Insert a brand new 1TB drive - no partition table - Use fdisk to partition the drive, accept default parameters for partition 1 and let it fill 99.9% of the drive - write out the partition table Use fdisk to see if the partition table is okay:
sudo fdisk -l /dev/sda Disk /dev/sda: 931.5 GiB, 1000204883968 bytes, 1953525164 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x095da008
Device Boot Start End Sectors Size Id Type /dev/sda1 2048 1953525167 1953523120 931.5G 83 Linux ======================================================== Looks normal to me. But look at the total sector count for the drive and the end sector of the partition. 1953525167 > 1953525164, so the partition extends past the end of the physical drive? That seems to be the root cause of a couple filesystems becoming non-mountable for me. === drive details sudo hdparm -I /dev/sda /dev/sda: ATA device, with non-removable media Model Number: TOSHIBA HDWD110 Serial Number: 17BS7HGFS Firmware Revision: MS2OA8J0 Transport: Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0; Revision: ATA8 -AST T13 Project D1697 Revision 0b Standards: Used: unknown (minor revision code 0x0029) Supported: 8 7 6 5 Likely used: 8 Configuration: Logical max current cylinders 16383 16383 heads 16 16 sectors/track 63 63 -- CHS current addressable sectors: 16514064 LBA user addressable sectors: 268435455 LBA48 user addressable sectors: 1953525168 Logical Sector size: 512 bytes Physical Sector size: 4096 bytes Logical Sector-0 offset: 0 bytes device size with M = 1024*1024: 953869 MBytes device size with M = 1000*1000: 1000204 MBytes (1000 GB) cache/buffer size = unknown Form Factor: 3.5 inch Nominal Media Rotation Rate: 7200 Capabilities: LBA, IORDY(can be disabled) Queue depth: 32 Standby timer values: spec'd by Standard, no device specific minimum R/W multiple sector transfer: Max = 16 Current = 0 Advanced power management level: disabled DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6 Cycle time: min=120ns recommended=120ns PIO: pio0 pio1 pio2 pio3 pio4 Cycle time: no flow control=120ns IORDY flow control=120ns Commands/features: Enabled Supported: * SMART feature set Security Mode feature set * Power Management feature set * Write cache * Look-ahead * Host Protected Area feature set * WRITE_BUFFER command * READ_BUFFER command * NOP cmd * DOWNLOAD_MICROCODE Advanced Power Management feature set Power-Up In Standby feature set * SET_FEATURES required to spinup after power up SET_MAX security extension * 48-bit Address feature set * Device Configuration Overlay feature set * Mandatory FLUSH_CACHE * FLUSH_CACHE_EXT * SMART error logging * SMART self-test Media Card Pass-Through * General Purpose Logging feature set * WRITE_{DMA|MULTIPLE}_FUA_EXT * 64-bit World wide name * URG for READ_STREAM[_DMA]_EXT * URG for WRITE_STREAM[_DMA]_EXT * WRITE_UNCORRECTABLE_EXT command * {READ,WRITE}_DMA_EXT_GPL commands * Segmented DOWNLOAD_MICROCODE * unknown 119[7] * Gen1 signaling speed (1.5Gb/s) * Gen2 signaling speed (3.0Gb/s) * Gen3 signaling speed (6.0Gb/s) * Native Command Queueing (NCQ) * Host-initiated interface power management * Phy event counters * NCQ priority information Non-Zero buffer offsets in DMA Setup FIS DMA Setup Auto-Activate optimization Device-initiated interface power management In-order data delivery * Software settings preservation * SMART Command Transport (SCT) feature set * SCT Write Same (AC2) * SCT Error Recovery Control (AC3) * SCT Features Control (AC4) * SCT Data Tables (AC5) Security: Master password revision code = 65534 supported not enabled not locked not frozen not expired: security count not supported: enhanced erase 160min for SECURITY ERASE UNIT. Logical Unit WWN Device Identifier: 5000039fedd8a830 NAA : 5 IEEE OUI : 000039 Unique ID : fedd8a830 Checksum: correct Thanks Greg -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org

15.05.2017 18:45, Greg Freemyer пишет:
Details:
from Leap 42.2
- Using a Sata-USB bridge Insert a brand new 1TB drive - no partition table - Use fdisk to partition the drive, accept default parameters for partition 1 and let it fill 99.9% of the drive - write out the partition table
Use fdisk to see if the partition table is okay:
sudo fdisk -l /dev/sda Disk /dev/sda: 931.5 GiB, 1000204883968 bytes, 1953525164 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x095da008
Device Boot Start End Sectors Size Id Type /dev/sda1 2048 1953525167 1953523120 931.5G 83 Linux
No, I cannot reproduce it in VM using exactly the same size. Can you? Wipe partition table (wipefs -a /dev/sda) and try again. Make sure to verify no partition exists (and also that kernel forgot about it). -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org

On Mon, May 15, 2017 at 12:01 PM, Andrei Borzenkov <arvidjaar@gmail.com> wrote:
15.05.2017 18:45, Greg Freemyer пишет:
Details:
from Leap 42.2
- Using a Sata-USB bridge Insert a brand new 1TB drive - no partition table - Use fdisk to partition the drive, accept default parameters for partition 1 and let it fill 99.9% of the drive - write out the partition table
Use fdisk to see if the partition table is okay:
sudo fdisk -l /dev/sda Disk /dev/sda: 931.5 GiB, 1000204883968 bytes, 1953525164 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x095da008
Device Boot Start End Sectors Size Id Type /dev/sda1 2048 1953525167 1953523120 931.5G 83 Linux
No, I cannot reproduce it in VM using exactly the same size. Can you? Wipe partition table (wipefs -a /dev/sda) and try again. Make sure to verify no partition exists (and also that kernel forgot about it).
Unfortunately, I now have (backed up) data on the drive. I'm going use a data recovery tool to pull off a copy of all the data, then I can wipe it / experiment. I don't have another identical model drive, but I tried to recreate the problem with an alternate model Toshiba 1TB and that drive / fdisk worked as expected. I went ahead and opened a bugzilla: https://bugzilla.opensuse.org/show_bug.cgi?id=1039144 Greg -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org

On Mon, May 15, 2017 at 12:01 PM, Andrei Borzenkov <arvidjaar@gmail.com> wrote:
15.05.2017 18:45, Greg Freemyer пишет:
Details:
from Leap 42.2
- Using a Sata-USB bridge Insert a brand new 1TB drive - no partition table - Use fdisk to partition the drive, accept default parameters for partition 1 and let it fill 99.9% of the drive - write out the partition table
Use fdisk to see if the partition table is okay:
sudo fdisk -l /dev/sda Disk /dev/sda: 931.5 GiB, 1000204883968 bytes, 1953525164 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x095da008
Device Boot Start End Sectors Size Id Type /dev/sda1 2048 1953525167 1953523120 931.5G 83 Linux
No, I cannot reproduce it in VM using exactly the same size. Can you? Wipe partition table (wipefs -a /dev/sda) and try again. Make sure to verify no partition exists (and also that kernel forgot about it).
Andrei, I tried hard to repeat the same process as before, but the problem did not reproduce. === my effort (drive is /dev/sdc this time. I routinely add/remove USB drives from the Leap 42.2 box in question)
wipefs -a /dev/sdc /dev/sdc: 2 bytes were erased at offset 0x000001fe (dos): 55 aa /dev/sdc: calling ioctl to re-read partition table: Success
fdisk -l /dev/sdc Disk /dev/sdc: 931.5 GiB, 1000204883968 bytes, 1953525164 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes
Use fdisk to create a default primary partition. Result:
fdisk -l /dev/sdc Disk /dev/sdc: 931.5 GiB, 1000204883968 bytes, 1953525164 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x817739ab
Device Boot Start End Sectors Size Id Type /dev/sdc1 2048 1953525163 1953523116 931.5G 83 Linux (note partition end is correct at this point)
mkfs.ntfs -Q /dev/sdc1 mount /dev/sdc1 /mnt copy some files to it umount /mnt fdisk -l /dev/sdc [verify end sector is correct] Physically disconnect USB port and reconnect fdisk -l /dev/sdc [verify end sector is correct] physically connect drive to a Windows 8.1 machine and note it fails to get a drive letter [likely because of the wrong partition type] Move it back to Leap 42.2 box fdisk -l /dev/sdc [verify end sector is correct] physically connect drive to a Windows 8.1 machine and note it fails to get a drive letter [likely because of the wrong partition type] Move it back to Leap 42.2 box fdisk -l /dev/sdc [verify end sector is correct]
Use dolphin to mount the volume - it worked Greg -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org

Greg Freemyer wrote:
Details:
from Leap 42.2
- Using a Sata-USB bridge Insert a brand new 1TB drive - no partition table - Use fdisk to partition the drive, accept default parameters for partition 1 and let it fill 99.9% of the drive - write out the partition table
Use fdisk to see if the partition table is okay:
sudo fdisk -l /dev/sda Disk /dev/sda: 931.5 GiB, 1000204883968 bytes, 1953525164 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x095da008
Device Boot Start End Sectors Size Id Type /dev/sda1 2048 1953525167 1953523120 931.5G 83 Linux
========================================================
Looks normal to me.
But look at the total sector count for the drive and the end sector of the partition.
1953525167 > 1953525164, so the partition extends past the end of the physical drive?
your hdparm output reports 1953525168 addressable sectors though? Surprisingly it also report physical sector size 4096, which fdisk did not. -- Per Jessen, Zürich (22.1°C) http://www.dns24.ch/ - your free DNS host, made in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (3)
-
Andrei Borzenkov
-
Greg Freemyer
-
Per Jessen