LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-03-2018, 05:39 AM   #1
ggb
LQ Newbie
 
Registered: Jun 2016
Posts: 4

Rep: Reputation: Disabled
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?
 
Old 10-03-2018, 05:50 AM   #2
lougavulin
Member
 
Registered: Jul 2018
Distribution: Slackware,x86_64,current
Posts: 279

Rep: Reputation: 100Reputation: 100
Do you want to remove all lv ?
Is / a lv too ?
Do you have free space on the physical disk aside lvm ?
 
1 members found this post helpful.
Old 10-03-2018, 06:55 AM   #3
ggb
LQ Newbie
 
Registered: Jun 2016
Posts: 4

Original Poster
Rep: Reputation: Disabled
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
 
Old 10-03-2018, 07:41 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,145

Rep: Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124
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.

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 ...
 
1 members found this post helpful.
Old 10-03-2018, 07:46 AM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,760

Rep: Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931
Post the output of the command

lsblk

That will show us how your system is partitioned.
 
1 members found this post helpful.
Old 10-03-2018, 08:39 AM   #6
ggb
LQ Newbie
 
Registered: Jun 2016
Posts: 4

Original Poster
Rep: Reputation: Disabled
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
 
Old 10-03-2018, 09:45 AM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,760

Rep: Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931
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.
 
1 members found this post helpful.
Old 10-03-2018, 10:40 AM   #8
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,783

Rep: Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214
Quote:
Originally Posted by michaelk View Post
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.

Last edited by rknichols; 10-03-2018 at 10:51 AM. Reason: Add "Note that ..."
 
  


Reply

Tags
lvm



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] delete logical volume (lvm) Art McClure Slackware 6 04-01-2012 07:04 PM
Need help to Extend a Logical Volume on Centos 6.2 baldur2630 Linux - Server 2 03-28-2012 05:05 AM
Guest OS installation failed on a logical volume in CentOS 5.1 64bit! jimmyjiang Red Hat 1 04-11-2008 03:35 PM
How to move a logical volume to another vg Doomhammer AIX 1 08-15-2007 03:23 PM
How do I move /var to a logical volume? bret Linux - General 5 02-03-2006 11:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration