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?
|
Do you want to remove all lv ?
Is / a lv too ? Do you have free space on the physical disk aside lvm ? |
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
|
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 ... |
Post the output of the command
lsblk That will show us how your system is partitioned. |
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 |
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. |
Quote:
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. |