Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a 8 GB flash drive. I need it to install Ubuntu with encrypted LVM. When I use automatic partitioning everything is be okay and works. But the machine sets 2 gigabytes SWAP, an unreasonably high value. I could use manual partitioning with standard sections of course, but god I cannot figure out how to set up LVM. Is there a section VLM with encryption, but failed to implement it into my / swap as it does automaton. Could someone please advise?

share|improve this question
So, if I understand your post correctly, your question is: "How do I select a smaller size for Swap for an encrypted LVM during installation?" –  gertvdijk Feb 1 '13 at 16:48
Unfortunately, manual partitioning does not allow you to manage LVM: LP Bug #1042647: Manual Partitioning LVM (Ubiquity). With the alternate CD being dropped since 12.10, I think there's no workaround besides setting it up manually the command-line way. –  gertvdijk Feb 1 '13 at 17:01
add comment

1 Answer

The alternate installer has the ability to set up and install to LVM, and is the supported way of doing so. You can install the lvm2 package on an existing system, or the desktop livecd and manually set it up, and then install to it. This is what I will cover. (Ubuntu 12.10 has since introduced LVM support from the installation live CD.)

First, you need a Physical Volume. Typically you start with a hard disk, and create an LVM type partition on it. You can create one with gparted or fdisk, and usually only want one partition to use the whole disk, since LVM will handle subdividing it into Logical Volumes. In gparted, you need to check the lvm flag when creating the partition, and with fdisk, tag the type with code 8e.

Once you have your LVM partition, you need to initialize it as a Physical Volume. Assuming this partition is /dev/sda1:

sudo pvcreate /dev/sda1

This writes the LVM header to the partition, which identifies it as a Physical Volume, and sets up a small area to hold the metadata describing everything about the Volume Group, and the the rest of the partition as unused Physical Extents. After that, you need to create a Volume Group named foo:

sudo vgcreate foo /dev/sda1

Now you have a Volume Group named foo. I suggest you change foo to a name meaningful to you. foo contains only one Physical Volume. Now you want to create a Logical Volume from some of the free space in foo:

sudo lvcreate -n bar -L 5g foo

This creates a Logical Volume named bar in Volume Group foo using 5 GB of space. If you are installing, you probably want to create a Logical Volume like this to use as a root filesystem, and one for swap, and maybe one for /home. I currently have a Logical Volume for a Lucid install, and one for a Maverick install, so that is what I named those volumes. You can find the block device for this Logical Volume in '/dev/foo/bar' or 'dev/mapper/foo-bar'.

You might also want to try the lvs and pvs commands, which list the Logical Volumes and Physical Volumes respectively, and their more detailed variants; lvdisplay and pvdisplay.

If you are doing this from the desktop livecd, once you have created your Logical Volumes from the terminal, you can run the installer, and use manual partitioning to select how to use each Logical Volume, and then install.

share|improve this answer
Thank you very much for your answer. Unfortunately this process, my Linux knowledge is not enough. –  Malder Feb 1 '13 at 16:47
Then you may use Ubuntu Live cd it will be of less risk and easy –  Goku Feb 1 '13 at 16:55
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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