How to set LVM for the whole disk and all remove already created partitions after installed Debian?

0

1

I have a dedicated server. I could only install a Debian. It was installed as hidden automated process. I would like now to use LVM and actually partition whole disk with another scheme. Is it possible and a good idea to do it in already installed Debian or is it better to install a new Debian with a debootstrap and then make LVM and partitions?

The problem with debootstrap is - all the tutorials saying that I need to partition the disk with new scheme (so is it possible to do it from already installed Debian on that disk?)

static

Posted 2013-06-10T08:38:48.020

Reputation: 1 087

Answers

0

This sounds very similar to what I had to do to recover my server at home after an incorrectly migrated fstab caused rsync to fill my root file system.

First off, understand my experience is with Ubuntu so that's the distro I'm speaking about. Never the less, they should be pretty similar.

The desktop distro of Ubuntu does not come with LVM, so I had to install it.

sudo apt-get install lvm2

Now when you reboot (or insmod lvm) the kernel module will be loaded, but your disks are not LVM enabled yet. To do this, you can use gparted to create a partition out of your free space. It must be big enough to hold a copy of your installation. Then enable LVM on this volume:

sudo pvcreate /dev/sd[new partition letter & number]

Create your volume group,

sudo vgcreate vg1 /dev/sd[same as above]

Now you can begin creating logical volumes in your new partition.

sudo lvcreate -n lvroot -L 20G vg1

This is a very simplified example, but it has the basics. You can indeed install LVM into an existing Linux install, but if you want your system to run from it, you'll have to migrate the install. I did so by using fsarchiver to do a backup, wipe of existing install, setup new LVs to match my partition scheme, then a restore, chroot and update-grub.

There are other ways to do it, and it was lot of work, but that worked well for me.

Brian.D.Myers

Posted 2013-06-10T08:38:48.020

Reputation: 321