fdisk isn't showing my hard drive as properly formatted (but it is)

14,161

It looks like the partition table on /dev/sda was destroyed. You didn't mention what you did to destroy it, so it's hard to say exactly how you would reconstruct it.

  • You can attempt to use fdisk to recreate the sda1 partition.

    On the assumption that the disk partitions of the three disks were identical, you can recreate the sda1 partition with fdisk /dev/sda1 and the same parameters as on the other two drives. If correct, this should make the volume visible again. (You may need to reboot afterward.)

  • If that fails, you can attempt to use TestDisk to recreate the sda1 partition.

    This will scan the drive and attempt to locate metadata which indicates what was on the disk and where, but it may give false positives. You're kind of on your own here.

Share:
14,161

Related videos on Youtube

n0pe
Author by

n0pe

Updated on September 18, 2022

Comments

  • n0pe
    n0pe over 1 year

    I've got 3 1TB drives which I've set up to use LVM. Here's the output of pvdisplay:

      --- Physical volume ---
      PV Name               /dev/sda1
      VG Name               vgpool
      PV Size               931.51 GiB / not usable 728.00 KiB
      Allocatable           yes (but full)
      PE Size               4.00 MiB
      Total PE              238467
      Free PE               0
      Allocated PE          238467
      PV UUID               22ZgJ3-ep7X-flT6-KD1u-fWr1-Q8u9-2V28Ad
    
      --- Physical volume ---
      PV Name               /dev/sdc1
      VG Name               vgpool
      PV Size               931.51 GiB / not usable 728.00 KiB
      Allocatable           yes (but full)
      PE Size               4.00 MiB
      Total PE              238467
      Free PE               0
      Allocated PE          238467
      PV UUID               3b7vE1-gXPo-Moxm-5F46-vOPb-UpyF-mjo7ad
    
      --- Physical volume ---
      PV Name               /dev/sdb1
      VG Name               vgpool
      PV Size               931.51 GiB / not usable 728.00 KiB
      Allocatable           yes 
      PE Size               4.00 MiB
      Total PE              238467
      Free PE               774
      Allocated PE          237693
      PV UUID               dFWNtb-WbyA-HSVz-urls-G0Y9-x2W0-jwsoTq
    

    Everything looks good right? Now, I run sudo fdisk -l:

    Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
    255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 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
    Disk identifier: 0x00000000
    
    Disk /dev/sda doesn't contain a valid partition table
    
    Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
    81 heads, 63 sectors/track, 382818 cylinders, total 1953525168 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
    Disk identifier: 0x2e962a62
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1            2048  1953525167   976761560   8e  Linux LVM
    
    Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes
    81 heads, 63 sectors/track, 382818 cylinders, total 1953525168 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
    Disk identifier: 0xe95df8a7
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdc1            2048  1953525167   976761560   8e  Linux LVM
    
    Disk /dev/mapper/vgpool-lvstuff: 2997.4 GB, 2997362884608 bytes
    255 heads, 63 sectors/track, 364408 cylinders, total 5854224384 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
    Disk identifier: 0x00000000
    
    Disk /dev/mapper/vgpool-lvstuff doesn't contain a valid partition table
    

    My concern is that fdisk says sda doesn't have a valid partition despite me formatting each drive correctly as LVM (8e). This is my first time playing with LVM so did I do something wrong?


    lshal:

      block.device = '/dev/sda'  (string)
      block.is_volume = false  (bool)
      block.major = 8  (0x8)  (int)
      block.minor = 0  (0x0)  (int)
      block.storage_device = '/org/freedesktop/Hal/devices/storage_serial_WDC_WD10EARS_00Y5B1_WD_WCAV5C337141'  (string)
      info.capabilities = {'storage', 'block'} (string list)
      info.category = 'storage'  (string)
      info.parent = '/org/freedesktop/Hal/devices/pci_8086_3b22_scsi_host_scsi_device_lun0'  (string)
      info.product = 'WDC WD10EARS-00Y'  (string)
      info.udi = '/org/freedesktop/Hal/devices/storage_serial_WDC_WD10EARS_00Y5B1_WD_WCAV5C337141'  (string)
      info.vendor = 'ATA'  (string)
      linux.hotplug_type = 3  (0x3)  (int)
      linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda'  (string)
      storage.automount_enabled_hint = true  (bool)
      storage.bus = 'pci'  (string)
      storage.drive_type = 'disk'  (string)
      storage.firmware_version = '80.00A08'  (string)
      storage.hotpluggable = false  (bool)
      storage.lun = 0  (0x0)  (int)
      storage.media_check_enabled = false  (bool)
      storage.model = 'WDC WD10EARS-00Y'  (string)
      storage.no_partitions_hint = false  (bool)
      storage.originating_device = '/org/freedesktop/Hal/devices/computer'  (string)
      storage.removable = false  (bool)
      storage.removable.media_available = true  (bool)
      storage.removable.media_size = 1000204886016  (0xe8e0db6000)  (uint64)
      storage.requires_eject = false  (bool)
      storage.serial = 'WDC_WD10EARS-00Y5B1_WD-WCAV5C337141'  (string)
      storage.size = 1000204886016  (0xe8e0db6000)  (uint64)
      storage.vendor = 'ATA'  (string)
    
    • jordanm
      jordanm over 11 years
      Have you rebooted or ran partprobe since you formatted /dev/sda?
    • n0pe
      n0pe over 11 years
      @jordanm, no I haven't. But I haven't done it for the other ones either. It's the inconsistency between the drives which is bugging me.
    • eppesuig
      eppesuig over 11 years
      you should check what disklabel you are using. If it is the DOS one, then fdisk is the right tool, otherwise, let's say you created a solaris disklabel, or an amiga, or whatever, then fdisk might not be right tool, even if the kerne use it without problems. Check what dmesg say about your disk when it found it. Or you may check it with lshal and verify the storage.partitioning_scheme
    • n0pe
      n0pe over 11 years
      @eppesuig, I've added the output of lshal for sda but don't see storage.partitioning.scheme. Should I be looking somewhere else?
    • eppesuig
      eppesuig over 11 years
      @MaxMackie do you have the storage.partition_scheme on sdb and sdc?
  • n0pe
    n0pe over 11 years
    I basically just used fdisk to make the partition. sudo fdisk /dev/sda, n p 1 t 8e w. Then I added it as a physical volume etc. So are you saying I can remake the partition with fdisk without losing the data? Or is the data pretty much lost at this point?
  • Amitav Pajni
    Amitav Pajni over 11 years
    As long as the newly created partition matches identically to the other two, then it should come out fine. Unlike DOS fdisk, Linux fdisk doesn't erase anything within the partition.
  • n0pe
    n0pe over 11 years
    When you say matched, you mean just being made the same way. Like the way I mentioned above? I'll give this a try -- thank you very much.
  • n0pe
    n0pe over 11 years
    Awesome! It worked! I always thought creating/recreating partitions with fdisk erased the entire disk. Thanks again.
  • Amitav Pajni
    Amitav Pajni over 9 years
    @MaxMackie Only the MS-DOS version of fdisk does that. Linux fdisk has never erased newly created partitions.