4

I don't want to lose any data, so I'm asking if the solution Novell offers is safe to try. If not, are there safe alternatives?

Step-by-tedious-step:

  1. I have two volume groups: main and Rand; Rand is what I boot from while main is an older group.
  2. main/home stopped mounting due to a possible bad superblock. (this error)
  3. I found this Novell link suggesting vgcfgrestore yesterday, so I tried it. No bueno.
  4. I then ran fsck.jfs on /dev/main/home, which allowed it to mount. Success!
  5. This morning, I see errors. df -h shows /dev/mapper/Rand-root has 0 bytes free. Deleting a debian .iso--and more-- fails to change that. (20+ gigs were free yesterday.)
  6. vgscan, pvscan--a lot of utilities fail to work due to a "disk full" error.
  7. I reboot. df -h still reports 0 bytes free, but vgscan and pvscan work now.
  8. Something one of those utilities returned led me to try vgcfgrestore Rand. No change in df -h and now main/home (mounted at /mnt/10.10/) starts spewing I/O errors.
  9. Reboot. A BIOS/SMART error on a disk along with a pvscan error saying can't find device with uuid="uZ1fiS-5Wo4-VNzC-gzs0-ekVz-Bepn-1MZe82", which blkid identifies as /dev/sdb5.
  10. fdisk -l shows:

    Disk /dev/sdb: 120.0 GB, 120034123776 bytes
    255 heads, 63 sectors/track, 14593 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00039f8a
    
    Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1   *           1          32      248832   83  Linux
    Partition 1 does not end on cylinder boundary.
    /dev/sdb2              32       14594   116969473    5  Extended
    /dev/sdb5              32       14594   116969472   8e  Linux LVM
    Note: sector size is 4096 (not 512)
    
  11. The Novell link says my problem fits Symptom 2 and provides a solution, but says nothing about fdisk reporting a partition error. (Which may be causing the SMART error.)

The Novell solution says to first identify the device, then run pvcreate with the UUID and device as parameters, then vgcfgrestore, vgscan, vgchange -ay, and fsck.

If I try this, is there a chance pvcreate will damage anything?

Also, for the pvcreate command, should I use /dev/sdb or /dev/sdb5 as the device?

Output:

~ » sudo vgscan                                                                                                                                                                                                                                                                                                   steven@Rand
[sudo] password for steven: 
  Reading all physical volumes.  This may take a while...
  Found volume group "Rand" using metadata type lvm2
  Couldn't find device with uuid uZ1fiS-5Wo4-VNzC-gzs0-ekVz-Bepn-1MZe82.
  Found volume group "main" using metadata type lvm2
------------------------------------------------------------
~ » sudo pvscan                                                                                                                                                                                                                                                                                                   steven@Rand
  Couldn't find device with uuid uZ1fiS-5Wo4-VNzC-gzs0-ekVz-Bepn-1MZe82.
  PV /dev/sdb5        VG Rand   lvm2 [111.55 GiB / 0    free]
  PV unknown device   VG main   lvm2 [1.36 TiB / 0    free]
  PV /dev/sda1        VG main   lvm2 [465.76 GiB / 461.76 GiB free]
  Total: 3 [1.93 TiB] / in use: 3 [1.93 TiB] / in no VG: 0 [0   ]
------------------------------------------------------------
~ » blkid                                                                                                                                                                                                                                                                                                         steven@Rand
/dev/sdb1: UUID="ba9a3955-0b9c-4660-9852-0f9f405d2f8e" SEC_TYPE="ext2" TYPE="ext3" 
/dev/sdb5: UUID="uZ1fiS-5Wo4-VNzC-gzs0-ekVz-Bepn-1MZe82" TYPE="LVM2_member" 
/dev/sde1: LABEL="My Book" UUID="A2CA0AEBCA0ABC13" TYPE="ntfs" 
/dev/sdf1: UUID="5F8C6ED4773C3763" TYPE="ntfs" 
------------------------------------------------------------

~ » sudo lvs

  Couldn't find device with uuid uZ1fiS-5Wo4-VNzC-gzs0-ekVz-Bepn-1MZe82.
  LV     VG   Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  root   Rand -wi-ao 106.98g                                      
  swap_1 Rand -wi-ao   4.56g                                      
  home   main -wi---   1.35t                                      
  root   main -wi---   2.00g                                      
  swap   main -wi---   4.00g                                      
  tmp    main -wi--- 512.00m                                      
  usr    main -wi---   6.00g                                      
  var    main -wi---   2.00g                                      
------------------------------------------------------------
~ » sudo lvscan
  ACTIVE            '/dev/Rand/root' [106.98 GiB] inherit
  ACTIVE            '/dev/Rand/swap_1' [4.56 GiB] inherit
  Couldn't find device with uuid uZ1fiS-5Wo4-VNzC-gzs0-ekVz-Bepn-1MZe82.
  inactive          '/dev/main/swap' [4.00 GiB] inherit
  inactive          '/dev/main/root' [2.00 GiB] inherit
  inactive          '/dev/main/usr' [6.00 GiB] inherit
  inactive          '/dev/main/var' [2.00 GiB] inherit
  inactive          '/dev/main/tmp' [512.00 MiB] inherit
  inactive          '/dev/main/home' [1.35 TiB] inherit
------------------------------------------------------------
~ » sudo pvs
  Couldn't find device with uuid uZ1fiS-5Wo4-VNzC-gzs0-ekVz-Bepn-1MZe82.
  PV             VG   Fmt  Attr PSize   PFree  
  /dev/sda1      main lvm2 a-   465.76g 461.76g
  /dev/sdb5      Rand lvm2 a-   111.55g      0 
  unknown device main lvm2 a-     1.36t      0 
------------------------------------------------------------
~ » blkid
/dev/sdb1: UUID="ba9a3955-0b9c-4660-9852-0f9f405d2f8e" SEC_TYPE="ext2" TYPE="ext3" 
/dev/sdb5: UUID="uZ1fiS-5Wo4-VNzC-gzs0-ekVz-Bepn-1MZe82" TYPE="LVM2_member" 
/dev/sde1: LABEL="My Book" UUID="A2CA0AEBCA0ABC13" TYPE="ntfs" 
/dev/sdf1: UUID="5F8C6ED4773C3763" TYPE="ntfs" 
------------------------------------------------------------
~ » sudo vgs
  Couldn't find device with uuid uZ1fiS-5Wo4-VNzC-gzs0-ekVz-Bepn-1MZe82.
  VG   #PV #LV #SN Attr   VSize   VFree  
  Rand   1   2   0 wz--n- 111.55g      0 
  main   2   6   0 wz-pn-   1.82t 461.76g
------------------------------------------------------------
~ » sudo vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "Rand" using metadata type lvm2
  Couldn't find device with uuid uZ1fiS-5Wo4-VNzC-gzs0-ekVz-Bepn-1MZe82.
  Found volume group "main" using metadata type lvm2
------------------------------------------------------------
~ » sudo pvscan
  Couldn't find device with uuid uZ1fiS-5Wo4-VNzC-gzs0-ekVz-Bepn-1MZe82.
  PV /dev/sdb5        VG Rand   lvm2 [111.55 GiB / 0    free]
  PV unknown device   VG main   lvm2 [1.36 TiB / 0    free]
  PV /dev/sda1        VG main   lvm2 [465.76 GiB / 461.76 GiB free]
  Total: 3 [1.93 TiB] / in use: 3 [1.93 TiB] / in no VG: 0 [0   ]
------------------------------------------------------------
9
  • 2
    If you get SMART errors then you should first get a new disk and make a 1:1 copy with dd. Mar 17, 2014 at 0:51
  • I didn't follow everything, but pvcreate will definitely overwrite some data on the partition that you pass as an argument. Mar 17, 2014 at 1:17
  • Both pvcreate and vcfgrestore are destructive operations you should not bandy about without really knowing what you are doing.
    – psusi
    Mar 17, 2014 at 3:58
  • @Mauke: backing up to external drive now. Mar 17, 2014 at 10:03
  • @psusi agreed. I have backups of the Rand and main .vg files from March 6 in /etc/lvm/archive. Would those be helpful? Mar 17, 2014 at 10:03

2 Answers 2

4

I know this is an old post but I had a similar but different issue. My issue was that I had a HDD with data and accidentally used "pvcreate" on it and realized that I could no longer access data on the disk (ooops).

I tried a bunch of things and after a couple nights of research I stopped thinking about undoing my mistake and started thinking about recovering my data. I was able to recover the data using TestDisk.

I downloaded by using:

sudo apt-get install testdisk

I used the instructions here as a guide: http://itknowledgeexchange.techtarget.com/linux-lotus-domino/recovering-files-from-an-lvm-or-ext3-partition-with-testdisk/

1
  • testdisk and its supplementary tool (though the name fails to come to memory at this time it is to recover media files although if memory serves me correctly it won't have the proper names of the files) are very useful. Just a reminder to everyone that if you are restoring anything write to another disk (and if you can make an exact copy of the disk you're trying to recover - obviously to another disk entirely and try and recover from that. This means don't write anything to the disk rather than just restoring files).
    – Pryftan
    Dec 11, 2018 at 16:30
2

pvcreate writes PV metadata onto the device/partition, I think most would call that "destructive" however, since it's part of the LVM planning and layout it's also "constructive". pvcreate could be destructive to data areas if any of the following parameters were changed to increase the metadata size or location.

Depending on the command line options passed to pvcreate, one can
write multiple copies of the metadata via --[pv]metadatacopies
change the metadata size via --metadatasize
change the data alignment via --dataalignment
shift the start of the data area an additional alignment_offset via --dataalignmentoffset
recreate a previous PV by specifying the UUID --uuid

Also from the pvcreate man page.
To see the location of the first Physical Extent of an existing Physical Volume use pvs -o +pe_start

Typically, the metadata is written in the first few blocks of the device, up to the first usable PE, shown by pvs -o +pe_start and can be partially viewed by the following cmd.

dd if=/dev/sdb5 bs=4096 count=4 |less

Using less instead of od because much of the metadata is clear text and less does a good job of handling both binary and text data.

Personally, I always set metadata copies to be more than one.

4
  • Thank you, @bdowning; I appreciate the knowledge. The dd command shows me six versions of what appears to be the volume group definition, each with a successive seqno. I will post another question on what I was trying to ask in the comments. Mar 17, 2014 at 18:15
  • pvcreate initializes the PV; the following volume group and logical volume create,modify commands also write metadata to PVs.
    – bsd
    Mar 17, 2014 at 20:20
  • It turns out that it's my 1.5tb drive, which is the bulk of main, that's causing the SMART error. I tried dding from it, but only got 900mb. :/ I'm going to try to get as much off of it as I can. (Some things would be nice to retrieve, but only a few are crucial.) Mar 17, 2014 at 20:27
  • I don't get the comment about destructive and also constructive. "destructive" is typically taken to mean. Will it destroy the existing data. And the answer appears to be "yes, it will destroy the partition table rendering the data inaccessible". Which I consider destructive. So the answer is yes. The longer answer might be, "A data recovery tool may be able to get the data (sans filename?) back."
    – jorfus
    Sep 7 at 21:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .