[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Changing to lvm from ext4



To Ro:
> 
> And there is also 600 GB of adjacent disk space where /home used to be from
> squeeze. I already made a tarball with these older /home and saved it to an
> exterior device. I want to reuse this disk space, with lvm, and migrate
> existing wheezy installation to it, occupying the whole disk this time and
> bringing back most of the old data saved in the tarball.
> 
> Any comments on best way and steps to accomplish this?

There is no easy way to do this. You probably will not receive
detailled step-by-step instructions for your exact situation.

First, what you need to understand is that you don't "change from ext4
to LVM". LVM is not a file system, but an additional abstraction layer
between (possibly partitioned) storage devices and file systems.

Rough steps include:

- Locate unused partition on your hard disk (dev/sdXn)
- Create an LVM physical volume on this partition using pvcreate
- Create a volume group using the new physical volume (vgcreate)
- Create one or more logical volumes in the volume group (lvcreate)
- Create filesystems in the logical volumes (mkfs.xyz)
- Copy data from old partitions
- Adjust configuration for new filesystems (/etc/fstab, grub config,
  recreate initrs)

Be sure to understand LVM's concepts before you start. You can
experiment with regular files that you can treat as partitions. Untested
example:

dd if=/dev/zero of=pseudo-pv bs=1M count=100
pvcreate pseudo-pv
vgcreate testvg pseudo-pv
lvcreate -L20M -n testlv1 testvg
lvcreate -L50M -n testlv2 testvg
mkfs.ext4 /dev/mapper/testvg-testlv1
mkfs.ext4 /dev/mapper/testvg-testlv2
mount /dev/mapper/testvg-testlv1 /mnt/test1
mount /dev/mapper/testvg-testlv2 /mnt/test2

J.
-- 
Whenever I hear the word 'art' I reach for my visa card.
[Agree]   [Disagree]
                 <http://www.slowlydownward.com/NODATA/data_enter2.html>

Attachment: signature.asc
Description: Digital signature


Reply to: