Kilka użytecznych poleceń usprawniających prace z Parallels Desktop
Wylistowanie wszystkich wirtualnych maszyn:
prlctl list -a
UUID STATUS IP_ADDR NAME
{8XXX3dd4-9f0b-406b-a5bc-XXXXXXXXXXXX} stopped - CentOS-01
{8XXXa248-def7-4f3e-8405-XXXXXXXXXXXX} stopped - CentOS-03
{eXXX4b67-f98b-4bc9-a9a8-XXXXXXXXXXXX} stopped - Mac OS X
{5XXXe2ef-786b-4873-a5aa-XXXXXXXXXXXX} suspended - Windows 8
{4XXX3137-7fb3-4ec9-a7fa-XXXXXXXXXXXX} suspended - Windows XP
Wylistowanie parametrów konkretnej maszyny:
prlctl list -i CentOS-01
Uruchomienie wirtualnej maszyny:
prlctl start CentOS-01
Wyłączenie wirtualnej maszyny:
prlctl stop CentOS-01
Użycie przełącznika --kill
wymusi zamknięcie maszyny, która nie odpowiada.
Restart:
prlctl reset CentOS-01
Przejście w stan uśpienia:
prlctl suspend CentOS-01
Suspending the VM...
The VM has been successfully suspended.
Wyjście ze stanu uśpienia:
prlctl resume CentOS-01
Wykonanie szablonu wirtualnej maszyny:
prlctl clone CentOS-01 --name CentOS --template
Clone the CentOS-01 VM to VM template CentOS...
Operation progress 88%
The VM has been successfully cloned.
Utworzenie nowej wirtualnej maszyny z wcześniej przygotowanego szablonu:
prlctl create CentOS-05 --ostemplate CentOS
Creating the VM on the basis of the CentOS template...
Clone the CentOS VM to VM CentOS-05...
Operation progress 88%
The VM has been successfully cloned.
Klonowanie, czyli stworzenie kopii istniejącej maszyny:
prlctl clone CentOS-10 --name CentOS-10-clon
Clone the CentOS-10 VM to VM CentOS-10-clon...
Operation progress 88%
The VM has been successfully cloned.
Jak już wspominałem, wykorzystując prlctl start VM_NAME
maszyna uruchomi się w tle bez GUI Parallels. Czasami jednak chcemy coś do niej podłączyć, można to zrobić również z konsoli. Wylistowanie dostępnych urządzeń USB:
prlsrvctl usb list
Apple FaceTime HD Camera (Built-in) '1a110000|05ac|8510|high|--|XXXXXX8M1XXXC8C0'
Apple Internal Memory Card Reader '1d183000|05ac|8404|high|--|0000000XXXXX'
Apple Internal Keyboard / Trackpad '1d182000|05ac|024c|full|KM|Empty'
Apple Bluetooth USB Host Controller '1d181300|05ac|821f|full|--|Empty'
Patriot Memory '1a120000|13fe|3100|high|--|07XX6XXXXX'
StoreJet Transcend '14a10000|174c|5106|super|--|S2SXXXXXX209'
Flash Disk '1a120000|090c|1000|high|--|FBXXXXXXXX000141'
Logitech Illuminated Keyboard '14200000|046d|c318|full|KM|Empty'
JTAGICE mkII '14200000|03eb|2103|full|PR|00B000XXXXXXX'
FT232R USB UART '14100000|0403|6001|full|PR|AXXXXX'
USB Flash Memory '1d110000|0930|6544|high|--|001422XXXXXXXXXX'
Apple - Composite '1d181100|05ac|820a|full|--|Empty'
Podłączenie czytnika kart SD do wirtualnej maszyny:
prlctl set CentOS-01 --device-connect "Apple Internal Memory Card Reader"
Odłączenie:
prlctl set CentOS-01 --device-disconnect "Apple Internal Memory Card Reader"
Podłączenie/odłączenie adaptera sieciowego:
prlctl set "CentOS-01" --device-connect "Apple USB Ethernet Adapter"
prlctl set "CentOS-01" --device-disconnect "Apple USB Ethernet Adapter"
Jeśli nasza maszyna korzysta z DHCP i interfejs sieciowy ma skonfigurowany w trybie bridge to niekoniecznie musimy wiedzieć jaki dostała adres kiedy korzystamy z “obcej” sieci. Oczywiście można uruchomić Parallels Desktop, dostać się do konsoli i podejrzeć. Można też wykonać polecenie na wirtualnej maszynie bez uruchamiania GUI.
prlctl exec "CentOS-01" ifconfig
W ten sposób możemy wykonywać dowolne polecenia. Innym ciekawym sposobem jest po prostu bezpośredni dostęp do konsoli:
prlctl enter Windows\ XP
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\>dir
dir
Volume in drive C has no label.
Volume Serial Number is 08BC-EDC8
Directory of C:\
10/05/2012 02:43 PM 0 AUTOEXEC.BAT
10/05/2012 02:43 PM 0 CONFIG.SYS
10/05/2012 01:43 PM <DIR> Documents and Settings
10/05/2012 02:45 PM <DIR> Program Files
10/05/2012 02:49 PM <DIR> WINDOWS
2 File(s) 0 bytes
3 Dir(s) 103,939,588,096 bytes free
C:\>
prlctl enter CentOS-01
-bash-4.1# uname -a
Linux centos-01.local 2.6.32-279.5.2.el6.x86_64 #1 SMP Fri Aug 24 01:07:11 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
-bash-4.1#
Wykonania zrzutu ekranu z wirtualnej maszyny:
prlctl capture CentOS-01 --file login_screen.png
Konwersja dysku wirtualnego do typu “plain” (zostanie wykorzystana cała przestrzeń na dysku fizycznym zadeklarowana na dysk wirtualny) z podziałem na 2GB części. Przyznam, że raczej to mało pożyteczne polecenie, może tylko ma sens kiedy nie chcemy się zaskoczyć nagłym brakiem miejsca na dysku fizycznym w związku z rozrostem dysków wirtualnych. Możliwe, że ma też wpływ na wydajność maszyn wirtualnych… być może na produkcyjnych maszynach warto ustawiać ten tryb
prl_disk_tool convert --plain --split --hdd /Users/norbert/Documents/Parallels/CentOS-01.pvm/CentOS-01-0.hdd
Np. tak wyglądał katalog dysku przed powyższą operacją, dysk był ustawiony na 100GB w trybie “expandable”, bez podziału na 2GB części
[norbert.macair: CentOS-01-0.hdd]$ ll
total 3.8G
-rw------- 1 norbert staff 0 Sep 21 01:21 CentOS-01-0.hdd
-rw------- 1 norbert staff 2.8G Sep 21 02:01 CentOS-01-0.hdd.0.{39a46e95-08c5-414c-bc03-6581f77b6dda}.hds
-rw------- 1 norbert staff 988M Oct 14 14:11 CentOS-01-0.hdd.0.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw------- 1 norbert staff 14K Oct 14 13:09 CentOS-01-0.hdd.drh
-rw------- 1 norbert staff 1.9K Sep 21 02:01 DiskDescriptor.xml
-rw------- 1 norbert staff 1.5K Sep 21 01:47 DiskDescriptor.xml.Backup
Po zabiegu, zajmujemy niepotrzebnie ponad 95GB
[norbert.macair: CentOS-01-0.hdd]$ ll
total 101G
-rw-r--r-- 1 norbert staff 0 Oct 14 14:29 CentOS-01-0.hdd
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:25 CentOS-01-0.hdd.copy.0.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:25 CentOS-01-0.hdd.copy.1.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:26 CentOS-01-0.hdd.copy.10.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:26 CentOS-01-0.hdd.copy.11.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:26 CentOS-01-0.hdd.copy.12.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:26 CentOS-01-0.hdd.copy.13.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:26 CentOS-01-0.hdd.copy.14.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:26 CentOS-01-0.hdd.copy.15.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:27 CentOS-01-0.hdd.copy.16.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:27 CentOS-01-0.hdd.copy.17.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:27 CentOS-01-0.hdd.copy.18.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:27 CentOS-01-0.hdd.copy.19.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:25 CentOS-01-0.hdd.copy.2.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:27 CentOS-01-0.hdd.copy.20.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:27 CentOS-01-0.hdd.copy.21.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:27 CentOS-01-0.hdd.copy.22.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:27 CentOS-01-0.hdd.copy.23.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:27 CentOS-01-0.hdd.copy.24.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:27 CentOS-01-0.hdd.copy.25.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:27 CentOS-01-0.hdd.copy.26.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:27 CentOS-01-0.hdd.copy.27.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:27 CentOS-01-0.hdd.copy.28.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:28 CentOS-01-0.hdd.copy.29.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:26 CentOS-01-0.hdd.copy.3.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:28 CentOS-01-0.hdd.copy.30.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:28 CentOS-01-0.hdd.copy.31.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:28 CentOS-01-0.hdd.copy.32.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:28 CentOS-01-0.hdd.copy.33.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:28 CentOS-01-0.hdd.copy.34.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:28 CentOS-01-0.hdd.copy.35.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:28 CentOS-01-0.hdd.copy.36.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:28 CentOS-01-0.hdd.copy.37.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:28 CentOS-01-0.hdd.copy.38.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:28 CentOS-01-0.hdd.copy.39.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:26 CentOS-01-0.hdd.copy.4.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:28 CentOS-01-0.hdd.copy.40.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:28 CentOS-01-0.hdd.copy.41.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:29 CentOS-01-0.hdd.copy.42.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:29 CentOS-01-0.hdd.copy.43.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:29 CentOS-01-0.hdd.copy.44.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:29 CentOS-01-0.hdd.copy.45.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:29 CentOS-01-0.hdd.copy.46.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:29 CentOS-01-0.hdd.copy.47.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:29 CentOS-01-0.hdd.copy.48.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:29 CentOS-01-0.hdd.copy.49.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:26 CentOS-01-0.hdd.copy.5.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:29 CentOS-01-0.hdd.copy.50.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:29 CentOS-01-0.hdd.copy.51.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 1.1G Oct 14 14:29 CentOS-01-0.hdd.copy.52.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:26 CentOS-01-0.hdd.copy.6.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:26 CentOS-01-0.hdd.copy.7.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:26 CentOS-01-0.hdd.copy.8.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-r--r-- 1 norbert staff 2.0G Oct 14 14:26 CentOS-01-0.hdd.copy.9.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
-rw-rw-rw- 1 norbert staff 0 Oct 14 14:20 CentOS-01-0.hdd.copy.hdd
-rw-r--r-- 1 norbert staff 21K Oct 14 14:25 DiskDescriptor.xml
-rw-r--r-- 1 norbert staff 21K Oct 14 14:25 DiskDescriptor.xml.Backup
Powrót do dysku w trybie “expandable”:
prl_disk_tool convert --expanding --split --hdd /Users/norbert/Documents/Parallels/CentOS-01.pvm/CentOS-01-0.hdd
Mała uwaga, u mnie zabawa w konwersje zakończyła się komunikatem:
Not enough free space on the physical disk to complete the operation.
Dlatego warto się upewnić, że kiedy dysk nam “spuchnie” to będziemy mieć drugie tyle miejsca na jego odchudzanie albo pod ręką jakiś w miarę szybki dysk na którym będzie można tą operację wykonać
Rozszerzenie wirtualnego dysku:
prl_disk_tool resize --size 105G --split --hdd /Users/norbert/Documents/Parallels/CentOS-01.pvm/CentOS-01-0.hdd
Powyższe polecenie nie zawsze zwiększy od razu przestrzeń dostępną w wirtualnej maszynie, w zależności od systemu jaki na niej jest może być konieczne użycie narzędzi dyskowych systemu gościa. Dlatego najlepiej od razu definiować całkiem duży dysk w trybie “expandable” z podziałem dysku wirtualnego na 2GB części.