sobat semuanya … mo sharing ajah dikid .. siapa tahu bermanfaat
Mengenai Logical Volume Manager (LVM) di ubuntu, ini sepadan dengan Dynamic Disk nya di windows atau Dynamic Volume.
Ini berfungsi kalau sobat semuanya punya banyak harddisk tapi pengen jadi 1 atau beberapa mount point. Sebagai ilustrasi, misalnya punya 3x500GB, nah nanti totalnya adalah 1,5TB.
Tapi dalam demo / langkah dibawah ini , saya coba tidak segede itu, tapi sambil bermain di VirtualMachine yang mana menggunakan VirtualBox, mo bermain VirtualMachine untuk VirtualBox … silahkan pencet disini
Langsung saja, tanpa basa basi … supaya gag cape bacanya :
1. dengan menggunakan terminal console, login dengan superuser
manz@unix64:$ su ( enter )
root@unit64:/#
kalo gak bisa masuk, aktifkan dulu password untuk rootnya
manz@unix64:$ sudo passwd root
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
nah setelah itu jalankan seperti step diatas.
2. Install LVM2 module
root@unix64:/# apt-get install lvm2
3. check partisi dahulu pake fdisk pake huruf L kecil ya parameter nya
root@unix64:/# fdisk -l
Disk /dev/sda: 16.1 GB, 16106127360 bytes
255 heads, 63 sectors/track, 1958 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00002ae6
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 96256 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 13 864 6836224 83 Linux
Partition 2 does not end on cylinder boundary.
/dev/sda3 864 1958 8794112 8e Linux LVM
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000115f9
Device Boot Start End Blocks Id System
/dev/sdb1 1 1305 10482381 8e Linux LVM
disitu sudah tertera /dev/sda3 dan /dev/sdb1 sudah menjadi Linux LVM. kalau belum silahkan diganti dahulu. contoh dibawah ini :
root@unix64:/# fdisk /dev/sda
WARNING: DOS-compatible mode is deprecated. It’s strongly recommended to
switch off the mode (command ‘c’) and change display units to
sectors (command ‘u’).
Command (m for help): t <- ketik t untuk mengganti partisi yang akan diganti type nya
Partition number (1-5): 3 <- pilih partisi yang akan diganti
Hex code (type L to list codes): 8e <- ketik 8e untuk menjadikan Linux VM
Command (m for help): w <- ketik w untuk menuliskan
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
Kalau dalam live system, harus menjalankan partprobe, istilah gampangnya adalah flushing partition write. ganti semua partisi yang akan dibuat LVM menjadi Linux LVM partition.
4. Buat Logical dan assign Volume
Physical Volume assignment
root@unix64:/# pvcreate /dev/sda3 /dev/sdb1
Physical volume “/dev/sda3″ successfully created
Physical volume “/dev/sdb1″ successfully created
Creating Volume Group
root@unix64:/# vgcreate vg_home /dev/sda3
Volume group “vg_home” successfully created
root@unix64:/# vgextend vg_home /dev/sdb1
Volume group “vg_home” successfully extended
Assign size to Volume Group
root@unix64:/# lvcreate -L10G -nopt vg_home
Logical volume “opt” created
root@unix64:/# lvcreate -L5G -nhome vg_home
Logical volume “home” created
root@unix64:/# lvcreate -L2G -ntmp vg_home
Logical volume “tmp” created
Activating Volume Group
root@unix64:/# vgchange -a y
5. format volume tersebut agar bisa dipergunakan
root@unix64:/# mke2fs -t ext4 -j /dev/vg_home/opt
mke2fs 1.41.11 (14-Mar-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
655360 inodes, 2621440 blocks
131072 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2684354560
80 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 21 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
root@unix64:/# mke2fs -j /dev/vg_home/home
mke2fs 1.41.11 (14-Mar-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
327680 inodes, 1310720 blocks
65536 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1342177280
40 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 34 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
root@unix64:/# mke2fs -j /dev/vg_home/tmp
mke2fs 1.41.11 (14-Mar-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
131072 inodes, 524288 blocks
26214 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
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
6. Sebelum bisa dipergunakan, mari kita buat mount point nya terlebih dahulu dan langsung mounting ke mount point tersebut
– create mount point
root@unix64:/# mkdir -p /mnt/lvm/home
root@unix64:/# mkdir -p /mnt/lvm/opt
root@unix64:/# mkdir -p /mnt/lvm/tmp
– mounting the mount point
root@unix64:/# mount /dev/vg_home/home /mnt/lvm/home
root@unix64:/# mount /dev/vg_home/opt /mnt/lvm/opt
root@unix64:/# mount /dev/vg_home/tmp /mnt/lvm/tmp
7. Periksa apakah sudah aktif dan mounted dengan benar
root@unix64:/# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 6.5G 2.7G 3.5G 44% /
none 496M 268K 496M 1% /dev
none 500M 232K 500M 1% /dev/shm
none 500M 96K 500M 1% /var/run
none 500M 0 500M 0% /var/lock
none 500M 0 500M 0% /lib/init/rw
/dev/sda1 92M 40M 47M 46% /boot
/dev/mapper/vg_home-home
5.0G 139M 4.6G 3% /mnt/lvm/home
/dev/mapper/vg_home-opt
9.9G 165M 9.2G 2% /mnt/lvm/opt
/dev/mapper/vg_home-tmp
2.0G 68M 1.9G 4% /mnt/lvm/tmp
8. Supaya bisa permanent untuk mounting nya, edit dan tambahkan /etc/fstab
/dev/vg_home/home /mnt/lvm/home ext4 rw,user,exec 0 0
/dev/vg_home/opt /mnt/lvm/opt ext4 rw,user,exec 0 0
/dev/vg_home/tmp /mnt/lvm/tmp ext4 rw,user,exec 0 0
9. pindahkan directory yang sudah dibuat ke LVM, sebagai contoh untuk /opt :
root@unit64:/# mv /opt /mnt/lvm/
root@unit64:/# ln -s /mnt/lvm/opt /opt
10. untuk memeriksa dari Volume Group sudah ada :
root@unix64:/# vgdisplay
— Volume group —
VG Name vg_manz
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 10
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 18.38 GiB
PE Size 4.00 MiB
Total PE 4704
Alloc PE / Size 4704 / 18.38 GiB
Free PE / Size 0 / 0
VG UUID rrNlAu-ND0p-2XmR-ldPw-aatb-T2fA-qI6aVX
Kalau sudah sukses semuanya … enak tuh bisa melakukan logical volume di ubuntu
atau disk-volume spanning di windows …
Enaknya kenapa ? karena kalau punya keterbatasan harddisk, dan pengen di add tanpa mengubah dari sistem contoh :
punya harddisk 2 (300GB) each dengan partisi :
/dev/sda1 /boot 100MB
/dev/sda2 / 100GB Linux ext3 / ext4
/dev/sda3 290GB LinuxVM
/dev/sdb1 300GB LinuxVM
, trus kurang, tinggal colok tambahin
dan lakukan extend volume ke harddisk ke-3 (300GB)
misalnya:
extending volume untuk /opt mount point
root@unit64:/# lvextend -L+300G /dev/vg_home/opt
trus apa yang terjadi ?
/dev/mapper/vg_home-opt [b]290G[/b] 165M 9.2G 2% /mnt/lvm/opt
bisa tambah gede segede 300GB lagi, jadi :
/dev/mapper/vg_home-opt [b]590G[/b] 165M 9.2G 2% /mnt/lvm/opt
Sekian dan terima kasih … mudah mudahan bermanfaat buat sobat semuanya.
Salam,
![]()
Man’z






