1

I have an Ubuntu home media server setup with 4.5TB split across a few hard-drives (1x3TB, 2x1TB) and I'm using LVM2 to manage the volumes. I have recently added a 60GB SSD to my server, and I wish to use it to house the 'root' partition of my server (which is currently under the LVM group).

I don't want to simply add it to the LVM volume group, because (afaik) there's no way to ensure that the SSD will be used for the root filesystem. If I just throw it at the VG, it may be used to house my media, which would defeat the purpose of having the SSD in the first place.

I feel that my only solution is to somehow remove my root partition from the LVM setup and copy it across to the SSD. My boot partition is, of course, not part of the LVM group.

My disk setup is as follows:

60GB SSD: EMPTY.
1TB HDD: /boot, LVM space.
1TB HDD: LVM space.
3TB HHD: LVM space.

I have a few logical volumes. my root (/), a 'media' volume for my media collection, a backup one for my network backups.etc.

Does anyone have any advice as to how to go about this? My end goal is to have the 60GB SSD used for my boot and root partitions, with everything else on the 3TB/1TB/1TB hard-drives.

  • What I usually do in these situations is to boot with SystemRescueCD, create the new partitions, copy the content of the old ones to the new ones with FSArchiver and finally install grub on the new disk. It's usually a fairly smooth procedure. – Pedro Romano Nov 13 '12 at 8:51
  • how much space are you uisng? you can try to mv all data to one disk with pvmove and than detach the other devices from your lvm. – l1zard Nov 13 '12 at 9:10
  • @l1zard: I'm using about two thirds of the space. Why would it be necessary to move the data away from one of the drives? I don't follow. – Kye R Nov 13 '12 at 9:12
  • BTW, there is a way to ensure the SSD will be used for root lvcreate -n root VG PV where PV is the name of SSD device. – Martian Nov 16 '12 at 9:06
1

Even though this question is a couple years old, I'll leave the following for reference: you can actually force LVM to allocate extents from a specified Physical Volume when creating a new LV. The syntax is as follows (you'll find it in more detail in lvcreate(8)):

lvcreate <options such as name, size, etc.> volumeGroup [physicalVolume]

So, for instance, you could have added the SSD to your volume group, then done something such as:

lvcreate -n rootOnSSD -L 60G yourVolGroup /dev/fastSSD

And it would force LVM to allocate those 60G from extents from the SSD.

There are advanced options to specify PE ranges from which to allocate, even inside a given Physical Volume, as well as specifying the LV size as a function of free space in a given PV, etc. See the -l flag in lvmcreate(8).

If you had not used up all the extents in the SSD, it'd be a candidate whenever a new LV were to be created. So, conversely, you'd have to do something like this

lvcreate -n hugeVolumeForMedia -L 1T yourVolGroup /dev/slowMedia [/dev/otherSlowMedia...]

if you were to create a new LV for more mass-storage, and wanted to make sure your SSD isn't wasted on it.

1

In the end, I followed Pedro's instructions.

What I usually do in these situations is to boot with SystemRescueCD, create the new partitions, copy the content of the old ones to the new ones with FSArchiver and finally install grub on the new disk. It's usually a fairly smooth procedure.

He answered as a comment so I can't mark it as an answer.

0

I can't understand the struggle here. This is fairly straight forward.

1.0 cfdisk two partitions on the SSD
1.1 (optional) make a PV out of the non-boot partition
1.2 mkfs on the root and boot partitions

2.0 boot Knoppix (or whatever), mount your filesystems
2.1 rsync -av /old/boot /new/boot and /old/root /new/root

3.0 grub - start shell
3.1 (optional) device (hd0) /dev/ssd
3.2 root (hd0,0) - where hd0,0 is the boot partition of SSD
3.3 install (hd0)

4.0 update /boot/grub.conf

5.0 boot.

6.0 delete old logical volumes

If this is insufficient, please let me know and I'll work in a few more steps or explain the steps in more detail.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.