0

We created 6 logical volumes in a volume group.

Configuration looks like:
two disk each 250g
1st disk we use 21gb for other.(Not lvm partitioned)
Remaining 229g in 1st disk and 250g in 2nd disk will participated in LVM partitioning

The remaining 229g(disk1)+250g(disk2) is configured as a single pv. That whole pv is configured as single vg. In vg we split as 6 lvs

Among six, 2 lv are as raw disk partition (no filesystem). We are writing some data in 2 raw lvs (cache data)

We are doing vgremove (which removed all lvs and volume group from physical volume) at one scenario and

Later creating pv, vg and all 6 lvs.

Find that data in one of the raw logical volume partition exist. Seems data didn't wipe out.

Question: Will vgremove (which removed all lvs and volume group from physical volume) wipeout data which is in raw partition. How data is persist.

1
  • all LVM operations have nothing to do with the data inside any form of containers. LVM operations, like, vgremove, lvcreate and so on, change the information on volume headers, telling the system how to read from and write to those volumes. Unless you delete the data with some other method, data will be there, until it gets written over.
    – MelBurslan
    Feb 18, 2016 at 16:07

2 Answers 2

0

No wiping is done by vgremove and that is a good thing because it allows you to bring back the content, e.g. if you run the command on the wrong volume group.

3
  • Thanks.. +1 but i tried to write some data in raw LVM partition using the cmd "dd if=/tmp/sample.txt of=/dev/data/cache obs=512 count=2" and did lvm remove on /dev/data/cache. After I created the lvm partition and tried to read using the cmd "dd if=/dev/data/cache of=/tmp/sample_read.txt obs=512 count=2" which show its null data only. Which means data get wiped out right, when lvm is removed and created again. Feb 23, 2016 at 13:58
  • @senthilvason Just writing the "header" of the partition is not necessarily enough LMV (and modern filesystems) seem to write information at multiple locations just in case something gets accidentally overwritten or is on a sector "gone bad". I tried a simple dd once and it did not work, but I also could not find a vgxxx utility or subcommand that would do the trick like mdadm --zero-superblock does for raid devices.
    – Anthon
    Feb 23, 2016 at 14:17
  • @Anthon..I tried in writting diff sector locations also, but after lvm remove and again creating lvm we couldn't see the data. Feb 23, 2016 at 17:32
0

If /etc/lvm/lvm.conf has the issue_discards setting enabled in the devices section, then (and only then) LVM will issue TRIM/DISCARD commands (TRIM for SATA, DISCARD for anything SCSI-based) for the areas of disk that are being freed by lvremove or vgremove. If the disk supports those commands (most SSDs do; HDDs might or might not), that typically makes the data unrecoverable for all practical purposes as soon as the erase operation has had enough time to complete.

If issue_discards is not enabled, then lvremove or vgremove will only erase the LVM metadata identifying that LV/VG, and wiping the actual data (if needed) will be the responsibility of the system administrator.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.