Linux

如何掛載儲存在從快照建構的 AWS EBS 卷上的 LVM 控制的 ext4 文件系統

  • February 20, 2020

我有一個 ext4 文件系統,它是邏輯卷的一部分,底層儲存是 AWS EBS。我拍攝了 EBS 的快照,然後用它來創建一個新的 EBS 卷並將其附加到 EC2 實例。

由於這是原始卷的二進制副本,它與原始 LV 共享相同的 UUID,所以我嘗試將新設備分區 (/dev/xvdi1) 添加到現有捲組中:

> # pvremove /dev/xvdi1
 Labels on physical volume "/dev/xvdi1" successfully wiped  
> # pvcreate /dev/xvdi1
Physical volume "/dev/xvdi1" successfully created
> 
> # vgextend VGoraarch /dev/xvdi1  
Volume group "VGoraarch" successfully extended
> 
> # lvcreate -l 100%FREE -n LVoraarch_snapshot VGoraarch /dev/xvdi1
> Logical volume "LVoraarch_snapshot" created.

當我嘗試進行安裝時:

> # mount -t ext4 /dev/mapper/VGoraarch-LVoraarch_snapshot /oraarch_snapshot mount: wrong fs type, bad option, bad superblock on
> /dev/mapper/VGoraarch-LVoraarch_snapshot,
>        missing codepage or helper program, or other error
>        In some cases useful info is found in syslog - try
>        dmesg | tail  or so

安裝這個的正確方法是什麼?

編輯:安裝到同一個 EC2 實例

您需要做的就是導入它。例子:

# pvscan
pvscan -- reading all physical volumes (this may take a while...)
pvscan -- inactive PV "/dev/sdb1"  is in EXPORTED VG "design" [996 MB / 996 MB free]
pvscan -- inactive PV "/dev/sdb2"  is in EXPORTED VG "design" [996 MB / 244 MB free]
pvscan -- total: 2 [1.95 GB] / in use: 2 [1.95 GB] / in no VG: 0 [0]

# vgimport design
Volume group "vg" successfully imported

# vgchange -ay design

# mkdir -p /mnt/design/users
# mount /dev/design/users /mnt/design/users

(從http://tldp.org/HOWTO/LVM-HOWTO/recipemovevgtonewsys.html複製)

引用自:https://serverfault.com/questions/1002809