[colug-432] Un-LVM-ify a partition?

Rick Troth rmt at casita.net
Sun Feb 12 11:58:00 EST 2012


Summary:  Bite the bullet.  Get another large chunk of storage
(another LV or another disk or partition), copy your old data there,
then wipe this disk and put your old data back.  Details follow.

For clarity, we're talking about LVM2, if it matters.  (Unlikely any
of us are using LVM1, but some of the capabilities mentioned are
definitely LVM2-isms.)

I wanted to reply (because LVM -vs- partitioning is a pet topic), but
held back not feeling I had the verbiage.  Glad I did because Aaron
and Matt have clarified things quite a bit.

On Sat, Feb 11, 2012 at 10:54 PM, Joshua Kramer <joskra42.list at gmail.com> wrote:
 ...
> Is it possible to un-LVM-ify a partition?

As Aaron said, clarify the terminology.  Not meaning to be pedantic: a
logical volume really is not a partition ... in ways that will matter
when you want to "remove the LVM wrapper".

> I have a 500G disk that used to be in a desktop machine I used on a regular
> basis.  So there's a LOT of stuff on the disk, dating back years.  The disk
> consists of one boot partition, and a LVM containing two additional
> partitions, a 20G and a 460G.

Sounds like not only has the content evolved, but also the
*management* of this disk.

> I want to use this disk as an external disk in a USB enclosure for backing
> stuff up.  The only issue is, with LVM it's not "plug and go" - you have to   ...

Is this the crux of your pain?  You want the disk automatically mounted is all?

There may be some way to effect that, but I don't know.  (Hence my
earlier hesitation.)

>   ...   Is there some way I can "remove the LVM wrapper" around the 460G
> partition?  If, for example, I were to somehow find the exact beginning and
> ending sectors of my 460G partition, could I use the LVM admin tool to
> remove the volume, then create a primary partition with those beginning and
> ending sectors?

If it were a *partition", then yes, you could find the exact start and
end points.  Not so with a "logical volume".  If it's the only LV in
the VG, then maybe.  (But likely messy game to get into ... if it
works at all!)  A logical volume very well might not be contiguous.
If it was ever extended, then it is almost certainly not contiguous.
As Matt said, 'dmsetup table' should tell you.

Sounds like you're abandoning the 20G partition and the boot partition
in any case.  Is that correct?

> While I can assemble an array of disks of various sizes to copy all my data
> over and just regenerate the partition, I'd like to avoid doing so if
> possible.

Do it.  Once done, you will have that tedium behind you.

Use just one partition, or ... drum roll ... skip the partition table
and use the whole disk ... literally.

<aside>

There are only two reasons to use partitioning: GRUB and WIndows.  If
you use a different boot loader (such as LILO) or if you don't need to
boot from the disk, then just start your filesystem at physical block
zero.  Works.  You'll save a whopping 12K ... or maybe a whole meg.
But the value is not in storage saved; rather less complexity.

Windows has an allergy to unpartitioned disks.  Do you care?  If you
will make this EXT3, Windows can't read it anyway.

GRUB also has a problem.  Long story.  I use GRUB, but it ignorantly
renumbers "partition one" as "slice zero".  Other boot loaders do not
have this problem.  (And why the GRUB authors did this is beyond me.)
GRUB is usually the only thing preventing me from discarding the
partition table on any given disk.

I mention this because most people simply do not know:  disks do not
*have* to be partitioned.  Partitioning is like a poor man's LVM, with
way less flexibility.  If you need to carve up a physical disk into
multiple "partitions", stamp the whole thing as a PV and dole out LVs
as needed.

Partitioning is not a physical thing.  It's a logical thing.  LVM does
the same thing, only better ... wwwaaayyy better, and does more.

</aside>

I am a huge fan of LVM now.  Never yet tried removable disks as PVs.

-- R;   <><



More information about the colug-432 mailing list