linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] how to convert a disk containing a snapshot to a snapshot lv?
@ 2021-12-19 16:43 Tomas Dalebjörk
  2021-12-20 14:51 ` Phillip Susi
  2021-12-21 13:46 ` Zdenek Kabelac
  0 siblings, 2 replies; 11+ messages in thread
From: Tomas Dalebjörk @ 2021-12-19 16:43 UTC (permalink / raw)
  To: LVM general discussion and development


[-- Attachment #1.1: Type: text/plain, Size: 2318 bytes --]

Hi,

I am trying to understand how to convert a disk containing snapshot data.
This is how I tested this:
1. locate the snapshot testlv.211218.232255
root@debian10:/dev/mapper# lvs
  LV                   VG          Attr       LSize   Pool Origin Data%
 Meta%  Move Log Cpy%Sync Convert
  home                 debian10-vg -wi-ao----   1.00g
  root                 debian10-vg -wi-ao----  <3.81g
  swap_1               debian10-vg -wi-ao---- 976.00m
  testlv               debian10-vg owi-aos--- 100.00m
  testlv.211218.232255 debian10-vg swi-a-s--- 104.00m      testlv 1.44
root@debian10:/dev/mapper#

2. copy the lv - cow data to a file
# dd if=/dev/mapper/debian10--vg-testlv.211218.232255-cow of=/tmp/out
bs=1024

3. Setup a loopback disk for the file
# losetup -fP /tmp/out

4. Verify that disk exists
root@debian10:/dev/mapper# losetup -a
/dev/loop0: [65025]:39274 (/tmp/out)
root@debian10:/dev/mapper#

5. Try converting the disk using lvconvert command
# lvconvert -Zn -s debian10-vg/testlv /tmp/out
  "/tmp/out": Invalid path for Logical Volume.

6. Trying creating a softlink in /dev/mapper
# ln -s /tmp/out debian10--vg-loopback

7. verify link
root@debian10:/dev/mapper# ls -la
total 0
drwxr-xr-x  2 root root     240 Dec 19 17:40 .
drwxr-xr-x 18 root root    3820 Dec 19 17:22 ..
crw-------  1 root root 10, 236 Dec 10 19:10 control
lrwxrwxrwx  1 root root       7 Dec 10 19:10 debian10--vg-home -> ../dm-5
lrwxrwxrwx  1 root root       8 Dec 19 17:40 debian10--vg-loopback ->
/tmp/out
lrwxrwxrwx  1 root root       7 Dec 13 22:20 debian10--vg-root -> ../dm-1
lrwxrwxrwx  1 root root       7 Dec 10 19:10 debian10--vg-swap_1 -> ../dm-4
lrwxrwxrwx  1 root root       7 Dec 18 23:23 debian10--vg-testlv -> ../dm-0
lrwxrwxrwx  1 root root       7 Dec 18 23:23
debian10--vg-testlv.211218.232255 -> ../dm-6
lrwxrwxrwx  1 root root       7 Dec 18 23:23
debian10--vg-testlv.211218.232255-cow -> ../dm-3
lrwxrwxrwx  1 root root       7 Dec 18 23:23 debian10--vg-testlv-real ->
../dm-2
root@debian10:/dev/mapper#

8. retrying lvconvert command
root@debian10:/dev/mapper# lvconvert -Zn -s debian10-vg/testlv
/dev/mapper/debian10--vg-loopback
  Failed to find logical volume "debian10-vg/loopback"
root@debian10:/dev/mapper#

Are there more things to be considered, such as recreating pv data on disk?

Regards Tomas

[-- Attachment #1.2: Type: text/html, Size: 3814 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-12-29 14:32 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-19 16:43 [linux-lvm] how to convert a disk containing a snapshot to a snapshot lv? Tomas Dalebjörk
2021-12-20 14:51 ` Phillip Susi
2021-12-21 13:46 ` Zdenek Kabelac
2021-12-21 14:44   ` Tomas Dalebjörk
2021-12-21 15:30     ` Zdenek Kabelac
2021-12-21 16:12       ` Tomas Dalebjörk
2021-12-22 10:40         ` Zdenek Kabelac
2021-12-28  5:04         ` Stuart D Gathman
2021-12-28  6:40           ` Tomas Dalebjörk
2021-12-29 13:35             ` Stuart D Gathman
2021-12-21 19:23     ` Phillip Susi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).