Bagaimana mengubah ukuran sistem file ADV Zevenet dengan LVM

DIKIRIM PADA 2 Mei 2017

Pengantar

Peralatan Zevenet dikirimkan dalam format yang ringan untuk memudahkan penerapan dan pemasangan di platform apa pun, tetapi jika diperlukan lebih banyak penyimpanan untuk sistem logging atau integrasi aplikasi khusus, diperlukan perubahan ukuran sistem file.
Karena alasan itu, dokumen berikut ini menjelaskan prosedur untuk meningkatkan ukuran sistem file root untuk alat virtual Zevenet. Prosedur ini dapat diterapkan untuk peralatan yang menggunakan LVM (Linux Volume Manager), harap periksa apakah partisi root Anda (/) dapat ditingkatkan dengan perintah berikut:

root@zva#> lvdisplay  | grep "LV Path" | grep root
  LV Path                /dev/zva64/root

Catatan: Jika Jalur LV tidak muncul dengan nilai / dev / zva64 / root maka partisi root Anda tidak dapat ditingkatkan.

Prosedur

Pasang alat Load Balancer ZVA virtual disk virtual baru dengan ukuran yang diinginkan. Dalam contoh ini kita akan meningkatkan partisi root (/) dengan 5 GB tambahan. Perhatikan ukuran / sebelum memulai (Hanya tersedia 864Mb).

root@zva#> df -h
Filesystem                Size  Used Avail Use% Mounted on
/dev/dm-0                 1.9G  912M  864M  52% /

Sekarang dari HyperVisor Client lampirkan ke penyeimbang beban virtual, disk virtual baru dengan 5GB.

mengubah ukuran fs adc disk virtual

Dalam contoh kami, perangkat baru akan terdeteksi di dalam penyeimbang beban virtual dengan nama perangkat / dev / xvdb.

root@zva#> fdisk -l

Disk /dev/xvda: 8 GiB, 8589934592 bytes, 16777216 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
Disklabel type: dos
Disk identifier: 0x08115355

Device     Boot    Start      End  Sectors  Size Id Type
/dev/xvda1 *        2048   999423   997376  487M 83 Linux
/dev/xvda2        999424 13694975 12695552  6.1G 8e Linux LVM
/dev/xvda3      13694976 16775167  3080192  1.5G 82 Linux swap / Solaris

Disk /dev/mapper/zva64-root: 1.9 GiB, 2046820352 bytes, 3997696 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 /dev/mapper/zva64-config: 488 MiB, 511705088 bytes, 999424 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 /dev/mapper/zva64-log: 3.7 GiB, 3938451456 bytes, 7692288 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 /dev/xvdb: 5 GiB, 5368709120 bytes, 10485760 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

Sekarang siapkan perangkat / dev / xvdb untuk dimasukkan dalam LVM:

root@zva#> fdisk /dev/xvdb

Dan jalankan tindakan berikut.

mengubah ukuran fs adc disk virtual dengan lvm

Perangkat baru dengan nama / dev / xvdb1 telah dibuat.

root@zva#> fdisk -l /dev/xvdb

Disk /dev/xvdb: 5 GiB, 5368709120 bytes, 10485760 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
Disklabel type: dos
Disk identifier: 0xa3e1a858

Device     Boot Start      End  Sectors Size Id Type
/dev/xvdb1       2048 10485759 10483712   5G 8e Linux LVM

Sekarang sertakan perangkat baru yang sudah dibuat / dev / xvdb1 dalam LVM.

root@zva#> pvcreate /dev/xvdb1
  Physical volume "/dev/xvdb1" successfully created

Peralatan ZVA hanya mencakup satu grup volume yang disebut zva64, di dalam grup volume ini terdapat volume logis 3, salah satunya mengelola partisi root.

Perintah berikut menunjukkan ukuran dan nama grup volume:

root@zva#> vgdisplay 
  --- Volume group ---
  VG Name               zva64
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               6.05 GiB
  PE Size               4.00 MiB
  Total PE              1549
  Alloc PE / Size       1549 / 6.05 GiB
  Free  PE / Size       0 / 0   
  VG UUID               EmgT1X-gPw3-f16M-kBC6-0x4s-LdS8-ymeyB6

Sekarang sertakan perangkat / dev / xvdb1 (5Gb) di grup volume dengan nama zva64, secara otomatis grup volume ini akan bertambah.

root@zva#> vgextend zva64 /dev/xvdb1
  Volume group "zva64" successfully extended

Catat ukuran total setelah perintah terbaru dalam grup volume:

root@zva#> vgdisplay 
  --- Volume group ---
  VG Name               zva64
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               11.05 GiB
  PE Size               4.00 MiB
  Total PE              2828
  Alloc PE / Size       1549 / 6.05 GiB
  Free  PE / Size       1279 / 5.00 GiB
  VG UUID               EmgT1X-gPw3-f16M-kBC6-0x4s-LdS8-ymeyB6

Sekarang, ruang kosong baru harus ditambahkan ke root partisi (/) dalam volume logis dengan nama akar. Di sini volume logis dibuat di dalam grup volume zva64.

root@zva#> lvdisplay 
  --- Logical volume ---
  LV Path                /dev/zva64/root
  LV Name                root
  VG Name                zva64
  LV UUID                EKZu18-rtrq-Fii5-3hCq-JIQh-OGG3-TQhbzU
  LV Write Access        read/write
  LV Creation host, time zva64ee40, 2015-07-28 09:25:23 -0400
  LV Status              available
  # open                 1
  LV Size                1.91 GiB
  Current LE             488
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:0
   
  --- Logical volume ---
  LV Path                /dev/zva64/config
  LV Name                config
  VG Name                zva64
  LV UUID                tHSNAl-BAhc-4WeJ-7c24-23lW-91pD-xwATuq
  LV Write Access        read/write
  LV Creation host, time zva64ee40, 2015-07-28 09:26:39 -0400
  LV Status              available
  # open                 1
  LV Size                488.00 MiB
  Current LE             122
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:1
   
  --- Logical volume ---
  LV Path                /dev/zva64/log
  LV Name                log
  VG Name                zva64
  LV UUID                vjduEj-zLnx-tTEh-FJN6-SrOJ-iwdp-TGi3Sn
  LV Write Access        read/write
  LV Creation host, time zva64ee40, 2015-07-28 09:26:49 -0400
  LV Status              available
  # open                 1
  LV Size                3.67 GiB
  Current LE             939
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:2

Perpanjang volume logis bernama akar dengan ruang kosong tambahan dalam sistem (5 GB tambahan) sebagai berikut:

root@zva#> lvextend -l +100%FREE /dev/zva64/root
  Size of logical volume zva64/root changed from 1.91 GiB (488 extents) to 6.90 GiB (1767 extents).
  Logical volume root successfully resized

Perhatikan itu sekarang tampilkan DVD menunjukkan ukuran baru dalam Logical Volume dengan nama akar.

root@zva#> lvdisplay 
  --- Logical volume ---
  LV Path                /dev/zva64/root
  LV Name                root
  VG Name                zva64
  LV UUID                EKZu18-rtrq-Fii5-3hCq-JIQh-OGG3-TQhbzU
  LV Write Access        read/write
  LV Creation host, time zva64ee40, 2015-07-28 09:25:23 -0400
  LV Status              available
  # open                 1
  LV Size                6.90 GiB
  Current LE             1767
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:0
  .
  .
  .

Terakhir, ubah ukuran sistem file root (/) dengan ukuran baru yang tersedia:

root@zva#> resize2fs /dev/zva64/root
resize2fs 1.42.12 (29-Aug-2014)
Filesystem at /dev/zva64/root is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/zva64/root is now 1809408 (4k) blocks long.

Konfirmasikan ruang kosong baru dengan perintah berikut (5.6Gb Tersedia):

root@zva#> df -h
Filesystem                Size  Used Avail Use% Mounted on
/dev/dm-0                 6.8G  914M  5.6G  14% /
udev                       10M     0   10M   0% /dev
tmpfs                      98M  4.4M   94M   5% /run
tmpfs                     245M     0  245M   0% /dev/shm
tmpfs                     5.0M     0  5.0M   0% /run/lock
tmpfs                     245M     0  245M   0% /sys/fs/cgroup
/dev/mapper/zva64-config  465M  2.3M  434M   1% /usr/local/zenloadbalancer/config
/dev/mapper/zva64-log     3.6G  7.6M  3.4G   1% /var/log
/dev/xvda1                464M   33M  403M   8% /boot

Pada titik ini, penyeimbang muatan Anda diubah ukurannya dan siap untuk mengukur layanan.

Bagikan ke:

Dokumentasi di bawah ketentuan Lisensi Dokumentasi Bebas GNU.

Apakah artikel ini berguna?

Artikel terkait