Creant una màquina virtual amb VMM Hypervisor a OpenBSD 6.7

Creant una màquina virtual amb VMM Hypervisor a OpenBSD 6.7

En aquest article explique com crear una instància virtual d'OpenBSD amb VMM Hypervisor de 150 GB de disc i 2 GB de RAM.

Per als meus projectes i proves, tinc dos instàncies d'OpenBSD virtualitzades de 50 GB cadascuna. I hui, per una necessitat a la meua feina, he necessitat crear-me una màquina virtual de 150 GB d'espai de disc i 2 GB de RAM. I, a banda, com que necessite donar-li molt d'espai a /var perquè els meus desenvolupaments són, principalment, amb Nginx, MariaDB i Drupal, he hagut de redimensionar el punt de muntatge de /home i de /var.

Cree la màquina VMM Hypervisor amb:

x250$ doas vmctl create -s 150G nova.qcow2
vmctl: qcow2 imagefile created
x250$ doas vmctl start -m 2G -L -i 1 -r /home/joan/install67.iso -d nova.qcow2 nova
vmctl: started vm 2 successfully, tty /dev/ttyp5

Ara, em connecte amb:

x250$ doas vmctl console nova
Connected to /dev/ttyp5 (speed 115200)

I a continuació veurem la benvinguda de la instal·lació normal d'OpenBSD:

Welcome to the OpenBSD/i386 6.7 installation program.
(I)nstall, (U)pgrade, (A)utoinstall or (S)hell? I
.
At any prompt except password prompts you can escape to a shell by
typing '!'. Default answers are shown in []'s and are selected by
pressing RETURN. You can exit this program at any time by pressing
Control-C, but this can leave your system in an inconsistent state.
.
Terminal type? [vt220]
System hostname? (short form, e.g. 'foo') nova
.
Available network interfaces are: vio0 vlan0.
Which network interface do you wish to configure? (or 'done') [vio0]
IPv4 address for vio0? (or 'dhcp' or 'none') [dhcp]
vio0: 100.64.2.3 lease accepted from 100.64.2.2 (fe:e1:bb:d1:0f:dc)
IPv6 address for vio0? (or 'autoconf' or 'none') [none]
Available network interfaces are: vio0 vlan0.
Which network interface do you wish to configure? (or 'done') [done]
DNS domain name? (e.g. 'example.com') [my.domain] joancatala.net
Using DNS nameservers at 100.64.2.2
.
Password for root account? (will not echo)
Password for root account? (again)
Start sshd(8) by default? [yes]
Do you want the X Window System to be started by xenodm(1)? [no] no
Change the default console to com0? [yes]
Available speeds are: 9600 19200 38400 57600 115200.
Which speed should com0 use? (or 'done') [115200]
.
Setup a user? (enter a lower-case loginname, or 'no') [no] joan
Full name for user joan? [joan]
Password for user joan? (will not echo)
Password for user joan? (again)
WARNING: root is targeted by password guessing attacks, pubkeys are safer.
Allow root ssh login? (yes, no, prohibit-password) [no]
What timezone are you in? ('?' for list) [Europe/Madrid]
.
Available disks are: sd0.
Which disk is the root disk? ('?' for details) [sd0]
MBR has invalid signature; not showing it.
Use (W)hole disk or (E)dit the MBR? [whole]

Ara, per defecte l'opció [whole] redimensiona els punts de muntatge així:

Setting OpenBSD MBR partition to whole sd0...done.
The auto-allocated layout for sd0 is:
# size offset fstype [fsize bsize cpg]
a: 1.0G 64 4.2BSD 2048 16384 1 # /
b: 2.2G 2097216 swap
c: 150.0G 0 unused
d: 4.0G 6814880 4.2BSD 2048 16384 1 # /tmp
e: 8.0G 15203456 4.2BSD 2048 16384 1 # /var
f: 6.0G 31978784 4.2BSD 2048 16384 1 # /usr
g: 1.0G 44561696 4.2BSD 2048 16384 1 # /usr/X11R6
h: 20.0G 46658848 4.2BSD 2048 16384 1 # /usr/local
i: 2.0G 88601888 4.2BSD 2048 16384 1 # /usr/src
j: 6.0G 92796192 4.2BSD 2048 16384 1 # /usr/obj
k: 99.7G 105379104 4.2BSD 2048 16384 1 # /home
Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout? [a]

Jo el que faré serà esborrar /home (que és la lletra k) i també /var (que és lalletra e):

Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout? [a] e
Label editor (enter '?' for help at any prompt)
sd0> d e
sd0*> d k
sd0*> a e
offset: [105379104]
size: [209189661] 209180000
FS type: [4.2BSD]
mount point: [none] /var
sd0*> a k
offset: [15203456]
size: [16775328]
FS type: [4.2BSD]
mount point: [none] /home
sd0*> p
OpenBSD area: 64-314568765; size: 314568701; free: 9669
# size offset fstype [fsize bsize cpg]
a: 2097152 64 4.2BSD 2048 16384 1 # /
b: 4717656 2097216 swap
c: 314572800 0 unused
d: 8388576 6814880 4.2BSD 2048 16384 1 # /tmp
e: 209180000 105379104 4.2BSD 2048 16384 1 # /var
f: 12582912 31978784 4.2BSD 2048 16384 1 # /usr
g: 2097152 44561696 4.2BSD 2048 16384 1 # /usr/X11R6
h: 41943040 46658848 4.2BSD 2048 16384 1 # /usr/local
i: 4194304 88601888 4.2BSD 2048 16384 1 # /usr/src
j: 12582912 92796192 4.2BSD 2048 16384 1 # /usr/obj
k: 16775328 15203456 4.2BSD 2048 16384 1 # /home
sd0*>

Hauràs vist que hem esborrat k i e, i a continuació les hem redimensionat creant-les novament. Finalment, guardarem i eixirem amb l'opció q:

sd0*> q
Write new label?: [y] y
/dev/rsd0a: 1024.0MB in 2097152 sectors of 512 bytes
6 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each
/dev/rsd0k: 8191.1MB in 16775328 sectors of 512 bytes
41 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each
/dev/rsd0d: 4096.0MB in 8388576 sectors of 512 bytes
21 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each
/dev/rsd0f: 6144.0MB in 12582912 sectors of 512 bytes
31 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each
/dev/rsd0g: 1024.0MB in 2097152 sectors of 512 bytes
6 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each
/dev/rsd0h: 20480.0MB in 41943040 sectors of 512 bytes
102 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each
/dev/rsd0j: 6144.0MB in 12582912 sectors of 512 bytes
31 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each
/dev/rsd0i: 2048.0MB in 4194304 sectors of 512 bytes
11 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each
/dev/rsd0e: 102138.7MB in 209180000 sectors of 512 bytes
505 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each
/dev/sd0a (5c46b8206d0c9d44.a) on /mnt type ffs (rw, asynchronous, local)
/dev/sd0k (5c46b8206d0c9d44.k) on /mnt/home type ffs (rw, asynchronous, local, nodev, nosuid)
/dev/sd0d (5c46b8206d0c9d44.d) on /mnt/tmp type ffs (rw, asynchronous, local, nodev, nosuid)
/dev/sd0f (5c46b8206d0c9d44.f) on /mnt/usr type ffs (rw, asynchronous, local, nodev)
/dev/sd0g (5c46b8206d0c9d44.g) on /mnt/usr/X11R6 type ffs (rw, asynchronous, local, nodev)
/dev/sd0h (5c46b8206d0c9d44.h) on /mnt/usr/local type ffs (rw, asynchronous, local, nodev)
/dev/sd0j (5c46b8206d0c9d44.j) on /mnt/usr/obj type ffs (rw, asynchronous, local, nodev, nosuid)
/dev/sd0i (5c46b8206d0c9d44.i) on /mnt/usr/src type ffs (rw, asynchronous, local, nodev, nosuid)
/dev/sd0e (5c46b8206d0c9d44.e) on /mnt/var type ffs (rw, asynchronous, local, nodev, nosuid)

Ara, una vegada ja tenim redimensionades /home i /var al meu gust, anem a fer la instal·lació dels install sets de manera normal com a qualsevol instal·lació d'OpenBSD:

Let's install the sets!
Location of sets? (cd0 disk http or 'done') [http]
HTTP proxy URL? (e.g. 'http://proxy:8080', or 'none') [none]
HTTP Server? (hostname, list#, 'done' or '?') [ftp.fr.openbsd.org]
Server directory? [pub/OpenBSD/6.7/i386]
.
Select sets by entering a set name, a file name pattern or 'all'. De-select
sets by prepending a '-', e.g.: '-game*'. Selected sets are labelled '[X]'.
[X] bsd [X] comp67.tgz [X] xbase67.tgz [X] xserv67.tgz
[X] bsd.rd [X] man67.tgz [X] xshare67.tgz
[X] base67.tgz [X] game67.tgz [X] xfont67.tgz
Set name(s)? (or 'abort' or 'done') [done]
Get/Verify SHA256.sig 100% |**************************| 1963 00:00
Signature Verified
Get/Verify bsd 100% |**************************| 13629 KB 00:16
Get/Verify bsd.rd 100% |**************************| 8667 KB 00:08
Get/Verify base67.tgz 100% |**************************| 196 MB 02:33
Get/Verify comp67.tgz 100% |**************************| 54639 KB 00:39
Get/Verify man67.tgz 100% |**************************| 7465 KB 00:06
Get/Verify game67.tgz 100% |**************************| 2649 KB 00:02
Get/Verify xbase67.tgz 100% |**************************| 19551 KB 00:14
Get/Verify xshare67.tgz 100% |**************************| 4499 KB 00:03
Get/Verify xfont67.tgz 100% |**************************| 39342 KB 00:29
Get/Verify xserv67.tgz 100% |**************************| 14295 KB 00:08
Installing bsd 100% |**************************| 13629 KB 00:00
Installing bsd.rd 100% |**************************| 8667 KB 00:00
Installing base67.tgz 100% |**************************| 196 MB 00:36
Extracting etc.tgz 100% |**************************| 262 KB 00:00
Installing comp67.tgz 100% |**************************| 54639 KB 00:16
Installing man67.tgz 100% |**************************| 7465 KB 00:03
Installing game67.tgz 100% |**************************| 2649 KB 00:00
Installing xbase67.tgz 100% |**************************| 19551 KB 00:04
Extracting xetc.tgz 100% |**************************| 7025 00:00
Installing xshare67.tgz 100% |**************************| 4499 KB 00:04
Installing xfont67.tgz 100% |**************************| 39342 KB 00:06
Installing xserv67.tgz 100% |**************************| 14295 KB 00:03
Location of sets? (cd0 disk http or 'done') [done]

I quan finalitze la descàrrega i instal·lació, ja ho tenim tot. Reiniciarem la màquina:

Making all device nodes... done.
Relinking to create unique kernel... done.
.
CONGRATULATIONS! Your OpenBSD install has been successfully completed!
.
When you login to your new system the first time, please read your mail
using the 'mail' command.
.
Exit to (S)hell, (H)alt or (R)eboot? [reboot]

Com podem veure, ja tenim la última versió d'OpenBSD, que a dia de hui, 1 de juny de la era COVID-19, és la versió OpenBSD 6.7:

nova# uname -a
OpenBSD nova.joancatala.net 6.7 GENERIC#165 i386
nova#

I si ara fem una comprovació de la mida dels punts de muntatge, veurem que /var ja té molt d'espai, exactament 96.6G:

nova# df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/sd0a 986M 64.8M 872M 7% /
/dev/sd0k 7.7G 18.0K 7.4G 0% /home
/dev/sd0d 3.9G 10.0K 3.7G 0% /tmp
/dev/sd0f 5.8G 684M 4.8G 12% /usr
/dev/sd0g 986M 183M 754M 19% /usr/X11R6
/dev/sd0h 19.4G 218K 18.4G 0% /usr/local
/dev/sd0j 5.8G 2.0K 5.5G 0% /usr/obj
/dev/sd0i 1.9G 2.0K 1.8G 0% /usr/src
/dev/sd0e 96.6G 4.8M 91.8G 0% /var
nova#

I això és tot. Ja tinc preparada una màquina VMM Hypervisor OpenBSD 6.7 amb /var molt generós per als meus projectes. Ara caldrà instal·lar la versió que vullga de PHP, el servidor web Nginx, el servidor de bases de dades MariaDB i totes les utilitats que m'agraden per gestionar un servidor.

Doncs bé això és tot, espere que trobes útil aquest article i que et motive a compartir els teus trucs, els teus coneixements i els teus experiments amb el Programari Lliure. Pensa-ho, va, que la Comunitat del Programari Lliure va creixent gràcies a la documentació, el disseny, la formació o la programació, sigues part de la Comunitat :-)

La cultura i la lliure circulació de les idees és l'arma més efectiva contra les dictadures del pensament i contra la ignorància.

Utilitats

NAVEGACIÓ SENSE RATOLÍ

- Tab següent enllaç.
- Shift+Tab anterior enllaç.
- Enter activa l'enllaç.
- Alt+esquerra anar arrere.

CONTRAST DE COLORS

Accessibilitat - Color Negre
Accessibilitat - Color Groc
Accessibilitat - Color Verd

Accessibilitat - Color Blau
Accessibilitat - Color Crema
Accessibilitat - Color Blanc

 

PORTADES ALTERNATIVES