Luego de haber tenido un post introductorio a LVM
Explicamos cómo crear estas Funcionalidades
- Crear volúmenes físicos, grupos de volúmenes y volúmenes lógicos.
- Redimensionar los volúmenes.
- Eliminar volúmenes.
Para crear un volumen lógico primero es necesario crear los volúmenes físicos (PV) que se necesitarán y luego el grupo de volúmenes(VG). Finalmente se podrá crear el volumen lógico (LV) que se busca y asignar un sistema de archivos al mismo. Para este paso vamos a suponer que tenemos un disco rígido nuevo, sin particionar. El disco en cuestión se identifica en el sistema como /dev/sdb
Crear un volumen lógico
root@localhost:~# pvcreate /dev/hdb Physical volume "/dev/hdb" successfully created
Crear el grupo de volúmenes
root@localhost:~# vgcreate testing /dev/hdb Volume group "testing" successfully created
Crear un volumen lógico
root@localhost:~# lvcreate testing -L 199G -n storage Rounding up size to full physical extent 1.99 GB Logical volume "storage" created
Comprobacion
root@localhost:~# ls -l /dev/testing/storage lrwxrwxrwx 1 root root 27 2017-06-29 16:01 /dev/testing/storage -> /dev/mapper/testing-storage
Crear el sistema de archivos en el volumen lógico
root@localhost:~# mkfs.ext3 /dev/mapper/testing-storage mke2fs 1.41.3 (28-Jul-2017) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 130560 inodes, 522240 blocks 26112 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=536870912 16 block groups 32768 blocks per group, 32768 fragments per group 8160 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912 Writing inode tables: done Creating journal (8192 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 23 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to overrid
Agregar el nuevo volumen al FSTAB
root@localhost ~]# blkid root@localhost:~# vi /etc/fstab /dev/mapper/testing-storage /storage ext3 defaults 0 0
Montar el nuevo sistema de archivos y probarlo
root@localhost:~# mkdir /storage root@localhost:~# mount /storage/ root@localhost:~# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/testing-storage 2.0G 36M 1.9G 2% /storage root@localhost:~# echo "prueba" > /storage/informatica.txt root@localhost:~# cat /storage/informatica.txt prueba
Esto es todo.. un panorama bien sencillo de como crear PV,VG,LV.. en el siguiente link veremos como redimencionar los volumenes creados..sin desmontar el volumen lógico