0

I have a ext4 file system that is part of a Logical Volume and the underlying storage is AWS EBS. I took a snapshot of the EBS and then used that to create a new EBS volume and attached it to theEC2 instance.

Since this is a binary copy of the original volume it shared the same UUID as the original LV, so I tried this to add the new device partition (/dev/xvdi1) into an existing volume group:

> # 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.

When I try to do the mount:

> # 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

What's the correct way to get this mounted?

EDIT: Mounting to the same EC2 instance

Pete
  • 121
  • 6

1 Answers1

1

All you need to do is import it. Example:

# 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

(Copied from http://tldp.org/HOWTO/LVM-HOWTO/recipemovevgtonewsys.html)

Mark Wagner
  • 17,764
  • 2
  • 30
  • 47
  • Looks like I had to fsfreeze the file system first before initiating the snapshot, a step I totally missed. Then I used vgimportclone to create a cloned VG.Then I was able to mount the fs. – Pete Feb 13 '20 at 16:30
  • I see; I misread your question and thought you were mounting it on a different instance in which case vgimportclone isn't needed. – Mark Wagner Feb 14 '20 at 18:06