Ubuntu and LVM
I recently had to organize mi server so I could place all my mp3’s and ISO’s in one place. I have 4 hard disks with 250Gb available to me. Unfortunately I need to pool all four drives so I could tell samba to share to a single location. Hence LVM to the rescue!!
LVM allows me to join all 4 hard drives and create a single volume in which I can store all my files as if I had a single 1Tb partition. This is ideal for me, as I can then share a single partition through out my network.
Requirements:
- Ubuntu
- Install LVM (comes installed by default)
Steps:
- Initiate a single partition
- Create a group volume
- Activate the group
- Create a logical volume
- Format the logical volume
Initiate a single partition
In my case y have four discs. Ubuntu identified them as follows:
- /dev/hdb
- /dev/hdc
- /dev/sda/
- /dev/sdb
- sudo pvcreate /dev/hdb
- sudo pvcreate /dev/hdc
- sudo pvcreate /dev/sda
- sudo pvcreate /dev/sdb
Note: If I had partions instead of physical drives that I wanted to join I would do the following:
- sudo pvcreate /dev/hdb1
- sudo pvcreate /dev/hdc1
- sudo pvcreate /dev/sda1
- sudo pvcreate /dev/sdb1
Creating a group volume
- sudo vgcreate movies_mp3 /dev/hdb /dev/hdc /dev/sda /dev/sdb
or
- sudo vgcreate movies_mp3 /dev/hdb1 /dev/hdc1 /dev/sda1 /dev/sdb1
Note: movies_mp3 is the name of the volume group. You can name this whatever you wish.
Activate the group
- sudo vgchange -a y movies_mp3
Creating a logical volume
In order to create the logical volume you need to know the total PE size. In order to get this information we use the following command.
- sudo vgdisplay movies_mp3 | grep “Total PE”
Now that we have that information we can continue.
- Sudo lvcreate –l Total PE movies_mp3 –n nadia_media
Substitute TotalPE with the number you got from the previous command.
Format the logical volume
- Sudo mkfs –t ext3 /dev/mapped/movies_mp3-nadia_media1
Mount the logical volume
- cd /media
- sudo mkdir nadia_media
- sudo mount /dev/mapped/movies_mp3-nadia_media1 /media/nadia_media
To check if it worked, you check all your shares by using the following command.
df -T -h
I hope that this helps. If you have any questions or comments, I’ll do my best to reply and help in what way I can!
Enjoy!
Nadia



Soy nuevo en UBUNTU, y he instalado el SO en un disco de 4.3 GB. ahora que he instalado un monton de cosas, me quede sin espacio, entonces necesito mas, por ahi escuche que puedo juntar una particion con otra para formar un disco mas grande, la duda es…… ¿si junto mis particiones con el procedimiento que describes, no borrare mis archivos antiguos? pues lo que quiero es darle mas espacio a mi carpeta BOOT, para que aguante mas programas……. Gracias…..