系统相关
首页 > 系统相关> > linux – pvcreate具有破坏性吗?试图恢复lvm2卷组

linux – pvcreate具有破坏性吗?试图恢复lvm2卷组

作者:互联网

我不想丢失任何数据,所以我想问Novell提供的解决方案是否安全可靠.如果没有,有没有安全的选择?

一步乏味步:

>我有两个卷组:main和Rand; Rand是我引导的,而main是一个较老的组.
>由于可能存在坏的超级块,main / home停止安装. (this error)
>昨天我发现this Novell link建议vgcfgrestore,所以我试了一下.没有bueno.
>然后我在/ dev / main / home上运行了fsck.jfs,允许它挂载.成功!
>今天早上,我看到错误. df -h显示/ dev / mapper / Rand-root有0个字节可用.删除debian .iso – 以及更多 – 无法改变它. (昨天有20场演出.)
> vgscan,pvscan – 由于“磁盘已满”错误,许多实用程序无法工作.
>我重启. df -h仍然报告0字节可用,但vgscan和pvscan现在可以正常工作.
>其中一个实用程序返回导致我尝试vgcfgrestore Rand. df -h没有变化,现在main / home(安装在/mnt/10.10/)开始喷出I / O错误.
>重新启动.磁盘上的BIOS / SMART错误以及pvscan错误说找不到具有uuid =“uZ1fiS-5Wo4-VNzC-gzs0-ekVz-Bepn-1MZe82”的设备,其中blkid标识为/ dev / sdb5.
> fdisk -l显示:

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)

> Novell链接说我的问题适合症状2并提供解决方案,但没有说fdisk报告分区错误. (这可能导致SMART错误.)

Novell解决方案首先确定设备,然后使用UUID和设备作为参数运行pvcreate,然后运行vgcfgrestore,vgscan,vgchange -ay和fsck.

如果我试试这个,pvcreate有可能会损坏任何东西吗?

另外,对于pvcreate命令,我应该使用/ dev / sdb还是/ dev / sdb5作为设备?

输出:

~ » 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   ]
------------------------------------------------------------

解决方法:

pvcreate将PV元数据写入设备/分区,我认为大多数人会称之为“破坏性”,因为它是LVM规划和布局的一部分,它也是“建设性的”.如果更改了以下任何参数以增加元数据大小或位置,则pvcreate可能会破坏数据区域.

根据传递给pvcreate的命令行选项,可以
 通过 – [pv] metadatacopies写出元数据的多个副本
 通过–metadatasize更改元数据大小
 通过–dataalignment更改数据对齐方式
 通过–dataalignmentoffset将数据区域的起点移到另一个alignment_offset
 通过指定UUID –uuid重新创建以前的PV

也来自pvcreate手册页.
要查看现有物理卷的第一个物理范围的位置,请使用pvs -o pe_start

通常,元数据写入设备的前几个块,直到第一个可用的PE,由pvs -o pe_start显示,并且可以通过以下cmd部分查看.

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

使用less而不是od,因为大部分元数据是明文而不是很好地处理二进制和文本数据.

就个人而言,我总是将元数据副本设置为多个.

标签:linux,lvm,data-recovery,jfs
来源: https://codeday.me/bug/20190814/1654123.html