I want to create a linux vm by the Virtualization framework on mac.And There are disk configure i should set. my code
VZDiskImageStorageDeviceAttachment *disc_sda = [[VZDiskImageStorageDeviceAttachment alloc]
initWithURL:discURL
readOnly:dinfo[i].readOnly error:nil];
if (disc_sda) {
VZVirtioBlockDeviceConfiguration *disc_conf = [[VZVirtioBlockDeviceConfiguration alloc]
initWithAttachment:disc_sda];
discs = [discs arrayByAddingObject:disc_conf];
} else {
NSLog(@"--- Couldn't open disc%d at %@ (URL %@)\n", i, disc_path, discURL);
}
The value of param discUrl is /dev/disk6
.the info of the device.
diskutil info /dev/disk6
Device Identifier: disk6
Device Node: /dev/disk6
Whole: Yes
Part of Whole: disk6
Device / Media Name: ZVOL matpool/fromBin
Volume Name: Not applicable (no file system)
Mounted: Not applicable (no file system)
File System: None
Content (IOContent): GUID_partition_scheme
OS Can Be Installed: No
Media Type: Generic
Protocol: Disk Image
SMART Status: Not Supported
Disk Size: 10.7 GB (10737418240 Bytes) (exactly 20971520 512-Byte-Units)
Device Block Size: 512 Bytes
Media OS Use Only: No
Media Read-Only: No
Volume Read-Only: Not applicable (no file system)
Device Location: External
Removable Media: Fixed
Solid State: Yes
Virtual: Yes
and i put data to the disk from data.raw.If the discUrl is data.raw, the vm will create successfully.
sudo dd if=/Users/zhangkeli/Downloads/data.raw of=/dev/disk6
but the follow info will be shown while i create the vm by the disk.
Loading, please wait...
Starting version 245.4-4ubuntu3.17
[ 1.160420] virtio_blk virtio2: [vda] 0 512-byte logical blocks (0 B/0 B)
[ 1.176709] cryptd: max_cpu_qlen set to 1000
[ 1.212226] AVX version of gcm_enc/dec engaged.
[ 1.212414] AES CTR mode by8 optimization enabled
[ 1.233134] virtio_net virtio0 enp0s1: renamed from eth0
[ 1.764724] tsc: Refined TSC clocksource calibration: 2304.011 MHz
[ 1.765456] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x21360249f5a, max_idle_ns: 440795291588 ns
[ 1.766393] clocksource: Switched to clocksource tsc
Begin: Loading essential drivers ... [ 2.424787] raid6: sse2x4 gen() 17701 MB/s
[ 2.472679] raid6: sse2x4 xor() 11138 MB/s
[ 2.520689] raid6: sse2x2 gen() 16157 MB/s
[ 2.568793] raid6: sse2x2 xor() 9438 MB/s
[ 2.616876] raid6: sse2x1 gen() 11038 MB/s
[ 2.664726] raid6: sse2x1 xor() 9349 MB/s
[ 2.664979] raid6: using algorithm sse2x4 gen() 17701 MB/s
[ 2.665083] raid6: .... xor() 11138 MB/s, rmw enabled
[ 2.665253] raid6: using ssse3x2 recovery algorithm
[ 2.666442] xor: automatically using best checksumming function avx
[ 2.667482] async_tx: api initialized (async)
done.
Begin: Running /scripts/init-premount ... done.
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done.
Begin: Running /scripts/local-premount ... [ 2.710909] Btrfs loaded, crc32c=crc32c-intel
Scanning for Btrfs filesystems
done.
... some info
mdadm: No devices listed in conf file were found.
mdadm: No devices listed in conf file were found.
mdadm: error opening /dev/md?*: No such file or directory
mdadm: No devices listed in conf file were found.
mdadm: No devices listed in conf file were found.
mdadm: No devices listed in conf file were found.
mdadm: No devices listed in conf file were found.
mdadm: No devices listed in conf file were found.
mdadm: No devices listed in conf file were found.
mdadm: No devices listed in conf file were found.
mdadm: No devices listed in conf file were found.
mdadm: No devices listed in conf file were found.
mdadm: No devices listed in conf file were found.
mdadm: No devices listed in conf file were found.
done.
Gave up waiting for root file system device. Common problems:
- Boot args (cat /proc/cmdline)
- Check rootdelay= (did the system wait long enough?)
- Missing modules (cat /proc/modules; ls /dev)
ALERT! /dev/vda does not exist. Dropping to a shell!
BusyBox v1.30.1 (Ubuntu 1:1.30.1-4ubuntu6.4) built-in shell (ash)
Enter 'help' for a list of built-in commands.
So i have a question, how can i use the disk? Thank you for you reply.