2

I'm wondering a few things:

Background

I've got a machine with 2 HDDs (Each 500GB SATA). /dev/sda contains nothing but an infrequently used Windows10 for gaming. /dev/sdb contains my current Gentoo + Systemd + KDE install, booted via Grub2. Due to the age of my install - 3+ years, my Partition Map(seen below) is "old style" MS-DOS, I.e no more than 4 primary partitions, with a DOS style MBR - non UEFI.

My Disk Layout

Questions

  1. I'd like to know if it's possible to convert this layout to LVM without data loss, and if so, how do I do it?
  2. I'd like to put the files in my /home directory on a separate partition. Should I do this before I start #1? Do I shrink/copy/mount, or just mount /home in the empty space I create?
  3. After creating all this, I'd like to treat 1 and 2 together as a Volume. Is that possible?
  4. Is there anything I need to do differently, in order to boot it when finished?

Update

While attempting the accepted answer below, I lost all data. I want it known that this was due to user error and inexperience with LVM, and not because the answer was incorrect. I answered yes when I should have answered no, like so, and wiped the signature off of my root partition. After doing so, I started over, and my system now looks like: so:

# /etc/fstab: static file system information.
# Extraneous comments removed
# 
# <fs>                  <mountpoint>    <type>          <opts>          <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/sdb1               /boot           ext4            noauto,noatime  1 2
/dev/gentoo/root        /               btrfs           noatime         0 1
/dev/gentoo/home        /home           btrfs           noatime         0 0
/dev/gentoo/swap        none            swap            sw              0 0
/dev/cdrom              /mnt/cdrom      auto            noauto,ro       0 0
/dev/fd0                /mnt/floppy     auto            noauto          0 0

# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for
# POSIX shared memory (shm_open, shm_unlink).
shm                     /dev/shm        tmpfs           nodev,nosuid,noexec     0 0

Grub2 now has LVM enabled, and Gentoo is now as pure systemd as I can get it, running XFCE, and SSHd on my local network only, so I can install, twiddle, and compile from my laptop. I still don't quite get the argument that exists in the Gentoo camp on why systemd is worse than sysVinit, but that's another question in itself. Note that I can't convert the disk to GPT, as OS prober/grub2, cannot boot from GPT, and still read my MS-DOS Windows partitions. As such, I completed my questions, and then some. Now that my system is back up, I'm available to help here again, in any way I can

1
  • Given that it's Gentoo, BTRFS might make sense. There's in place conversion possible. You can do it with LVM (and I prefer LVM fwiw) but the benefits of doing an in-place conversion might make more sense. It seems like you're probably just trying to set different limits on how much storage certain directories trees can use but are prevented by MBR's partition limit. In which case BTRFS subvolumes will probably suffice.
    – Bratchley
    Commented Jul 6, 2016 at 1:29

1 Answer 1

1

I suppose you could change that single partition to an LVM volume, since you have enough free space for another copy of the contents.

I'm thinking something like:

  1. resize2fs the filesystem to a smaller smaller.
  2. Delete the swap partition and resize the root partition to that smaller size
  3. Create a new partition, make an LVM PV out of it (and create a VG and an LV on it).
  4. Copy everything over, change the system to boot from the LVM. (And make sure it works properly.)
  5. Wipe the old partition and turn it, also, into a PV. Add it to the VG.
  6. Create whatever other LVs you like inside the VG, like a separate /home.

But could you is not the same as should you. The above is tricky enough that I would bother trying, and the end result would a bit ugly since you'd have two PVs on one disk (avoiding that might need more shuffling around). It would be easier and safer if you could do the move from one disk to a new one, leaving the old one unchanged and safe.

(Oh, and, backups.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .