2

So the deal is that I have:

  1. /dev/sda: Existing 1TB HDD, Fedora 24, with a PG, VG, and LVs for /home, /, and swap (hereafter referred to as lv_home, lv_root, and lv_swap).
  2. /dev/sdb: Brand new 120 GB SSD coming in the mail.

What I want to do in a nutshell is to install Fedora 24 on /dev/sdb and take /dev/sda and make it one big LV mounted at /media within the new OS. I need to do so without losing my data in lv_home on sda and would rather not have to copy everything to an external HD or something like that. Specifically, I imagine I would:

  1. Install Fedora 24 on /dev/sdb
  2. Mount /dev/sda at /media
  3. Whack lv_root and lv_swap on /dev/sda and expand lv_home to use up the freed space.
  4. Merge lv_home on /dev/sda into the new VG created on /dev/sdb

What would the LVM dance for accomplishing this look like? I suppose my main concern: once I mount /dev/sda at /media in Step 2, would I still be able to use all the LVM tools (lvremove, vgmerge, etc) to manage /dev/sda? For example, would something like this work:

lvremove /media/dev/myvg/lv_root
0

As long as you have VG/LV on sda you can only mount those separately, not sda as a whole. Or if you did you'd have formatted sda and lost the PV/VG/LV on it.

Do you have any custom data that is not part of any regular install in your /? If you do you'd have to copy that over somehow. Otherwise it sounds like *) you could just delete the lv_root, lv_swap, and expand lv_home to full HDD size and rename it to lv_media.

That way your new install (presumably ssd_root, ssd_home, ssd_swap) would have no relation whatsoever to your old lv_home and you could just selectively copy the data you need over. (Depends on how much stuff you had in your /home and which parts of it should be on SSD and which parts should stick to HDD).

Basically I'd unplug/ignore the HDD (at most vgrename if Fedora installer always uses the same VG name as some distros do, alternatively from a livecd lvchange -p r the HDD LVs to make things readonly for a time) and do a complete install on SSD first.

Once that's running, go from there - copy the /home files you need over and only after that is all verified to be in working order, do the conversion of the old /home into a /media LV (as outlined in *) above).

lvremove /media/dev/myvg/lv_root

You seem to be confusing filesystems and devices in this line.

would rather not have to copy everything to an external HD or something like that.

I recommend you do that first in any case. It's easy to lose data if you're not clear on what you're doing. It's even easy to lose data despite knowing exactly how things work.

If you don't have a backup, your data wasn't important.

  • Thank you for your answer! I suppose my confusion arises from... once I boot into /dev/sdb, how do I go about deleting, renaming, etc the LVs on /dev/sda? My silly lvremove example demonstrates my confusion as to how I can 'reach across' from my new OS to manage LVs on a separate disk that were part of a separate install. – user180895 Jul 21 '16 at 22:23
  • As long as there are no clashes in names (such as both systems using same VG name for different VGs, which you first have to vgrename), the old VG including old LV will be "just there". You can mount /dev/oldvg/oldlv /mnt/somewhere (or create /etc/fstab entries to that effect) and things will "just work". It's not like there is a barrier you'd have to cross or anything. – frostschutz Jul 21 '16 at 22:27
  • 1
    If you want both disks to be in the same VG in the end, you can vgmerge. (Personally I like to use separate VG for SSD and HDD, so LVs can't cross over by accident - it's a matter of taste) – frostschutz Jul 21 '16 at 22:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy