LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-09-2024, 11:56 AM   #1
Jason.nix
Member
 
Registered: Feb 2023
Posts: 561

Rep: Reputation: 10
Post Reinstall Linux with LVM partitions


Hello,
When Linux is installed with LVM partitions, if I want to reinstall Linux and need the information of a partition in the new installation, should the partitioning type in the new installation also be LVM?

Thank you.
 
Old 04-09-2024, 12:09 PM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,640

Rep: Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697
You are doing a reinstall. Do you want to preserve one or more current file systems, or do a full reinstall?
A full reinstall gives you the option to reconfigure the storage to your liking and there is no reason to preserve the existing structure.
If you want to preserve a current file system, you need to preserve AT LEAST the current structure as it contains or defines the current file system that you want to preserve.

Actually my better advice would be to back up any file system you want to retain, and verify the backup. Then do that again on different media. This way, with two verified backups, you are assured that you can restore even if a backup device goes south on you. Then do a full install overwriting the old structure with whatever you have planned: then restore the backup so you have access to that data.

Having those backups also protects you against the case that something goes bad during the install and ALL of your storage gets wiped! I have seen devices that have worked perfectly for years suddenly decide that maintenance day was the day to finally fail, and a backup protects you against that kind of thing.

Get the backups first, then you can decide how to proceed from there at your leisure with less pressure.

Last edited by wpeckham; 04-09-2024 at 12:13 PM.
 
1 members found this post helpful.
Old 04-09-2024, 12:24 PM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,663
Blog Entries: 4

Rep: Reputation: 3944Reputation: 3944Reputation: 3944Reputation: 3944Reputation: 3944Reputation: 3944Reputation: 3944Reputation: 3944Reputation: 3944Reputation: 3944Reputation: 3944
Indeed, one of the key advantages of LVM is that you don’t (!!) have to be concerned with the physical (drive and/or partition) arrangement, because “Linux file systems” never see it. They only see a “logical volume,” which lives in an endlessly-expandable “storage pool.” (Which can be re-configured “on the fly.” For instance, if that “failing drive” is generous enough to give you a little warning …)

When setting up your new environment, it can be “physically” configured any way you like.

Last edited by sundialsvcs; 04-09-2024 at 12:27 PM.
 
1 members found this post helpful.
Old 04-09-2024, 01:27 PM   #4
lvm_
Member
 
Registered: Jul 2020
Posts: 933

Rep: Reputation: 337Reputation: 337Reputation: 337Reputation: 337
No, you can mix normal and LVM devices any way you want. Also, LVM volume is not a partition but more akin to loop device, but that's beside the point.
 
1 members found this post helpful.
Old 04-10-2024, 05:40 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,874

Rep: Reputation: 7314Reputation: 7314Reputation: 7314Reputation: 7314Reputation: 7314Reputation: 7314Reputation: 7314Reputation: 7314Reputation: 7314Reputation: 7314Reputation: 7314
yes, LVM is not a partition type, but a way to manage partitions. You can install your OS with or without it.
 
1 members found this post helpful.
Old 04-12-2024, 12:57 AM   #6
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,153

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
as it name says. logical volume manager it's just helps to manage volumes

as Gemini AI says:
Quote:
Logical: LVM deals with logical volumes, which are virtual representations of storage space carved out of underlying physical devices. These logical volumes can be resized, moved, and managed independently of the physical devices they reside on.

Volume: A volume refers to a specific chunk of storage space that can be used by the operating system. In LVM, logical volumes act as these chunks, providing a layer of abstraction over the physical storage.

Manager: The LVM toolset provides functionalities to create, manage, resize, and extend these logical volumes as needed.
 
1 members found this post helpful.
Old 04-13-2024, 08:15 AM   #7
Jason.nix
Member
 
Registered: Feb 2023
Posts: 561

Original Poster
Rep: Reputation: 10
Hello,
Thanks for all the replies.
Consider the following partitioning:
Code:
# lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda           8:0    0   512G  0 disk 
└─sda1        8:1    0   512G  0 part 
  ├─LB-Root 254:0    0  74.5G  0 lvm  /
  ├─LB-Home 254:1    0  18.6G  0 lvm  /home
  └─LB-Data 254:2    0 418.9G  0 lvm  /mnt/data
sr0          11:0    1  1024M  0 rom
I want to reinstall Linux, but this time I don't want to use LVM and I want to use the data in LB-Data partition. Is this possible? Shouldn't the whole disk be reformatted when LVM wants to convert to normal partitioning?

Last edited by Jason.nix; 04-13-2024 at 08:17 AM.
 
Old 04-13-2024, 08:17 AM   #8
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,663
Blog Entries: 4

Rep: Reputation: 3944Reputation: 3944Reputation: 3944Reputation: 3944Reputation: 3944Reputation: 3944Reputation: 3944Reputation: 3944Reputation: 3944Reputation: 3944Reputation: 3944
Just continue to use LVM. Eventually, you will be very glad you did.
 
Old 04-13-2024, 11:21 AM   #9
lvm_
Member
 
Registered: Jul 2020
Posts: 933

Rep: Reputation: 337Reputation: 337Reputation: 337Reputation: 337
Quote:
Originally Posted by Jason.nix View Post
I want to reinstall Linux, but this time I don't want to use LVM and I want to use the data in LB-Data partition. Is this possible? Shouldn't the whole disk be reformatted when LVM wants to convert to normal partitioning?
LVM is just like drugs, mortgages and clouds - once you got into this mess, it's not that easy to get out. If LB-Data volume is more than 50% free you can shrink the filesystem, then the volume, then the LVM partition, create a new partition in the freed space, create a filesystem there and copy the data, but that requires some skills. Otherwise you'll have to copy data to a backup device, re-partition the disk and copy data back, but that requires that backup device.

Quote:
Originally Posted by sundialsvcs View Post
Just continue to use LVM. Eventually, you will be very glad you did.
Or not. Unless LVM usage is indicated, it's just a useless thing which can go wrong and wastes resources. Its forte - virtualised storage, not a physical one.
 
Old 04-13-2024, 01:20 PM   #10
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Quote:
Originally Posted by lvm_ View Post
LVM is just like drugs, mortgages and clouds - once you got into this mess, it's not that easy to get out. If LB-Data volume is more than 50% free you can shrink the filesystem, then the volume, then the LVM partition, create a new partition in the freed space, create a filesystem there and copy the data, but that requires some skills. Otherwise you'll have to copy data to a backup device, re-partition the disk and copy data back, but that requires that backup device.


Or not. Unless LVM usage is indicated, it's just a useless thing which can go wrong and wastes resources. Its forte - virtualised storage, not a physical one.
We all have our own opinions.
LVM is actually a physical storage, not virtual. It is a means of managing flexible storage without the limiting features of physical drives or partition sizes and adds the ability for storage in a single file system to span multiple physical drives seamlessly.

I have been using LVM for many years, and I love the ability to add space and grow the file system seamlessly while the machine is in use.
I use a raid array with LVM and have gradually grown from a measly 1 TB size to more than 10 TB on that raid array and never needed to be concerned about shutting down to do so. I have had drives fail and be replaced without problems with the raid, and I have had the file system grow as needed with more data storage, also without shutdown nor partitioning hassles.
 
1 members found this post helpful.
Old 04-13-2024, 06:21 PM   #11
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,640

Rep: Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697
If you have, and will only ever have, a single physical drive that will never change then LVM works but provides little value. As soon as you are adding drives or moving storage (resizing partitions or file systems) then LVM is golden.

There is no reason to use it with ZFS or BTRFS, but if you are using EXT4 on RAID (physical or using MDADM) it can save you no end of complications.
 
Old 04-14-2024, 01:20 AM   #12
lvm_
Member
 
Registered: Jul 2020
Posts: 933

Rep: Reputation: 337Reputation: 337Reputation: 337Reputation: 337
Quote:
Originally Posted by computersavvy View Post
We all have our own opinions.
True, but some of them are correct while some - not so much.

Quote:
Originally Posted by computersavvy View Post
LVM is actually a physical storage, not virtual.
And this is an example of opinion which is egregious. L in LVM stands for Logical - as opposed to physical.

Quote:
Originally Posted by computersavvy View Post
I have been using LVM for many years, and I love the ability to add space and grow the file system seamlessly while the machine is in use.
I use a raid array with LVM and have gradually grown from a measly 1 TB size to more than 10 TB on that raid array and never needed to be concerned about shutting down to do so. I have had drives fail and be replaced without problems with the raid, and I have had the file system grow as needed with more data storage, also without shutdown nor partitioning hassles.
Yep, the same here - but without the LVM. Are you really unaware that arrays and filesystems can be grown online all by themselves, and LVM in this scenario is superfluous?
 
Old 04-14-2024, 10:51 AM   #13
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,640

Rep: Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697
Quote:
Originally Posted by lvm_ View Post
Yep, the same here - but without the LVM. Are you really unaware that arrays and filesystems can be grown online all by themselves, and LVM in this scenario is superfluous?
Except that LVM was specifically designed to make it easy to make changes that are difficult, make changes possible where they are impossible otherwise, and combine storage devices without the restrictions (or advantages) of RAID?

It is useful and powerful, and had you ever encountered a situation where it made the difference between a 12 hour outage maintenance and completing the change without outage on a Monday morning you would know that.

That said, it is unclear if the situation justifies it for the OP. We have options now that make LVM less a requirement than an option. Also, his does not sound like a production environment and a short outage to make storage changes might be perfectly suitable for his operation. We cannot change that or determine that, we can only give information and allow the OP to make that judgement.

More important here is that the OP wants to preserve some of the data. The best way, with or without LVM, is to back that data up. This also simplifies everything else the OP has planned.

Last edited by wpeckham; 04-14-2024 at 10:54 AM.
 
Old 04-14-2024, 09:36 PM   #14
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,153

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
Cool

Quote:
Originally Posted by computersavvy View Post
We all have our own opinions.
LVM is actually a physical storage, not virtual. It is a means of managing flexible storage without the limiting features of physical drives or partition sizes and adds the ability for storage in a single file system to span multiple physical drives seamlessly.

I have been using LVM for many years, and I love the ability to add space and grow the file system seamlessly while the machine is in use.
I use a raid array with LVM and have gradually grown from a measly 1 TB size to more than 10 TB on that raid array and never needed to be concerned about shutting down to do so. I have had drives fail and be replaced without problems with the raid, and I have had the file system grow as needed with more data storage, also without shutdown nor partitioning hassles.
Just to add, LVM is definitely good for resizing or adding space. However, if the application is overly sensitive to IO (r/w) adding more disk to LVM will add disk IO r/w latency. So, basic stuff, like forecasting what space will be needed is still good. Rather than doing firefighting when there is some issue.
 
Old 04-15-2024, 12:00 AM   #15
lvm_
Member
 
Registered: Jul 2020
Posts: 933

Rep: Reputation: 337Reputation: 337Reputation: 337Reputation: 337
Quote:
Originally Posted by wpeckham View Post
Except that LVM was specifically designed to make it easy to make changes that are difficult, make changes possible where they are impossible otherwise, and combine storage devices without the restrictions (or advantages) of RAID?
Well, leaving the idle rhetoric out, the last one is quite true, but as no IT man worth his salt will use RAID0 or JBOD (BTW LVM essentially is a glorified JBOD) for any data worth keeping, he also won't use LVM unless underlying devices are themselves redundant, and so we come again to serious stuff - virtual redundant storage and SAN arrays, as the only environment where LVM is acceptable. Your physical home PC is not the place for LVM.

Quote:
Originally Posted by wpeckham View Post
It is useful and powerful, and had you ever encountered a situation where it made the difference between a 12 hour outage maintenance and completing the change without outage on a Monday morning you would know that.
Yes, it sure is a fast way of doing things, but also a sloppy one. These VMs with disks grown historically of half a dozen PVs are so sad...
 
  


Reply



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
LVM Partitions are equals to OS partitions? xeon123 Linux - Newbie 1 05-26-2011 06:45 PM
How to multiboot distros from LVM and/or Non-LVM partitions? kennybobby Fedora 2 12-07-2010 06:58 AM
LXer: Back Up (And Restore) LVM Partitions With LVM Snapshots LXer Syndicated Linux News 0 04-17-2007 11:16 AM
how do I add partitions to drives that have Logical Volume (LVM) partitions? The MJ Linux - Software 5 08-17-2006 06:15 PM
Partitions, partitions, partitions..... Clueless in VA Linux - Newbie 7 08-08-2001 03:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:45 AM.

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