๐Ÿ› ๏ธ Devops/Virtual Machine

KVM/Qemu ํ™˜๊ฒฝ์—์„œ VM ์ด๋ฏธ์ง€๋ฅผ ๋ณดํ†ต virt-builder๋กœ ๋งŒ๋“ค๋‹ค๊ฐ€ Rocky OS์™€ ๊ฐ™์ด ์ง€์›์„ ํ•˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ, qemu-img ์ปค๋งจ๋“œ๋กœ qcow2 ์ด๋ฏธ์ง€ ์ƒ์„ฑ ํ›„ ์ง์ ‘ iso ํŒŒ์ผ๋กœ step by step์œผ๋กœ ์„ค์น˜ํ•˜๋Š” ์ผ์ด ์ข…์ข… ์žˆ์Šต๋‹ˆ๋‹ค. ํ‰์†Œ์—๋Š” ํ•ญ์‹œ CentOS 7, Ubuntu 20.04๋ฅผ ์‚ฌ์šฉํ•ด์„œ virt-builder์—์„œ๋„ ์ง€์›์„ ํ•ด์คฌ๋˜ ๋ถ€๋ถ„์ด๊ธฐ์— qemu-img + iso ํŒŒ์ผ๋กœ ์ง์ ‘ ์ด๋ฏธ์ง€๋ฅผ ๋งŒ๋“ค์ง€ ์•Š์•˜๋Š”๋ฐ Rocky 8์„ ์“ธ ์ผ์ด ์ƒ๊ฒจ ์–ด์ฉ” ์ˆ˜ ์—†์ด step by step์œผ๋กœ ์„ค์น˜ํ•˜๊ฒŒ ๋˜์—ˆ๋„ค์š”... ๊ทธ๋ฆฌ๊ณ  ๋งŒ๋“  ์ด๋ฏธ์ง€๋กœ virsh console์„ ์ด์šฉํ•˜์—ฌ ์ ‘์†ํ•˜์˜€์œผ๋‚˜ ์•„๋ฌด๋Ÿฐ ๋ฐ˜์‘์ด ์—†์–ด ๊ต‰์žฅํžˆ ๋งŽ์ด ํ—ค๋งธ๋„ค์š” ใ… ใ…  virt-builder๋กœ ๋งŒ๋“  ์ด๋ฏธ์ง€์™€ qemu-img + i..
1) Virtual Box ๊ฒฝ๋กœ ํ™•์ธC:\Program Files\Oracle\VirtualBox 2) Win + R ํ‚คcmd ์ž…๋ ฅ ํ›„ ์—”ํ„ฐ 3) Virtual Box ๊ฒฝ๋กœ ์ด๋™ ๋ฐ ์ปค๋งจ๋“œ ์‹คํ–‰cd C:\\Program Files\\Oracle\\VirtualBoxVBoxManage modifyvm "VM_Name" --nested-hw-virt on
1) Kernel Module Load ํ™•์ธlsmod | grep kvmkvm_intel (amd๋Š” kvm_amd)kvm  2) Nested ์˜ต์…˜ ์ฒดํฌ ๋ฐ ํ™œ์„ฑํ™”(intel)cat /sys/module/kvm_intel/parameters/nested 0(amd)cat /sys/module/kvm_amd/parameters/nested00์ธ ๊ฒฝ์šฐ disable / 1์ธ ๊ฒฝ์šฐ enable ์ด๋ฏ€๋กœ ์˜ต์…˜ ๊ฐ’์„ ์ˆ˜์ •ํ•˜๋ ค๋ฉด ์•„๋ž˜์˜ ์ปค๋งจ๋“œ๋ฅผ ์‹คํ–‰cat /etc/modprobe.d/kvm.confoptions kvm_intel nested=1 // intel์ธ ๊ฒฝ์šฐoptions kvm_amd nested=1 // amd์ธ ๊ฒฝ์šฐEOF 3) ๋ณ€๊ฒฝ์‚ฌํ•ญ ์ ..
OverCommitKVM Hypervisor๋Š” ์ž๋™์ ์œผ๋กœ CPU, Memory๋ฅผ Overcommit ํ•˜๋„๋ก ์„ค์ •๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ์‹œ์Šคํ…œ์— ์žˆ๋Š” ๋ฌผ๋ฆฌ์  ๋ฆฌ์†Œ์Šค (CPU, Memory) ๋ณด๋‹ค ๋” ๋งŽ์€ ๊ฐ€์ƒํ™”๋œ vcpus์™€ Memory๋ฅผ ๊ฐ€์ƒ๋จธ์‹ ์— ํ• ๋‹นํ•  ์ˆ˜ ์žˆ์Œ์„ ์˜๋ฏธํ•˜๋Š”๋ฐ ์ด๊ฒƒ์ด ๊ฐ€๋Šฅํ•œ ์ด์œ ๋Š” ๋Œ€๋ถ€๋ถ„์˜ ํ”„๋กœ์„ธ์Šค๊ฐ€ ํ•ญ์ƒ ํ• ๋‹น๋œ ๋ฆฌ์†Œ์Šค์˜ 100%๊นŒ์ง€ ์•ก์„ธ์Šคํ•˜์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค. (์œ ํœด ์ž์›) ๋ฌผ๋ก  ์‹ค๋ฌด ํ™˜๊ฒฝ์—์„œ๋Š” Memory์˜ ๊ฒฝ์šฐ, OverCommit์„ ํ•˜์ง€ ์•Š๊ณ  ์‹ค์ œ ๋ฌผ๋ฆฌ ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ๋„˜์–ด๊ฐ€์ง€ ์•Š๋„๋ก ํ•ฉ๋‹ˆ๋‹ค. ์™œ๋ƒํ•˜๋ฉด ๊ฐ๊ฐ VM์—์„œ ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ์š”์ฒญํ•˜๋Š” ๊ฒฝ์šฐ, ์–ธ์  ๊ฐ„ ๋ถ€์กฑํ•˜๊ฒŒ ๋˜๋Š” ์ˆœ๊ฐ„์ด ์˜ค๊ฒŒ ๋˜๊ณ  VM์ด suspend ๋  ์ˆ˜๋„ ์žˆ๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  CPU์˜ ๊ฒฝ์šฐ, Memory์™€ ๋‹ฌ๋ฆฌ OverCommit์„ ํ•˜์ง€..
Dev_sHu
'๐Ÿ› ๏ธ Devops/Virtual Machine' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก