Manajemen KVM & LXC Menggunakan CLI di Proxmox VE

Hai semuanya, apa kabar? Selain menggunakan web interface, kita juga bisa gunakan command line untuk melakukan manajemen baik pada KVM maupun LXC. Alternatif ini bermanfaat apabila kita perlu melakukan manajemen saat tidak memungkinkan untuk mengakses web interface (misalnya sedang sesi remote via terminal).

Perintah utama yang digunakan untuk manajemen KVM adalah qm, sedangkan untuk LXC perintahnya adalah pct.

Manajemen KVM dengan Perintah qm

  • Melihat daftar VM:
      root@pve1:~# qm list
        VMID NAME                 STATUS     MEM(MB)    BOOTDISK(GB) PID       
         102 Debian12             running    2048              16.00 2601246   
         103 Talos                stopped    8192              20.00 0
    

    Perintah ini menampilkan daftar seluruh VM di dalam host, lengkap dengan ID, nama, status (running/stopped), alokasi memori, ukuran disk, dan PID sistem.

  • Menyalakan VM: qm start [VM-ID].
  • Mematikan VM (safe): qm shutdown [VM-ID]
  • Mematikan VM (forced): qm stop [VM-ID].
    Gunakan perintah ini jika OS di dalam VM mengalami freeze atau tidak merespons perintah shutdown normal. Perintah ini ibarat mencabut kabel daya fisik.
  • Reset VM: qm reset [VM-ID]

Selain perintah operasional dasar, command qm juga bisa digunakan untuk task lain seperti clone dan membuat snapshot.

  • Salin/clone VM:
      root@pve1:~# qm clone 102 202 --name Debian12-clone
      creating a clone of VM 102 with ID 202
      create full clone of drive ide2 (Ceph-HDD:vm-102-cloudinit)
      allocated target volume 'Ceph-HDD:vm-202-cloudinit'
      create full clone of drive scsi0 (Ceph-HDD:vm-102-disk-0)
      allocated target volume 'Ceph-HDD:vm-202-disk-0'
      drive mirror is starting for drive-scsi0
      mirror-scsi0: transferred 1.0 MiB of 16.0 GiB (0.01%) in 0s
      mirror-scsi0: transferred 17.0 MiB of 16.0 GiB (0.10%) in 1s
      mirror-scsi0: transferred 52.0 MiB of 16.0 GiB (0.32%) in 2s
      ...
          mirror-scsi0: transferred 15.0 GiB of 16.0 GiB (93.94%) in 1m 53s
      mirror-scsi0: transferred 16.0 GiB of 16.0 GiB (100.00%) in 1m 54s, ready
      all 'mirror' jobs are ready
      skipping guest filesystem freeze - disabled in VM options
      suspend vm
      mirror-scsi0: Cancelling block job
      mirror-scsi0: Done.
      resume vm
      root@pve1:~# qm list
            VMID NAME                 STATUS     MEM(MB)    BOOTDISK(GB) PID       
             102 Debian12             running    2048              16.00 2601246   
             103 Talos                stopped    8192              20.00 0         
             202 Debian12-clone       stopped    2048              16.00 0
    
  • Membuat snapshot,
      root@pve1:~# qm snapshot 102 testing-snap
      skipping guest filesystem freeze - disabled in VM options
      snapshotting 'drive-scsi0' (Ceph-HDD:vm-102-disk-0)
      internal qemu snapshot
      root@pve1:~# qm listsnapshot 102
      `-> testing-snap                2026-07-16 23:04:46     no-description
       `-> current                                            You are here!
      root@pve1:~#
    

    Manajemen LXC dengan Perintah pct

  • Melihat daftar CT:
      root@pve1:~# pct list
      VMID       Status     Lock         Name                
      101        running                 Ubuntu
    
  • Menyalakan CT: pct start [CT-ID].
  • Mematikan CT (safe): pct shutdown [CT-ID].
  • Mematikan CT (forced): pct stop [CT-ID].
  • Masuk ke CT:
    Selain itu, untuk LXC ada fitur spesial. Kita bisa masuk ke CT dengan perintah pct enter.

      root@pve1:~# pct enter 101
      root@Ubuntu:~# cat /etc/hosts
      127.0.0.1    localhost
      ...
      root@Ubuntu:~#
    

    Dengan perintah ini, kita bisa langsung masuk ke dalam shell root milik container tanpa perlu mengetahui alamat IP ataupun melakukan remote SSH ke CT tersebut.

  • Melihat konfigurasi CT
      root@pve1:~# pct config 101
      arch: amd64
      cores: 1
      features: nesting=1
      hostname: Ubuntu
      memory: 512
      net0: 
      ...
      swap: 512
      unprivileged: 1
      root@pve1:~#
    

    Perintah ini akan membongkar seluruh isi berkas konfigurasi container, termasuk alokasi CPU, RAM, dan kartu jaringan.

Tambahan: Monitoring Node

  • Memeriksa status storage. Perintah ini akan enampilkan ruang kosong, kapasitas terpakai, dan status aktif dari seluruh storage pool yang terikat di PVE.
      root@pve1:~# pvesm status
      Name               Type     Status     Total (KiB)      Used (KiB) Available (KiB)        %
      Ceph-HDD            rbd     active        45787919         6908195        38879724   15.09%
      Ceph-SSD            rbd     active        46738744         4842880        41895864   10.36%
      PBS                 pbs     active        58382324         6610544        48773716   11.32%
      VMware             esxi     active               0               0               0    0.00%
      ...
    
  • Cek kondisi cluster
    Gunakan perintah ini jika server PVE beroperasi dalam mode cluster/multi-node. Kita bisa melihat jumlah node yang aktif dan status quorum secara langsung.

      root@pve1:~# pvecm status
      Cluster information
      -------------------
      Name:             myCluster
      Config Version:   4
      Transport:        knet
      Secure auth:      on
    
      Quorum information
      ------------------
      Date:             Thu Jul 16 23:13:28 2026
      Quorum provider:  corosync_votequorum
      Nodes:            3
      Node ID:          0x00000001
      Ring ID:          1.f7
      Quorate:          Yes
    
      Votequorum information
      ----------------------
      Expected votes:   3
      Highest expected: 3
      Total votes:      3
      Quorum:           2  
      Flags:            Quorate 
      ...
    

Penutup

Menguasai perintah qm dan pct memberikan kita kendali lebih dan efisiensi dalam mengelola infrastruktur virtualisasi Proxmox VE. Kita bisa menggabungkan perintah-perintah di atas ke dalam skrip otomatisasi (bash script) atau cronjob untuk melakukan tugas-tugas rutin seperti automated power management atau pengecekan massal.

Tulisan kali ini sampai di sini dulu ya. Sampai jumpa. Bye.

By Zaidan

Leave a Reply

Your email address will not be published. Required fields are marked *