Karena Kebutuhan Re-develop system baru, suatu storage dengan fisik Compact Flash harus diupgrade. Penggunaan storage Compact Flash yang sebelumnya hanya 4GB diupgrade menjadi 8 GB. Alhasil ada free available 4GB yang ada pada storage. Karena sistem menggunakan modeling partisi LVM2 (metode untuk mengelola volume ruang simpan). sehingga data - data yang ada tidak akan terganggu ketika akan ditambahkan ukurannya.
karena pada perinsipnya lvm adalah logical volume manager, kita harus sangat hati - hati dalam menggunakan perintahnya.
pengecekan storage CF
root@itech mnt # fdisk -l /dev/sdb Disk /dev/sdb: 8000 MB, 8000110592 bytes 247 heads, 62 sectors/track, 1020 cylinders, total 15625216 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/sdb1 * 49 977549 488750+ 83 Linux /dev/sdb2 977550 7813119 3417785 8e Linux LVM
Gunakan tools cfdisk untuk membuat partisi baru
root@itech mnt # cfdisk /dev/sdb Disk has been changed.
cek kembali partisi
root@itech mnt # fdisk -l /dev/sdb Disk /dev/sdb: 8000 MB, 8000110592 bytes 247 heads, 62 sectors/track, 1020 cylinders, total 15625216 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/sdb1 * 49 977549 488750+ 83 Linux /dev/sdb2 977550 7813119 3417785 8e Linux LVM /dev/sdb3 7813120 15625215 3906048 8e Linux LVM
selanjutnya buat volume group Aino pada partisi /dev/sdb3
root@itech mnt # pvcreate Aino /dev/sdb3 Device Aino not found (or ignored by filtering). WARNING: Volume group Aino is not consistent Can't initialize physical volume "/dev/sdb3" of volume group "Aino" without -ff
Untuk mengatasi masalah diatas, gunakan opsi -ff artinya secara paksa akan kita buat partisi /dev/sdb3 pada volume group Aino.
root@itech mnt # pvcreate Aino /dev/sdb3 -ff Device Aino not found (or ignored by filtering). WARNING: Volume group Aino is not consistent Really INITIALIZE physical volume "/dev/sdb3" of volume group "Aino" [y/n]? y WARNING: Forcing physical volume creation on /dev/sdb3 of volume group "Aino" Physical volume "/dev/sdb3" successfully created
scan kembali volume group dan aktifkan
root@itech mnt # vgscan Reading all physical volumes. This may take a while... Found volume group "Aino" using metadata type lvm2 root@itech mnt # vgchange -ay 3 logical volume(s) in volume group "Aino" now active
sebelum diaktifkan ke volume group
root@itech mnt # pvdisplay --- Physical volume --- PV Name /dev/sdb2 VG Name Aino PV Size 3.26 GiB / not usable 1.68 MiB Allocatable yes PE Size 4.00 MiB Total PE 834 Free PE 34 Allocated PE 800 PV UUID R9HyKO-HEWh-1jMY-TIjf-iSkF-O1Dw-WFsODN "/dev/sdb3" is a new physical volume of "3.73 GiB" --- NEW Physical volume --- PV Name /dev/sdb3 VG Name PV Size 3.73 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID QBscid-ZwsO-0wUn-5jS6-FOX4-rqtr-UWLHMg
Selanjutnya besarkan ukuran volume group dengan menambahkan dari /dev/sdb3 yang sudah masuk pada volume group Aino
root@itech mnt # vgextend /dev/Aino /dev/sdb3 Volume group "Aino" successfully extended
note: jika ingin melepas /dev/sdb3 dari penggunaan aktif volume group Aino
root@itech mnt # vgreduce /dev/Aino /dev/sdb3 Removed "/dev/sdb3" from volume group "Aino"
Setelah diaktifkan ke volume group Aino
root@itech mnt # pvdisplay --- Physical volume --- PV Name /dev/sdb2 VG Name Aino PV Size 3.26 GiB / not usable 1.68 MiB Allocatable yes PE Size 4.00 MiB Total PE 834 Free PE 34 Allocated PE 800 PV UUID R9HyKO-HEWh-1jMY-TIjf-iSkF-O1Dw-WFsODN --- Physical volume --- PV Name /dev/sdb3 VG Name Aino PV Size 3.73 GiB / not usable 2.50 MiB Allocatable yes PE Size 4.00 MiB Total PE 953 Free PE 953 Allocated PE 0 PV UUID QBscid-ZwsO-0wUn-5jS6-FOX4-rqtr-UWLHMg
Sebelum melanjutkan memperbesar /dev/Aino/data , cek terlebih dahulu tipe penggunaan alokasi , jika menggunakan contiguous allocation , terlebih dahulu ubah ke inherit. Karena tipe contiguous tidak dapat menangani perubahan untuk penambahan ukuran.
Jika tetap memaksa, maka berikut error yang didapat:
root@itech mnt # lvresize -L 5G /dev/Aino/data Extending logical volume root to 5.00 GiB Insufficient suitable contiguous allocatable extents for logical volume root: 730 more required
root@itech mnt # lvchange --alloc inherit Aino Logical volume "data" changed Logical volume "cf-rw1" changed Logical volume "cf-rw2" changed
lanjutkan menambahkan ukuran
root@itech mnt # lvresize -L 5G /dev/Aino/data Extending logical volume root to 5.00 GiB Logical volume root successfully resized root@itech mnt # resize2fs -p /dev/Aino/data resize2fs 1.42.6 (21-Sep-2012) Resizing the filesystem on /dev/Aino/data to 1310720 (4k) blocks. Begin pass 1 (max = 22) Extending the inode table XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX The filesystem on /dev/Aino/data is now 1310720 blocks long. root@itech mnt # e2fsck /dev/Aino/data e2fsck 1.42.6 (21-Sep-2012) /dev/Aino/data: clean, 55948/312960 files, 322164/1310720 blocks
Dengan begitu penambahan sudah selesai
root@itech mnt # lvdisplay --- Logical volume --- LV Path /dev/Aino/data LV Name data VG Name Aino LV UUID sz41KI-n0bY-gB2D-PJUy-Gpkf-WsdL-1Zqhap LV Write Access read/write LV Creation host, time , LV Status available # open 0 LV Size 5.00 GiB Current LE 1280 Segments 3 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0 --- Logical volume --- LV Path /dev/Aino/cf-rw1 LV Name cf-rw1 VG Name Aino LV UUID MF2ig2-rDWx-mIID-rUuL-EnkT-NCas-JpJ5Sq LV Write Access read/write LV Creation host, time , LV Status available # open 0 LV Size 500.00 MiB Current LE 125 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:1 --- Logical volume --- LV Path /dev/Aino/cf-rw2 LV Name cf-rw2 VG Name Aino LV UUID 013EFM-TnY5-EKl1-4fN3-TgXI-60Kc-oMpE1m LV Write Access read/write LV Creation host, time , LV Status available # open 0 LV Size 500.00 MiB Current LE 125 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:2
Berikut rujukan atas tulisan saya di atas:
http://www.walecha.net/content/mengubah-ukuran-partisi-lvm2
http://www.hostatic.ro/2010/02/15/lvm-inherit-and-contiguous-policies/
No comments:
Post a Comment