LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Move files to delete a logical volume in Centos 7 (https://www.linuxquestions.org/questions/linux-server-73/move-files-to-delete-a-logical-volume-in-centos-7-a-4175639643/)

ggb 10-03-2018 05:39 AM

Move files to delete a logical volume in Centos 7
 
I was assigned a revision server with centos 7 and when I checked it, I have seen that they have created three logical volumes and each volume has directories with files. When checking the requirements, they told me that they had created them by mistake and they do not want the logical volumes. Now they want you to delete all the logical volumes and leave the directories and the content. Is it possible to do it without having to reinstall the operating system again?

lougavulin 10-03-2018 05:50 AM

Do you want to remove all lv ?
Is / a lv too ?
Do you have free space on the physical disk aside lvm ?

ggb 10-03-2018 06:55 AM

Hi, I want to delete all the LMVs and move them to the directories with the files to a USB without destroying the system and then recover the space by uploading the directories but without volumes in the recovered space

syg00 10-03-2018 07:41 AM

Sure you can. Back it all up, delete the lvs, vgs, pvs to recover the space, then recreate the directories with the correct permissions and restore.
Then wait for things to fill up and start planning to use LVM to avoid the space issues in future. :banghead:

Or tell them they obviously should stay out of admin work, and let you do your job. Simply resize the LVM components if space is actually needed for filesystems outside of LVM. Or plan to move all that stuff under LVM for simpler management ...

michaelk 10-03-2018 07:46 AM

Post the output of the command

lsblk

That will show us how your system is partitioned.

ggb 10-03-2018 08:39 AM

Thanks very much, it is.

centos7@lab$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 279.4G 0 disk
|-sda1 8:1 0 200M 0 part /boot/efi
|-sda2 8:2 0 500M 0 part /boot
`-sda3 8:3 0 278.7G 0 part
|-vg_centos7-lv_root (dm-0) 253:0 0 20G 0 lvm /
|-vg_centos7-lv_swap (dm-1) 253:1 0 62.5G 0 lvm [SWAP]
`-vg_centos7-LogVol02 (dm-2) 253:2 0 196.2G 0 lvm /lab
sdb 8:16 0 111.8G 0 disk
`-sdb1 8:17 0 111.8G 0 part /persistentLogs

michaelk 10-03-2018 09:45 AM

There is no method to convert LVM back to normal partitions. As stated you need to backup everything and also right down the UUIDs from the output of the blkid command.

Using a live or rescue mode cd/usb delete the LVM partition and recreate /(root) and swap and /lab partitions using the UUIDs from above. Restore your backup and then I believe you will need to reinstall grub. Depending on the effort it takes to setup the server it might be easier to reinstall without LVM and the restore your backups.

rknichols 10-03-2018 10:40 AM

Quote:

Originally Posted by michaelk (Post 5910611)
There is no method to convert LVM back to normal partitions.

For simple LVs with no special options (no mirroring, thin pool, etc) confined to a single PV and never changed from their initial creation, it's really just a matter of creating partition table entries for the regions where the filesystems are stored. But this involves some low-level fiddling and falls in the category of, "If you have to ask, you really shouldn't be attempting it."

Note that your boot files and /etc/fstab may contain references to the current VGs and LVs, and you will have to fix those regardless of how you go about the disk reconfiguration.


All times are GMT -5. The time now is 05:24 PM.