1

I had an old 1.5 TB NTFS formatted disk I wanted to use in by RHEL 7 box, so I put it in my desktop booted, and proceed to delete the partition table using fdisk. I created a physical volume on it using pvcreate and also created the volume group and a logical volume, I made it span the entire disk. I found the below in my bash history, that might help you understand what was done/ It is vg00-media that I am trying to get back. I haven't made any changes to the disk itself after successfully creating the vg, mounting, and moving 1.3 TB of data onto it. The only thing I've done is shut the PC down, add some disks to different slots and create a vg on one of those, all of this caused the device name to change, the 1.5 tb disk is showing as /dev/sdc.

fdisk -l
smartctl -i /dev/sdb
smartctl -d ata -H /dev/sdb
systemctl status smartd.service 
df -h
smartctl -d ata -t long /dev/sdb
smartctl -d ata -H -selftest /dev/sdb
man smartctl
smartctl -d ata -H /dev/sdb
smartctl -l selftest /dev/sdb
smartctl -i /dev/sdb
shutdown -h now
uptime
df -h
fdisk -l
vi /etc/fstab 
cd /mnt
mkdir backup
mount /mnt/backup
cd /mnt/media/
ls -lth
vi /etc/fstab 
mount /mnt/backup
fdisk /dev/sdb -l
vgcreate vg00 /dev/sdb1
vgs
vgdisplay
man lvcreate
lvcreate -L 1.36T -n media vg00
mkfs.ext4 /dev/vg00/media
mount /mnt/backup

Here's the current fdisk on this device.

[root@rhel7 ~]# fdisk -l /dev/sdc

Disk /dev/sdc: 1500.3 GB, 1500301910016 bytes, 2930277168 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 label type: dos
Disk identifier: 0x310c5374

   Device Boot      Start         End      Blocks   Id  System

The blkid, you can see there is NO UUID - did I not wipe this properly before creating the vg?

[root@rhel7 ~]# blkid
/dev/sda1: LABEL="System Reserved" UUID="562838FE2838DEA5" TYPE="ntfs" 
/dev/sda2: UUID="BAA2D2D9A2D29969" TYPE="ntfs" 
/dev/sda3: UUID="6ee3804d-9e43-4951-b4a2-9f991c2531ea" TYPE="xfs" 
/dev/sda5: UUID="PRkPxA-2msh-cfom-3WsX-n6zB-iqnC-WMQkA5" TYPE="LVM2_member" 
/dev/sdb: UUID="5bXfFr-zoDb-Zr9F-rIpA-OCmi-uKdv-GX70rV" TYPE="LVM2_member" 
/dev/sdd1: UUID="afd04adf-bd90-4c17-ba0c-16c2d3d0a08c" TYPE="xfs" 
/dev/mapper/rhel-root: UUID="b9e6fa72-636b-4d0e-ae4d-c7e1093b7095" TYPE="xfs" 
/dev/mapper/rhel-swap: UUID="5a790017-7fe6-4914-9ed1-e21153f8ad8a" TYPE="swap" 
/dev/mapper/vg01-backup: UUID="9c43efa1-326d-41ca-bd43-b32b859f7185" TYPE="ext4" 
/dev/sdc: PTTYPE="dos" 

I've tried pvscan, vgscan, lvscan. There is a backup in /etc/lvm/backup of the vg00. Attempted to restore using vgcfgrestore but there is no UUID that it matches with as sdc isn't showing one. Should I try creating a new physical volume on it with that UUID and then doing a restore?

[root@rhel7 backup]# cat vg00.bkup 
# Generated by LVM2 version 2.02.105(2)-RHEL7 (2014-03-26): Sun May 24 14:52:42 2015

contents = "Text Format Volume Group"
version = 1

description = "Created *after* executing 'lvextend -L +20M /dev/vg00/media'"

creation_host = "rhel7" # Linux rhel7 3.10.0-123.el7.x86_64 #1 SMP Mon May 5 11:16:57 EDT 2014 x86_64
creation_time = 1432493562      # Sun May 24 14:52:42 2015

vg00 {
        id = "G0HVRL-9OzN-ul6R-PsA8-ASlU-kPLi-ageZSx"
        seqno = 4
        format = "lvm2" # informational
        status = ["RESIZEABLE", "READ", "WRITE"]
        flags = []
        extent_size = 8192              # 4 Megabytes
        max_lv = 0
        max_pv = 0
        metadata_copies = 0

        physical_volumes {

                pv0 {
                        id = "l601fJ-ICYy-Gq3H-dADR-KSEV-LBic-M2FMli"
                        device = "/dev/sdb1"    # Hint only

                        status = ["ALLOCATABLE"]
                        flags = []
                        dev_size = 2930272256   # 1.36451 Terabytes
                        pe_start = 2048
                        pe_count = 357699       # 1.36451 Terabytes
                }
        }

        logical_volumes {

                media {
                        id = "e9nBh0-Tqwh-50RC-UETh-fzVN-ZoVc-Mb2JEK"
                        status = ["READ", "WRITE", "VISIBLE"]
                        flags = []
                        creation_host = "rhel7"
                        creation_time = 1432489902      # 2015-05-24 13:51:42 -0400
                    segment_count = 1

                    segment1 {
                            start_extent = 0
                            extent_count = 357699   # 1.36451 Terabytes

                            type = "striped"
                            stripe_count = 1        # linear

                            stripes = [
                                    "pv0", 0
                            ]
                    }
            }
    }

}

  • Partitions don't just disappear on their own.. you might try recreating the partition with fdisk and see if its contents are still intact ( the pv will show up in pvs and the lv should automatically activate ). Also if you just created one lv using the whole ( and only ) disk in the vg, it begs the question why did you use lvm in the first place? – psusi Jun 10 '15 at 23:38
  • That's a good question, I forgot to explain that reasoning. I am wanting to extend the lv over two disks which is why I used 1 lv for the whole disk. So after I get this disk back up, I am planning to extend the lv with another 2 TB disk to give me 3.5 TB on the lv. – Daniel Jun 10 '15 at 23:47
  • Here's a second disk I have created a vg on. Disk /dev/sdb: 320.1 GB, 320072933376 bytes, 625142448 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 I don't see any partition information but at the end of the fdisk output I can still see the vg information on it Disk /dev/mapper/vg01-backup: 320.0 GB, 319975063552 bytes, 624951296 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 – Daniel Jun 10 '15 at 23:50
  • Would something like this be used to restore? pvcreate --uuid "l601fJ-ICYy-Gq3H-dADR-KSEV-LBic-M2FMli" --restorefile /etc/lvm/backup/vg00 /dev/sdc Or should I be doing it from fdisk? – Daniel Jun 10 '15 at 23:51
  • You shouldn't need to restore anything for lvm... what has gone wrong is that you created the vg with a partition on the disk, and that partition is no longer there. Hopefully the lvm is all still there and you just need to bring back the missing partition. – psusi Jun 11 '15 at 0:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.