使用GParted增长失败后恢复LVM分区

时间:2018-01-12 17:56:28

标签: partitioning recovery lvm

我有一个LVM分区,其上有一个vg和一个lv。我想增长它(向左增长所以可能不得不移动数据)。我决定和GParted Live一起去。

在调整大小期间,我收到一条消息,说明kernel won't recognize /dev/sda2. you need to reboot的内容。重新启动GParted后,无法识别分区类型并检查lsblk显示该分区已不存在。

[root@antek-pc /]# lsblk                                                                                                                                                                                                               
NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT                                                                                                                                                                                         
sda               8:0    0 232.9G  0 disk                                                                                                                                                                                                    
├─sda1            8:1    0   108G  0 part                                                                                                                                                                                                    
│ ├─fedora-root 253:0    0    40G  0 lvm  /                                                                                                                                                                                                  
│ ├─fedora-swap 253:1    0     8G  0 lvm  [SWAP]                                                                                                                                                                                             
│ └─fedora-home 253:2    0    40G  0 lvm  /home                                                                                                                                                                                              
└─sda2            8:2    0 124.9G  0 part         

The lv partition under sda2 is missing

我已经尝试过做的事情:

  • 使用/etc/lvm/archivevgcfgrestore恢复文件。以下是您可以从中提取一些数据的文件:

    BEFORE RESIZE
    
    vm {
            id = "gF1hzf-2R45-pgef-TbTj-sRAd-Wj2A-rpPjTn"
            seqno = 3
            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 = "Fdzx3j-t3Dk-26SW-cf29-118Q-W95b-4hL8pN"                                                                                                                                                                        
                            device = "/dev/sda4"    # Hint only                                                                                                                                                                                  
    
                            status = ["ALLOCATABLE"]                                                                                                                                                                                             
                            flags = []                                                                                                                                                                                                           
                            dev_size = 104187904    # 49.6807 Gigabytes                                                                                                                                                                          
                            pe_start = 2048                                                                                                                                                                                                      
                            pe_count = 12718        # 49.6797 Gigabytes                                                                                                                                                                          
                    }                                                                                                                                                                                                                            
            }                                                                                                                                                                                                                                    
    
            logical_volumes {                                                                                                                                                                                                                    
    
                    win10 {                                                                                                                                                                                                                      
                            id = "xtHhhx-SKQV-MWdx-0saD-N99f-gvtp-DVoyjA"                                                                                                                                                                        
                            status = ["READ", "WRITE", "VISIBLE"]                                                                                                                                                                                
                            flags = []                                                                                                                                                                                                           
                            creation_time = 1515700031      # 2018-01-11 19:47:11 +0000                                                                                                                                                          
                            creation_host = "debian"                                                                                                                                                                                             
                            segment_count = 1                                                                                                                                                                                                    
    
                            segment1 {                                                                                                                                                                                                           
                                    start_extent = 0
                                    extent_count = 7680     # 30 Gigabytes
    
                                    type = "striped"
                                    stripe_count = 1        # linear
    
                                    stripes = [
                                            "pv0", 0
                                    ]
                            }
                    }
            }
    
    }
    
    AFTER RESIZE
    
    vm {
            id = "ITbhDj-pcla-lcTd-WGwC-Xs9H-CxTd-OzArde"
            seqno = 0
            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 = "I2iB5k-lMdO-SB22-UIr2-vTmy-c0IA-S7OdOV"
                            device = "/dev/sda2"    # Hint only
    
                            status = ["ALLOCATABLE"]
                            flags = []
                            dev_size = 261902336    # 124.885 Gigabytes
                            pe_start = 2048
                            pe_count = 31970        # 124.883 Gigabytes
                    }
            }
    
    
    }
    
  • 使用vm-win10pcvreatevgcreate

  • 重新创建相同的设置(lvcreate

我认为问题可能是由GParted仅调整分区大小而不是移动数据引起的,但我不知道如何检查或修复它。

1 个答案:

答案 0 :(得分:0)

假设您的猜测正确,分区已经增长且LVM没有移动和增长,那么您可以考虑使用TestDisk扫描磁盘表面以建议并应用对分区边界的更改。

请注意,GParted允许保存gparted_details.htm日志文件(并在发生错误时提示保存)。如果您保存了此文件,则该文件将包含恢复原始分区边界所需的所有特定详细信息。