All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Tomas Dalebjörk" <tomas.dalebjork@gmail.com>
To: LVM general discussion and development <linux-lvm@redhat.com>
Subject: [linux-lvm] how to convert a disk containing a snapshot to a snapshot lv?
Date: Sun, 19 Dec 2021 17:43:48 +0100	[thread overview]
Message-ID: <CACrcyf+2uz_ngeVdq48WjSg6ZaarRpVXs8TZwzpQ4hnW7D7xGg@mail.gmail.com> (raw)


[-- 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/

             reply	other threads:[~2021-12-20  6:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-19 16:43 Tomas Dalebjörk [this message]
2021-12-20 14:51 ` [linux-lvm] how to convert a disk containing a snapshot to a snapshot lv? 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACrcyf+2uz_ngeVdq48WjSg6ZaarRpVXs8TZwzpQ4hnW7D7xGg@mail.gmail.com \
    --to=tomas.dalebjork@gmail.com \
    --cc=linux-lvm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.