domingo, 5 de marzo de 2023

Creating Logical Volumes

lvcreate allocates logical volumes from within volume groups. The size can be specified either in bytes or number of extents (remember, they are 4 MB by default). Names can be anything desired.

lvdisplay reports on available logical volumes.

Filesystems are placed in logical volumes and are formatted with mkfs, as usual.

Starting with possibly creating a new volume group, the steps involved in setting up and using a new logical volume are:

  1. Create partitions on disk drives (type 8e in fdisk).
  2. Create physical volumes from the partitions.
  3. Create the volume group.
  4. Allocate logical volumes from the volume group.
  5. Format the logical volumes.
  6. Mount the logical volumes (also update the /etc/fstab file as needed).

For example, assuming you have already created partitions /dev/sdb1 and /dev/sdc1 and given them type 8e, the steps involved in setting up and using a new logical volume are:

$ sudo pvcreate /dev/sdb1
$ sudo pvcreate /dev/sdc1
$ sudo vgcreate -s 16M vg /dev/sdb1
$ sudo vgextend vg /dev/sdc1
$ sudo lvcreate -L 50G -n mylvm vg
$ sudo mkfs -t ext4 /dev/vg/mylvm
$ sudo mkdir /mylvm
$ sudo mount /dev/vg/mylvm /mylvm

Be sure to add the line:

/dev/vg/mylvm /mylvm ext4 defaults 1 2

to /etc/fstab to make this a persistent mount.


------------------------------



No hay comentarios:

Publicar un comentario