要编辑一个image,则运行下面的命令 guestfish -a ubuntutest.img > 会弹出一个命令行工具 运行run > run 我们来ps一下进程 root# ps aux | grep guestroot     11697  0.0  0.0  96216  4604 pts/0    S+   02:14   0:00 guestfish -a ubuntutest.imgroot     11832  7.0  0.1 1912136 99384 pts/0   Sl   02:14   0:02 /usr/bin/qemu-system-x86_64 -global virtio-blk-pci.scsi=off -nodefconfig -enable-fips -nodefaults -nographic -machine accel=kvm:tcg -m 500 -no-reboot -rtc driftfix=slew -no-hpet -no-kvm-pit-reinjection -kernel /var/tmp/.guestfs-0/kernel.11697 -initrd /var/tmp/.guestfs-0/initrd.11697 -device virtio-scsi-pci,id=scsi -drive file=ubuntutest.img,cache=writeback,id=hd0,if=none -device scsi-hd,drive=hd0 -drive file=/var/tmp/.guestfs-0/root.11697,snapshot=on,id=appliance,cache=unsafe,if=none -device scsi-hd,drive=appliance -device virtio-serial-pci -serial stdio -device sga -chardev socket,path=/tmp/libguestfsi7ht7F/guestfsd.sock,id=channel0 -device virtserialport,chardev=channel0,name=org.libguestfs.channel.0 -append panic=1 console=ttyS0 udevtimeout=600 no_timer_check acpi=off printk.time=1 cgroup_disable=memory root=/dev/sdb selinux=0 TERM=linuxroot     11833  0.0  0.0  96212  1300 pts/0    S    02:14   0:00 guestfish -a ubuntutest.img 由此看出libguestfs的架构   guestfish -a ubuntutest.img启动的进程,也即那个交互命令行是main program,当运行run的时候,会创建一个child process,在child process中,qemu运行一个称为appliance的小的虚拟机。创建子进程是由guestfs_launch函数完成的。 在appliance中,运行了linux kernel和一系列用户空间的工具(LVM, ext2等),以及一个后台进程guestfsd。 main process中的libguestfs和这个guestfd通过RPC进行交互。 由child process的kernel来操作disk image Normally when you run libguestfs on a disk image, we launch a qemu process running a small custom appliance. Inside the appliance is a Linux kernel, Linux userspace tools (like mkfs, parted, LVM), and a daemon called guestfsd. By the way, it’s a common mistake for people to think that the qemu process is the virtual machine. It’s not the VM. It’s a custom, minimal appliance containing our own tools, and the VM is not running. Although we used fork to run qemu, we don’t talk to the daemon over stdin/stdout. We use a fast virtio-serial port instead. Across the virtio-serial port, we send simple commands using an efficient XDR-based remote protocol. Many libguestfs API functions directly map to remote procedure calls in this protocol. For example, calling guestfs_mkfs in the library, translates to a mkfs remote procedure call over the virtio-serial port, and ultimately guestfsd runs the mkfs command inside the appliance. libguestfs是一个C的library, 你可以写一个C的程序,将这个类库加载进去,调用它的API。文档http://libguestfs.org/guestfs.3.html就描述了这些C的API。 而guestfish是一个交互命令行,可以通过执行命令,他来调用C类库的API,帮我们完成操作。文档http://libguestfs.org/guestfish.1.html描述了这些命令,几乎所有的API,都有对应的命令。 APPLIANCE BOOT PROCESS In order to follow the stages involved below, enable libguestfs debugging (set the environment variable LIBGUESTFS_DEBUG=1). export LIBGUESTFS_DEBUG=1 guestfish -a ubuntutest.img 然后在里面运行run,打印出了很多的log,可以显示下面的过程 Create the appliance supermin --build is invoked to create the kernel, a small initrd and the appliance. The appliance is cached in /var/tmp/.guestfs- (or in another directory if LIBGUESTFS_CACHEDIR or TMPDIR are set). For a complete description of how the appliance is created and cached, read the supermin(1) man page. Start qemu and boot the kernel qemu is invoked to boot the kernel. Run the initrd supermin --build builds a small initrd. The initrd is not the appliance. The purpose of the initrd is to load enough kernel modules in order that the appliance itself can be mounted and started. The initrd is a cpio archive called /var/tmp/.guestfs-/appliance.d/initrd. When the initrd has started you will see messages showing that kernel modules are being loaded, similar to this: supermin: ext2 mini initrd starting up

supermin: mounting /sys

supermin: internal insmod libcrc32c.ko

supermin: internal insmod crc32c-intel.ko

Find and mount the appliance device

The appliance is a sparse file containing an ext2 filesystem which contains a familiar (although reduced in size) Linux operating system. It would normally be called /var/tmp/.guestfs-/appliance.d/root.

The regular disks being inspected by libguestfs are the first devices exposed by qemu (eg. as /dev/vda).

The last disk added to qemu is the appliance itself (eg. /dev/vdb if there was only one regular disk).

Thus the final job of the initrd is to locate the appliance disk, mount it, and switch root into the appliance, and run /init from the appliance.

If this works successfully you will see messages such as: supermin: picked /sys/block/vdb/dev as root device

supermin: creating /dev/root as block special 252:16

supermin: mounting new root on /root

supermin: chroot

Starting /init script ...

Note that Starting /init script ... indicates that the appliance's init script is now running.

Initialize the appliance

The appliance itself now initializes itself. This involves starting certain processes like udev, possibly printing some debug information, and finally running the daemon (guestfsd).

The daemon

Finally the daemon (guestfsd) runs inside the appliance. If it runs you should see: verbose daemon enabled

The daemon expects to see a named virtio-serial port exposed by qemu and connected on the other end to the library.

The daemon connects to this port (and hence to the library) and sends a four byte message GUESTFS_LAUNCH_FLAG, which initiates the communication protocol (see below).

root:# export LIBGUESTFS_DEBUG=1root:# guestfish -a ubuntutest.imglibguestfs: create: flags = 0, handle = 0x1942830, program = guestfish

Welcome to guestfish, the guest filesystem shell forediting virtual machine filesystems and disk images.

Type: 'help' for help on commands      'man' to read the manual      'quit' to quit the shell

> run

#启动guestfish

libguestfs: launch: program=guestfishlibguestfs: launch: version=1.24.5libguestfs: launch: backend registered: unixlibguestfs: launch: backend registered: umllibguestfs: launch: backend registered: libvirtlibguestfs: launch: backend registered: directlibguestfs: launch: backend=directlibguestfs: launch: tmpdir=/tmp/libguestfsg4qzERlibguestfs: launch: umask=0022libguestfs: launch: euid=0

#run supermin

libguestfs: command: run: /usr/bin/supermin-helperlibguestfs: command: run: \ --verboselibguestfs: command: run: \ -f checksumlibguestfs: command: run: \ --host-cpu x86_64libguestfs: command: run: \ /usr/lib/guestfs/supermin.dsupermin helper [00000ms] whitelist = (not specified)supermin helper [00000ms] host_cpu = x86_64supermin helper [00000ms] dtb_wildcard = (not specified)supermin helper [00000ms] inputs:supermin helper [00000ms] inputs[0] = /usr/lib/guestfs/supermin.dsupermin helper [00000ms] outputs:supermin helper [00000ms] kernel = (none)supermin helper [00000ms] dtb = (none)supermin helper [00000ms] initrd = (none)supermin helper [00000ms] appliance = (none)

#选择kernel

checking modpath /lib/modules/3.13.0-27-generic is a directorychecking modpath /lib/modules/3.13.0-24-generic is a directorychecking modpath /lib/modules/3.13.0-27-generic is a directorychecking modpath /lib/modules/3.13.0-24-generic is a directorypicked kernel vmlinuz-3.13.0-27-generic.efi.signedsupermin helper [00000ms] finished creating kernel

#选择initrd, root images, 创建appliance

supermin helper [00000ms] visiting /usr/lib/guestfs/supermin.dsupermin helper [00000ms] visiting /usr/lib/guestfs/supermin.d/base.imgsupermin helper [00000ms] visiting /usr/lib/guestfs/supermin.d/daemon.img.gzsupermin helper [00000ms] visiting /usr/lib/guestfs/supermin.d/hostfilessupermin helper [00015ms] visiting /usr/lib/guestfs/supermin.d/init.imgsupermin helper [00015ms] visiting /usr/lib/guestfs/supermin.d/udev-rules.imgsupermin helper [00015ms] adding kernel modulessupermin helper [00067ms] finished creating appliancelibguestfs: checksum of existing appliance: ba13dfd651367e8d7658388ecf86813d4f57285b5edd09daea04961ced636040

#检测qemu

libguestfs: [00071ms] begin testing qemu featureslibguestfs: command: run: /usr/bin/qemu-system-x86_64libguestfs: command: run: \ -nographiclibguestfs: command: run: \ -helplibguestfs: command: run: /usr/bin/qemu-system-x86_64libguestfs: command: run: \ -nographiclibguestfs: command: run: \ -versionlibguestfs: qemu version 2.0libguestfs: command: run: /usr/bin/qemu-system-x86_64libguestfs: command: run: \ -nographiclibguestfs: command: run: \ -machine accel=kvm:tcglibguestfs: command: run: \ -device ?libguestfs: [00122ms] finished testing qemu features

#启动qemu appliance

[00123ms] /usr/bin/qemu-system-x86_64 \    -global virtio-blk-pci.scsi=off \    -nodefconfig \    -enable-fips \    -nodefaults \    -nographic \    -machine accel=kvm:tcg \    -m 500 \    -no-reboot \    -rtc driftfix=slew \    -no-hpet \    -no-kvm-pit-reinjection \

#appliance缓存在/var/tmp/.guestfs-

    -kernel /var/tmp/.guestfs-0/kernel.8754 \    -initrd /var/tmp/.guestfs-0/initrd.8754 \    -device virtio-scsi-pci,id=scsi \

#你的image是第一个disk

    -drive file=ubuntutest.img,cache=writeback,id=hd0,if=none \    -device scsi-hd,drive=hd0 \

#第二个是appliance的disk

    -drive file=/var/tmp/.guestfs-0/root.8754,snapshot=on,id=appliance,cache=unsafe,if=none \    -device scsi-hd,drive=appliance \

    -device virtio-serial-pci \    -serial stdio \    -device sga \    -chardev socket,path=/tmp/libguestfsg4qzER/guestfsd.sock,id=channel0 \    -device virtserialport,chardev=channel0,name=org.libguestfs.channel.0 \    -append 'panic=1 console=ttyS0 udevtimeout=600 no_timer_check acpi=off printk.time=1 cgroup_disable=memory root=/dev/sdb selinux=0 guestfs_verbose=1 TERM=linux'Warning: option deprecated, use lost_tick_policy property of kvm-pit instead.Could not open option rom 'sgabios.bin': No such file or directory[    0.000000] Initializing cgroup subsys cpuset[    0.000000] Initializing cgroup subsys cpu[    0.000000] Initializing cgroup subsys cpuacct[    0.000000] Linux version 3.13.0-27-generic (buildd@akateko) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #50-Ubuntu SMP Thu May 15 18:06:16 UTC 2014 (Ubuntu 3.13.0-27.50-generic 3.13.11)[    0.000000] Command line: panic=1 console=ttyS0 udevtimeout=600 no_timer_check acpi=off printk.time=1 cgroup_disable=memory root=/dev/sdb selinux=0 guestfs_verbose=1 TERM=linux[    0.000000] KERNEL supported cpus:[    0.000000]   Intel GenuineIntel[    0.000000]   AMD AuthenticAMD[    0.000000]   Centaur CentaurHauls[    0.000000] e820: BIOS-provided physical RAM map:[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable[    0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved[    0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000001f3fdfff] usable[    0.000000] BIOS-e820: [mem 0x000000001f3fe000-0x000000001f3fffff] reserved[    0.000000] BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff] reserved[    0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved[    0.000000] NX (Execute Disable) protection: active[    0.000000] SMBIOS 2.4 present.[    0.000000] Hypervisor detected: KVM[    0.000000] No AGP bridge found[    0.000000] e820: last_pfn = 0x1f3fe max_arch_pfn = 0x400000000[    0.000000] PAT not supported by CPU.[    0.000000] found SMP MP-table at [mem 0x000f0b60-0x000f0b6f] mapped at [ffff8800000f0b60][    0.000000] Scanning 1 areas for low memory corruption[    0.000000] init_memory_mapping: [mem 0x00000000-0x000fffff][    0.000000] init_memory_mapping: [mem 0x1f000000-0x1f1fffff][    0.000000] init_memory_mapping: [mem 0x1c000000-0x1effffff][    0.000000] init_memory_mapping: [mem 0x00100000-0x1bffffff][    0.000000] init_memory_mapping: [mem 0x1f200000-0x1f3fdfff][    0.000000] RAMDISK: [mem 0x1f27c000-0x1f3eefff][    0.000000] No NUMA configuration found[    0.000000] Faking a node at [mem 0x0000000000000000-0x000000001f3fdfff][    0.000000] Initmem setup node 0 [mem 0x00000000-0x1f3fdfff][    0.000000]   NODE_DATA [mem 0x1f3f9000-0x1f3fdfff][    0.000000] kvm-clock: Using msrs 4b564d01 and 4b564d00[    0.000000] kvm-clock: cpu 0, msr 0:1f3f5001, boot clock[    0.000000] Zone ranges:[    0.000000]   DMA      [mem 0x00001000-0x00ffffff][    0.000000]   DMA32    [mem 0x01000000-0xffffffff][    0.000000]   Normal   empty[    0.000000] Movable zone start for each node[    0.000000] Early memory node ranges[    0.000000]   node   0: [mem 0x00001000-0x0009efff][    0.000000]   node   0: [mem 0x00100000-0x1f3fdfff][    0.000000] SFI: Simple Firmware Interface v0.81 http://simplefirmware.org[    0.000000] Intel MultiProcessor Specification v1.4[    0.000000] MPTABLE: OEM ID: BOCHSCPU[    0.000000] MPTABLE: Product ID: 0.1         [    0.000000] MPTABLE: APIC at: 0xFEE00000[    0.000000] Processor #0 (Bootup-CPU)[    0.000000] IOAPIC[0]: apic_id 0, version 17, address 0xfec00000, GSI 0-23[    0.000000] Processors: 1[    0.000000] smpboot: Allowing 1 CPUs, 0 hotplug CPUs[    0.000000] PM: Registered nosave memory: [mem 0x0009f000-0x0009ffff][    0.000000] PM: Registered nosave memory: [mem 0x000a0000-0x000effff][    0.000000] PM: Registered nosave memory: [mem 0x000f0000-0x000fffff][    0.000000] e820: [mem 0x1f400000-0xfeffbfff] available for PCI devices[    0.000000] Booting paravirtualized kernel on KVM[    0.000000] setup_percpu: NR_CPUS:256 nr_cpumask_bits:256 nr_cpu_ids:1 nr_node_ids:1[    0.000000] PERCPU: Embedded 29 pages/cpu @ffff88001f000000 s86336 r8192 d24256 u2097152[    0.000000] kvm-clock: cpu 0, msr 0:1f3f5001, primary cpu clock[    0.000000] KVM setup async PF for cpu 0[    0.000000] kvm-stealtime: cpu 0, msr 1f00dfc0[    0.000000] Built 1 zonelists in Node order, mobility grouping on.  Total pages: 125879[    0.000000] Policy zone: DMA32[    0.000000] Kernel command line: panic=1 console=ttyS0 udevtimeout=600 no_timer_check acpi=off printk.time=1 cgroup_disable=memory root=/dev/sdb selinux=0 guestfs_verbose=1 TERM=linux[    0.000000] Disabling memory control group subsystem[    0.000000] PID hash table entries: 2048 (order: 2, 16384 bytes)[    0.000000] Checking aperture...[    0.000000] No AGP bridge found[    0.000000] Memory: 485188K/511600K available (7354K kernel code, 1142K rwdata, 3396K rodata, 1332K init, 1440K bss, 26412K reserved)[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1[    0.000000] Hierarchical RCU implementation.[    0.000000] \tRCU dyntick-idle grace-period acceleration is enabled.[    0.000000] \tRCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=1.[    0.000000] \tOffload RCU callbacks from all CPUs[    0.000000] \tOffload RCU callbacks from CPUs: 0.[    0.000000] NR_IRQS:16640 nr_irqs:256 16[    0.000000] Console: colour *CGA 80x25[    0.000000] console [ttyS0] enabled[    0.000000] tsc: Detected 2793.268 MHz processor[    0.008000] Calibrating delay loop (skipped) preset value.. 5586.53 BogoMIPS (lpj=11173072)[    0.008000] pid_max: default: 32768 minimum: 301[    0.008000] Security Framework initialized[    0.008000] AppArmor: AppArmor initialized[    0.008000] Yama: becoming mindful.[    0.008000] Dentry cache hash table entries: 65536 (order: 7, 524288 bytes)[    0.008118] Inode-cache hash table entries: 32768 (order: 6, 262144 bytes)[    0.008946] Mount-cache hash table entries: 1024 (order: 1, 8192 bytes)[    0.009692] Mountpoint-cache hash table entries: 1024 (order: 1, 8192 bytes)[    0.010610] Initializing cgroup subsys memory[    0.011117] Initializing cgroup subsys devices[    0.011624] Initializing cgroup subsys freezer[    0.012005] Initializing cgroup subsys blkio[    0.012490] Initializing cgroup subsys perf_event[    0.013021] Initializing cgroup subsys hugetlb[    0.013589] mce: CPU supports 10 MCE banks[    0.014100] Last level iTLB entries: 4KB 0, 2MB 0, 4MB 0[    0.014100] Last level dTLB entries: 4KB 0, 2MB 0, 4MB 0[    0.014100] tlb_flushall_shift: 6[    0.029713] Freeing SMP alternatives memory: 32K (ffffffff81e6c000 - ffffffff81e74000)[    0.034709] ftrace: allocating 28458 entries in 112 pages[    0.044235] Enabling x2apic[    0.044571] Enabled x2apic[    0.045055] Switched APIC routing to physical x2apic.[    0.048310] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1[    0.048977] smpboot: CPU0: Intel QEMU Virtual CPU version 2.0.0 (fam: 06, model: 06, stepping: 03)[    0.161682] Performance Events: Broken PMU hardware detected, using software events only.[    0.162753] Failed to access perfctr msr (MSR c1 is 0)[    0.164616] x86: Booted up 1 node, 1 CPUs[    0.165077] smpboot: Total of 1 processors activated (5586.53 BogoMIPS)[    0.166059] NMI watchdog: disabled (cpu0): hardware events not enabled[    0.166856] devtmpfs: initialized[    0.169739] EVM: security.selinux[    0.170125] EVM: security.SMACK64[    0.170496] EVM: security.ima[    0.170830] EVM: security.capability[    0.171949] pinctrl core: initialized pinctrl subsystem[    0.172052] regulator-dummy: no parameters[    0.172580] RTC time:  8:07:48, date: 07/09/14[    0.173102] NET: Registered protocol family 16[    0.173698] cpuidle: using governor ladder[    0.174163] cpuidle: using governor menu[    0.174736] PCI: Using configuration type 1 for base access[    0.176549] bio: create slab at 0[    0.177093] ACPI: Interpreter disabled.[    0.177580] vgaarb: loaded[    0.178011] SCSI subsystem initialized[    0.178490] usbcore: registered new interface driver usbfs[    0.179114] usbcore: registered new interface driver hub[    0.179720] usbcore: registered new device driver usb[    0.180068] PCI: Probing PCI hardware[    0.180507] PCI host bridge to bus 0000:00[    0.180970] pci_bus 0000:00: root bus resource [io  0x0000-0xffff][    0.181650] pci_bus 0000:00: root bus resource [mem 0x00000000-0xffffffffff][    0.182422] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff][    0.187606] pci 0000:00:01.3: quirk: [io  0xb000-0xb03f] claimed by PIIX4 ACPI[    0.188011] pci 0000:00:01.3: quirk: [io  0xb100-0xb10f] claimed by PIIX4 SMB[    0.200378] pci 0000:00:01.0: PIIX/ICH IRQ router [8086:7000][    0.201167] NetLabel: Initializing[    0.201555] NetLabel:  domain hash size = 128[    0.202036] NetLabel:  protocols = UNLABELED CIPSOv4[    0.202593] NetLabel:  unlabeled traffic allowed by default[    0.203274] Switched to clocksource kvm-clock[    0.203774] AppArmor: AppArmor Filesystem Enabled[    0.204314] pnp: PnP ACPI: disabled[    0.205622] NET: Registered protocol family 2[    0.206219] TCP established hash table entries: 4096 (order: 3, 32768 bytes)[    0.207011] TCP bind hash table entries: 4096 (order: 4, 65536 bytes)[    0.207741] TCP: Hash tables configured (established 4096 bind 4096)[    0.208467] TCP: reno registered[    0.208832] UDP hash table entries: 256 (order: 1, 8192 bytes)[    0.209475] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)[    0.210196] NET: Registered protocol family 1[    0.210691] pci 0000:00:00.0: Limiting direct PCI/PCI transfers[    0.211351] pci 0000:00:01.0: PIIX3: Enabling Passive Release[    0.211995] pci 0000:00:01.0: Activating ISA DMA hang workarounds[    0.212761] Trying to unpack rootfs image as initramfs...[    0.214277] Freeing initrd memory: 1484K (ffff88001f27c000 - ffff88001f3ef000)[    0.215132] platform rtc_cmos: registered platform RTC device (no PNP device found)[    0.216041] microcode: CPU0 sig=0x663, pf=0x1, revision=0x1[    0.216698] microcode: Microcode Update Driver: v2.00 , Peter Oruba[    0.217661] Scanning for low memory corruption every 60 seconds[    0.218429] Initialise system trusted keyring[    0.218955] audit: initializing netlink socket (disabled)[    0.219555] type=2000 audit(1404893268.160:1): initialized[    0.242451] HugeTLB registered 2 MB page size, pre-allocated 0 pages[    0.243814] zbud: loaded[    0.244223] VFS: Disk quotas dquot_6.5.2[    0.244700] Dquot-cache hash table entries: 512 (order 0, 4096 bytes)[    0.245699] fuse init (API version 7.22)[    0.246191] msgmni has been set to 950[    0.246653] Key type big_key registered[    0.247246] Key type asymmetric registered[    0.247713] Asymmetric key parser 'x509' registered[    0.248296] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)[    0.249141] io scheduler noop registered[    0.249585] io scheduler deadline registered (default)[    0.250169] io scheduler cfq registered[    0.250643] pci_hotplug: PCI Hot Plug PCI Core version: 0.5[    0.251272] pciehp: PCI Express Hot Plug Controller Driver version: 0.4[    0.252062] ipmi message handler version 39.2[    0.252697] virtio-pci 0000:00:02.0: PCI->APIC IRQ transform: INT A -> IRQ 34[    0.254858] virtio-pci 0000:00:03.0: PCI->APIC IRQ transform: INT A -> IRQ 35[    0.256171] Serial: 8250/16550 driver, 32 ports, IRQ sharing enabled[    0.284494] serial8250: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A[    0.311767] Linux agpgart interface v0.103[    0.312994] brd: module loaded[    0.313708] loop: module loaded[    0.314926] scsi0 : ata_piix[    0.315303] scsi1 : ata_piix[    0.315654] ata1: PATA max MWDMA2 cmd 0x1f0 ctl 0x3f6 bmdma 0xc060 irq 14[    0.316421] ata2: PATA max MWDMA2 cmd 0x170 ctl 0x376 bmdma 0xc068 irq 15[    0.317368] libphy: Fixed MDIO Bus: probed[    0.317894] tun: Universal TUN/TAP device driver, 1.6[    0.318457] tun: (C) 1999-2004 Max Krasnyansky [    0.319356] PPP generic driver version 2.4.2[    0.320053] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver[    0.320785] ehci-pci: EHCI PCI platform driver[    0.321288] ehci-platform: EHCI generic platform driver[    0.321872] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver[    0.322556] ohci-pci: OHCI PCI platform driver[    0.323055] ohci-platform: OHCI generic platform driver[    0.323637] uhci_hcd: USB Universal Host Controller Interface driver[    0.324372] i8042: PNP: No PS/2 controller found. Probing ports directly.[    0.325742] serio: i8042 KBD port at 0x60,0x64 irq 1[    0.326298] serio: i8042 AUX port at 0x60,0x64 irq 12[    0.326900] mousedev: PS/2 mouse device common for all mice[    0.327755] rtc_cmos rtc_cmos: rtc core: registered rtc_cmos as rtc0[    0.328551] rtc_cmos rtc_cmos: alarms up to one day, 114 bytes nvram[    0.329314] device-mapper: uevent: version 1.0.3[    0.329874] device-mapper: ioctl: 4.27.0-ioctl (2013-10-30) initialised: dm-devel@redhat.com[    0.330809] ledtrig-cpu: registered to indicate activity on CPUs[    0.331545] TCP: cubic registered[    0.331979] NET: Registered protocol family 10[    0.332614] NET: Registered protocol family 17[    0.333125] Key type dns_resolver registered[    0.333719] Loading compiled-in X.509 certificates[    0.334978] Loaded X.509 cert 'Magrathea: Glacier signing key: 23984ac203784325ccf7b95b51f6c119380eb933'[    0.336371] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input0[    0.337357] registered taskstats version 1[    0.338216] Key type trusted registered[    0.338730] Key type encrypted registered[    0.339446] AppArmor: AppArmor sha1 policy hashing enabled[    0.340077] IMA: No TPM chip found, activating TPM-bypass![    0.340812] regulator-dummy: incomplete constraints, leaving on[    0.341506]   Magic number: 6:592:118[    0.341995] rtc_cmos rtc_cmos: setting system clock to 2014-07-09 08:07:48 UTC (1404893268)[    0.342934] BIOS EDD facility v0.16 2004-Jun-25, 0 devices found[    0.343602] EDD information not available.[    0.477905] Freeing unused kernel memory: 1332K (ffffffff81d1f000 - ffffffff81e6c000)[    0.479944] Write protecting the kernel read-only data: 12288k[    0.482579] Freeing unused kernel memory: 828K (ffff880001731000 - ffff880001800000)[    0.484862] Freeing unused kernel memory: 700K (ffff880001b51000 - ffff880001c00000)

#启动initrd

supermin: mounting /procsupermin: uptime: 0.48 0.17supermin: ext2 mini initrd starting up: 4.1.6 zlib xzsupermin: cmdline: panic=1 console=ttyS0 udevtimeout=600 no_timer_check acpi=off printk.time=1 cgroup_disable=memory root=/dev/sdb selinux=0 guestfs_verbose=1 TERM=linuxsupermin: mounting /sys

#load kernel modules

supermin: internal insmod megaraid_mm.ko[    0.489773] megaraid cmm: 2.20.2.7 (Release Date: Sun Jul 16 00:01:03 EST 2006)supermin: internal insmod megaraid_mbox.ko[    0.492225] megaraid: 2.20.5.1 (Release Date: Thu Nov 16 15:32:35 EST 2006)supermin: internal insmod megaraid_sas.ko[    0.495378] megasas: 06.700.06.00-rc1 Sat. Aug. 31 17:00:00 PDT 2013supermin: internal insmod megaraid.kosupermin: internal insmod libcrc32c.kosupermin: internal insmod crc32-pclmul.ko[    0.500109] PCLMULQDQ-NI instructions are not detected.insmod: init_module: crc32-pclmul.ko: No such devicesupermin: internal insmod crct10dif-pclmul.koinsmod: init_module: crct10dif-pclmul.ko: No such devicesupermin: internal insmod crc-itu-t.kosupermin: internal insmod crc32.kosupermin: internal insmod crc-ccitt.kosupermin: internal insmod crc7.kosupermin: internal insmod crc8.kosupermin: internal insmod sym53c8xx.kosupermin: internal insmod ideapad_slidebar.ko[    0.511759] ideapad_slidebar: DMI does not matchinsmod: init_module: ideapad_slidebar.ko: No such devicesupermin: internal insmod sparse-keymap.kosupermin: internal insmod ideapad-laptop.kosupermin: internal insmod virtio-rng.kosupermin: internal insmod virtio_scsi.ko

#mount sda, sdb

[    0.518386] scsi2 : Virtio SCSI HBA[    0.520458] scsi 2:0:0:0: Direct-Access     QEMU     QEMU HARDDISK    2.0. PQ: 0 ANSI: 5[    0.521481] scsi 2:0:1:0: Direct-Access     QEMU     QEMU HARDDISK    2.0. PQ: 0 ANSI: 5[    0.538823] sd 2:0:0:0: Attached scsi generic sg0 type 0[    0.539535] sd 2:0:0:0: [sda] 10485760 512-byte logical blocks: (5.36 GB/5.00 GiB)[    0.540778] sd 2:0:0:0: [sda] Write Protect is off[    0.541524] sd 2:0:1:0: [sdb] 8388608 512-byte logical blocks: (4.29 GB/4.00 GiB)[    0.542557] sd 2:0:1:0: Attached scsi generic sg1 type 0[    0.543334] sd 2:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA[    0.544821] sd 2:0:1:0: [sdb] Write Protect is off[    0.545592] sd 2:0:1:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA[    0.547407]  sda: sda1 sda2 < sda5 >[    0.548353]  sdb: unknown partition table[    0.549137] sd 2:0:0:0: [sda] Attached SCSI disk[    0.550043] sd 2:0:1:0: [sdb] Attached SCSI disk

#将sdb作为root device

supermin: picked /sys/block/sdb/dev as root devicesupermin: creating /dev/root as block special 8:16supermin: mounting new root on /root[    0.552368] EXT4-fs (sdb): mounting ext2 file system using the ext4 subsystem[    0.554670] EXT4-fs (sdb): mounted filesystem without journal. Opts: supermin: chroot

#运行init

Starting /init script ...[    0.601208] systemd-udevd[83]: starting version 204[    0.626557] ACPI Exception: AE_BAD_PARAMETER, Thread 489390080 could not acquire Mutex [0x1] (20131115/utmutex-285)[    0.627882] piix4_smbus 0000:00:01.3: SMBus Host Controller at 0xb100, revision 0[    0.655881] device-mapper: multipath: version 1.6.0 loaded/init: 63: /init: systemd-tmpfiles: not found/init: 69: /init: cannot create /sys/block/{h,s,ub,v}d*/queue/scheduler: Directory nonexistentCannot find device "eth0"Cannot find device "eth0"RTNETLINK answers: Network is unreachablemdadm: No arrays found in config file or automatically/init: 90: /init: lvmetad: not found[    0.931219] random: lvm urandom read with 69 bits of entropy available  Reading all physical volumes.  This may take a while...  No volume groups found  No volume groups found/init: 96: /init: ldmtool: not foundLinux (none) 3.13.0-27-generic #50-Ubuntu SMP Thu May 15 18:06:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux/dev:total 0crw------- 1 0 0  10, 235 Jul  9 08:07 autofsdrwxr-xr-x 2 0 0      620 Jul  9 08:07 blockdrwxr-xr-x 2 0 0       80 Jul  9 08:07 bsgcrw------- 1 0 0  10, 234 Jul  9 08:07 btrfs-controldrwxr-xr-x 2 0 0     2800 Jul  9 08:07 charcrw------- 1 0 0   5,   1 Jul  9 08:07 consolelrwxrwxrwx 1 0 0       11 Jul  9 08:07 core -> /proc/kcoredrwxr-xr-x 2 0 0       60 Jul  9 08:07 cpucrw------- 1 0 0  10,  60 Jul  9 08:07 cpu_dma_latencycrw------- 1 0 0  10, 203 Jul  9 08:07 cusedrwxr-xr-x 5 0 0      100 Jul  9 08:07 diskcrw------- 1 0 0  10,  61 Jul  9 08:07 ecryptfslrwxrwxrwx 1 0 0       13 Jul  9 08:07 fd -> /proc/self/fdcrw-rw-rw- 1 0 0   1,   7 Jul  9 08:07 fullcrw-rw-rw- 1 0 0  10, 229 Jul  9 08:07 fusedrwxr-xr-x 3 0 0      100 Jul  9 08:07 inputcrw-r--r-- 1 0 0   1,  11 Jul  9 08:07 kmsgcrw------- 1 0 0  10, 232 Jul  9 08:07 kvmcrw------- 1 0 0  10, 237 Jul  9 08:07 loop-controlbrw------- 1 0 0   7,   0 Jul  9 08:07 loop0brw------- 1 0 0   7,   1 Jul  9 08:07 loop1brw------- 1 0 0   7,   2 Jul  9 08:07 loop2brw------- 1 0 0   7,   3 Jul  9 08:07 loop3brw------- 1 0 0   7,   4 Jul  9 08:07 loop4brw------- 1 0 0   7,   5 Jul  9 08:07 loop5brw------- 1 0 0   7,   6 Jul  9 08:07 loop6brw------- 1 0 0   7,   7 Jul  9 08:07 loop7drwxr-xr-x 2 0 0       60 Jul  9 08:07 mappercrw------- 1 0 0  10, 227 Jul  9 08:07 mcelogcrw------- 1 0 0  10,  57 Jul  9 08:07 megadev0crw------- 1 0 0   1,   1 Jul  9 08:07 memdrwxr-xr-x 2 0 0       60 Jul  9 08:07 netcrw------- 1 0 0  10,  59 Jul  9 08:07 network_latencycrw------- 1 0 0  10,  58 Jul  9 08:07 network_throughputcrw-rw-rw- 1 0 0   1,   3 Jul  9 08:07 nullcrw------- 1 0 0   1,   4 Jul  9 08:07 portcrw------- 1 0 0 108,   0 Jul  9 08:07 pppcrw------- 1 0 0  10,   1 Jul  9 08:07 psauxcrw-rw-rw- 1 0 0   5,   2 Jul  9 08:07 ptmxbrw------- 1 0 0   1,   0 Jul  9 08:07 ram0brw------- 1 0 0   1,   1 Jul  9 08:07 ram1brw------- 1 0 0   1,  10 Jul  9 08:07 ram10brw------- 1 0 0   1,  11 Jul  9 08:07 ram11brw------- 1 0 0   1,  12 Jul  9 08:07 ram12brw------- 1 0 0   1,  13 Jul  9 08:07 ram13brw------- 1 0 0   1,  14 Jul  9 08:07 ram14brw------- 1 0 0   1,  15 Jul  9 08:07 ram15brw------- 1 0 0   1,   2 Jul  9 08:07 ram2brw------- 1 0 0   1,   3 Jul  9 08:07 ram3brw------- 1 0 0   1,   4 Jul  9 08:07 ram4brw------- 1 0 0   1,   5 Jul  9 08:07 ram5brw------- 1 0 0   1,   6 Jul  9 08:07 ram6brw------- 1 0 0   1,   7 Jul  9 08:07 ram7brw------- 1 0 0   1,   8 Jul  9 08:07 ram8brw------- 1 0 0   1,   9 Jul  9 08:07 ram9crw-rw-rw- 1 0 0   1,   8 Jul  9 08:07 randomcrw------- 1 0 0  10,  62 Jul  9 08:07 rfkilllrwxrwxrwx 1 0 0        4 Jul  9 08:07 rtc -> rtc0crw------- 1 0 0 254,   0 Jul  9 08:07 rtc0brw------- 1 0 0   8,   0 Jul  9 08:07 sdabrw------- 1 0 0   8,   1 Jul  9 08:07 sda1brw------- 1 0 0   8,   2 Jul  9 08:07 sda2brw------- 1 0 0   8,   5 Jul  9 08:07 sda5brw------- 1 0 0   8,  16 Jul  9 08:07 sdbcrw------- 1 0 0  21,   0 Jul  9 08:07 sg0crw------- 1 0 0  21,   1 Jul  9 08:07 sg1crw------- 1 0 0  10, 231 Jul  9 08:07 snapshotdrwxr-xr-x 2 0 0       80 Jul  9 08:07 sndlrwxrwxrwx 1 0 0       15 Jul  9 08:07 stderr -> /proc/self/fd/2lrwxrwxrwx 1 0 0       15 Jul  9 08:07 stdin -> /proc/self/fd/0lrwxrwxrwx 1 0 0       15 Jul  9 08:07 stdout -> /proc/self/fd/1crw-rw-rw- 1 0 0   5,   0 Jul  9 08:07 ttycrw------- 1 0 0   4,   0 Jul  9 08:07 tty0crw------- 1 0 0   4,   1 Jul  9 08:07 tty1crw------- 1 0 0   4,  10 Jul  9 08:07 tty10crw------- 1 0 0   4,  11 Jul  9 08:07 tty11crw------- 1 0 0   4,  12 Jul  9 08:07 tty12crw------- 1 0 0   4,  13 Jul  9 08:07 tty13crw------- 1 0 0   4,  14 Jul  9 08:07 tty14crw------- 1 0 0   4,  15 Jul  9 08:07 tty15crw------- 1 0 0   4,  16 Jul  9 08:07 tty16crw------- 1 0 0   4,  17 Jul  9 08:07 tty17crw------- 1 0 0   4,  18 Jul  9 08:07 tty18crw------- 1 0 0   4,  19 Jul  9 08:07 tty19crw------- 1 0 0   4,   2 Jul  9 08:07 tty2crw------- 1 0 0   4,  20 Jul  9 08:07 tty20crw------- 1 0 0   4,  21 Jul  9 08:07 tty21crw------- 1 0 0   4,  22 Jul  9 08:07 tty22crw------- 1 0 0   4,  23 Jul  9 08:07 tty23crw------- 1 0 0   4,  24 Jul  9 08:07 tty24crw------- 1 0 0   4,  25 Jul  9 08:07 tty25crw------- 1 0 0   4,  26 Jul  9 08:07 tty26crw------- 1 0 0   4,  27 Jul  9 08:07 tty27crw------- 1 0 0   4,  28 Jul  9 08:07 tty28crw------- 1 0 0   4,  29 Jul  9 08:07 tty29crw------- 1 0 0   4,   3 Jul  9 08:07 tty3crw------- 1 0 0   4,  30 Jul  9 08:07 tty30crw------- 1 0 0   4,  31 Jul  9 08:07 tty31crw------- 1 0 0   4,  32 Jul  9 08:07 tty32crw------- 1 0 0   4,  33 Jul  9 08:07 tty33crw------- 1 0 0   4,  34 Jul  9 08:07 tty34crw------- 1 0 0   4,  35 Jul  9 08:07 tty35crw------- 1 0 0   4,  36 Jul  9 08:07 tty36crw------- 1 0 0   4,  37 Jul  9 08:07 tty37crw------- 1 0 0   4,  38 Jul  9 08:07 tty38crw------- 1 0 0   4,  39 Jul  9 08:07 tty39crw------- 1 0 0   4,   4 Jul  9 08:07 tty4crw------- 1 0 0   4,  40 Jul  9 08:07 tty40crw------- 1 0 0   4,  41 Jul  9 08:07 tty41crw------- 1 0 0   4,  42 Jul  9 08:07 tty42crw------- 1 0 0   4,  43 Jul  9 08:07 tty43crw------- 1 0 0   4,  44 Jul  9 08:07 tty44crw------- 1 0 0   4,  45 Jul  9 08:07 tty45crw------- 1 0 0   4,  46 Jul  9 08:07 tty46crw------- 1 0 0   4,  47 Jul  9 08:07 tty47crw------- 1 0 0   4,  48 Jul  9 08:07 tty48crw------- 1 0 0   4,  49 Jul  9 08:07 tty49crw------- 1 0 0   4,   5 Jul  9 08:07 tty5crw------- 1 0 0   4,  50 Jul  9 08:07 tty50crw------- 1 0 0   4,  51 Jul  9 08:07 tty51crw------- 1 0 0   4,  52 Jul  9 08:07 tty52crw------- 1 0 0   4,  53 Jul  9 08:07 tty53crw------- 1 0 0   4,  54 Jul  9 08:07 tty54crw------- 1 0 0   4,  55 Jul  9 08:07 tty55crw------- 1 0 0   4,  56 Jul  9 08:07 tty56crw------- 1 0 0   4,  57 Jul  9 08:07 tty57crw------- 1 0 0   4,  58 Jul  9 08:07 tty58crw------- 1 0 0   4,  59 Jul  9 08:07 tty59crw------- 1 0 0   4,   6 Jul  9 08:07 tty6crw------- 1 0 0   4,  60 Jul  9 08:07 tty60crw------- 1 0 0   4,  61 Jul  9 08:07 tty61crw------- 1 0 0   4,  62 Jul  9 08:07 tty62crw------- 1 0 0   4,  63 Jul  9 08:07 tty63crw------- 1 0 0   4,   7 Jul  9 08:07 tty7crw------- 1 0 0   4,   8 Jul  9 08:07 tty8crw------- 1 0 0   4,   9 Jul  9 08:07 tty9crw------- 1 0 0   4,  64 Jul  9 08:07 ttyS0crw------- 1 0 0   4,  65 Jul  9 08:07 ttyS1crw------- 1 0 0   4,  74 Jul  9 08:07 ttyS10crw------- 1 0 0   4,  75 Jul  9 08:07 ttyS11crw------- 1 0 0   4,  76 Jul  9 08:07 ttyS12crw------- 1 0 0   4,  77 Jul  9 08:07 ttyS13crw------- 1 0 0   4,  78 Jul  9 08:07 ttyS14crw------- 1 0 0   4,  79 Jul  9 08:07 ttyS15crw------- 1 0 0   4,  80 Jul  9 08:07 ttyS16crw------- 1 0 0   4,  81 Jul  9 08:07 ttyS17crw------- 1 0 0   4,  82 Jul  9 08:07 ttyS18crw------- 1 0 0   4,  83 Jul  9 08:07 ttyS19crw------- 1 0 0   4,  66 Jul  9 08:07 ttyS2crw------- 1 0 0   4,  84 Jul  9 08:07 ttyS20crw------- 1 0 0   4,  85 Jul  9 08:07 ttyS21crw------- 1 0 0   4,  86 Jul  9 08:07 ttyS22crw------- 1 0 0   4,  87 Jul  9 08:07 ttyS23crw------- 1 0 0   4,  88 Jul  9 08:07 ttyS24crw------- 1 0 0   4,  89 Jul  9 08:07 ttyS25crw------- 1 0 0   4,  90 Jul  9 08:07 ttyS26crw------- 1 0 0   4,  91 Jul  9 08:07 ttyS27crw------- 1 0 0   4,  92 Jul  9 08:07 ttyS28crw------- 1 0 0   4,  93 Jul  9 08:07 ttyS29crw------- 1 0 0   4,  67 Jul  9 08:07 ttyS3crw------- 1 0 0   4,  94 Jul  9 08:07 ttyS30crw------- 1 0 0   4,  95 Jul  9 08:07 ttyS31crw------- 1 0 0   4,  68 Jul  9 08:07 ttyS4crw------- 1 0 0   4,  69 Jul  9 08:07 ttyS5crw------- 1 0 0   4,  70 Jul  9 08:07 ttyS6crw------- 1 0 0   4,  71 Jul  9 08:07 ttyS7crw------- 1 0 0   4,  72 Jul  9 08:07 ttyS8crw------- 1 0 0   4,  73 Jul  9 08:07 ttyS9crw------- 1 0 0   5,   3 Jul  9 08:07 ttyprintkcrw------- 1 0 0  10, 239 Jul  9 08:07 uhidcrw------- 1 0 0  10, 223 Jul  9 08:07 uinputcrw-rw-rw- 1 0 0   1,   9 Jul  9 08:07 urandomcrw------- 1 0 0   7,   0 Jul  9 08:07 vcscrw------- 1 0 0   7,   1 Jul  9 08:07 vcs1crw------- 1 0 0   7, 128 Jul  9 08:07 vcsacrw------- 1 0 0   7, 129 Jul  9 08:07 vcsa1crw------- 1 0 0  10,  63 Jul  9 08:07 vga_arbitercrw------- 1 0 0  10, 238 Jul  9 08:07 vhost-netdrwxr-xr-x 2 0 0       60 Jul  9 08:07 virtio-portscrw------- 1 0 0 251,   1 Jul  9 08:07 vport1p1crw-rw-rw- 1 0 0   1,   5 Jul  9 08:07 zero

/dev/block:total 0lrwxrwxrwx 1 0 0 7 Jul  9 08:07 1:0 -> ../ram0lrwxrwxrwx 1 0 0 7 Jul  9 08:07 1:1 -> ../ram1lrwxrwxrwx 1 0 0 8 Jul  9 08:07 1:10 -> ../ram10lrwxrwxrwx 1 0 0 8 Jul  9 08:07 1:11 -> ../ram11lrwxrwxrwx 1 0 0 8 Jul  9 08:07 1:12 -> ../ram12lrwxrwxrwx 1 0 0 8 Jul  9 08:07 1:13 -> ../ram13lrwxrwxrwx 1 0 0 8 Jul  9 08:07 1:14 -> ../ram14lrwxrwxrwx 1 0 0 8 Jul  9 08:07 1:15 -> ../ram15lrwxrwxrwx 1 0 0 7 Jul  9 08:07 1:2 -> ../ram2lrwxrwxrwx 1 0 0 7 Jul  9 08:07 1:3 -> ../ram3lrwxrwxrwx 1 0 0 7 Jul  9 08:07 1:4 -> ../ram4lrwxrwxrwx 1 0 0 7 Jul  9 08:07 1:5 -> ../ram5lrwxrwxrwx 1 0 0 7 Jul  9 08:07 1:6 -> ../ram6lrwxrwxrwx 1 0 0 7 Jul  9 08:07 1:7 -> ../ram7lrwxrwxrwx 1 0 0 7 Jul  9 08:07 1:8 -> ../ram8lrwxrwxrwx 1 0 0 7 Jul  9 08:07 1:9 -> ../ram9lrwxrwxrwx 1 0 0 8 Jul  9 08:07 7:0 -> ../loop0lrwxrwxrwx 1 0 0 8 Jul  9 08:07 7:1 -> ../loop1lrwxrwxrwx 1 0 0 8 Jul  9 08:07 7:2 -> ../loop2lrwxrwxrwx 1 0 0 8 Jul  9 08:07 7:3 -> ../loop3lrwxrwxrwx 1 0 0 8 Jul  9 08:07 7:4 -> ../loop4lrwxrwxrwx 1 0 0 8 Jul  9 08:07 7:5 -> ../loop5lrwxrwxrwx 1 0 0 8 Jul  9 08:07 7:6 -> ../loop6lrwxrwxrwx 1 0 0 8 Jul  9 08:07 7:7 -> ../loop7lrwxrwxrwx 1 0 0 6 Jul  9 08:07 8:0 -> ../sdalrwxrwxrwx 1 0 0 7 Jul  9 08:07 8:1 -> ../sda1lrwxrwxrwx 1 0 0 6 Jul  9 08:07 8:16 -> ../sdblrwxrwxrwx 1 0 0 7 Jul  9 08:07 8:2 -> ../sda2lrwxrwxrwx 1 0 0 7 Jul  9 08:07 8:5 -> ../sda5

/dev/bsg:total 0crw------- 1 0 0 252, 0 Jul  9 08:07 2:0:0:0crw------- 1 0 0 252, 1 Jul  9 08:07 2:0:1:0

/dev/char:total 0lrwxrwxrwx 1 0 0  6 Jul  9 08:07 108:0 -> ../ppplrwxrwxrwx 1 0 0  8 Jul  9 08:07 10:1 -> ../psauxlrwxrwxrwx 1 0 0 16 Jul  9 08:07 10:184 -> ../cpu/microcodelrwxrwxrwx 1 0 0 10 Jul  9 08:07 10:200 -> ../net/tunlrwxrwxrwx 1 0 0  9 Jul  9 08:07 10:223 -> ../uinputlrwxrwxrwx 1 0 0  9 Jul  9 08:07 10:227 -> ../mceloglrwxrwxrwx 1 0 0  7 Jul  9 08:07 10:229 -> ../fuselrwxrwxrwx 1 0 0 11 Jul  9 08:07 10:231 -> ../snapshotlrwxrwxrwx 1 0 0  6 Jul  9 08:07 10:232 -> ../kvmlrwxrwxrwx 1 0 0 17 Jul  9 08:07 10:236 -> ../mapper/controllrwxrwxrwx 1 0 0 15 Jul  9 08:07 10:237 -> ../loop-controllrwxrwxrwx 1 0 0 11 Jul  9 08:07 10:57 -> ../megadev0lrwxrwxrwx 1 0 0 21 Jul  9 08:07 10:58 -> ../network_throughputlrwxrwxrwx 1 0 0 18 Jul  9 08:07 10:59 -> ../network_latencylrwxrwxrwx 1 0 0 18 Jul  9 08:07 10:60 -> ../cpu_dma_latencylrwxrwxrwx 1 0 0 11 Jul  9 08:07 10:61 -> ../ecryptfslrwxrwxrwx 1 0 0  9 Jul  9 08:07 10:62 -> ../rfkilllrwxrwxrwx 1 0 0 14 Jul  9 08:07 10:63 -> ../vga_arbiterlrwxrwxrwx 1 0 0 13 Jul  9 08:07 13:63 -> ../input/micelrwxrwxrwx 1 0 0 15 Jul  9 08:07 13:64 -> ../input/event0lrwxrwxrwx 1 0 0  6 Jul  9 08:07 1:1 -> ../memlrwxrwxrwx 1 0 0  7 Jul  9 08:07 1:11 -> ../kmsglrwxrwxrwx 1 0 0  7 Jul  9 08:07 1:3 -> ../nulllrwxrwxrwx 1 0 0  7 Jul  9 08:07 1:4 -> ../portlrwxrwxrwx 1 0 0  7 Jul  9 08:07 1:5 -> ../zerolrwxrwxrwx 1 0 0  7 Jul  9 08:07 1:7 -> ../fulllrwxrwxrwx 1 0 0  9 Jul  9 08:07 1:8 -> ../randomlrwxrwxrwx 1 0 0 10 Jul  9 08:07 1:9 -> ../urandomlrwxrwxrwx 1 0 0  6 Jul  9 08:07 21:0 -> ../sg0lrwxrwxrwx 1 0 0  6 Jul  9 08:07 21:1 -> ../sg1lrwxrwxrwx 1 0 0 11 Jul  9 08:07 251:1 -> ../vport1p1lrwxrwxrwx 1 0 0 14 Jul  9 08:07 252:0 -> ../bsg/2:0:0:0lrwxrwxrwx 1 0 0 14 Jul  9 08:07 252:1 -> ../bsg/2:0:1:0lrwxrwxrwx 1 0 0  7 Jul  9 08:07 254:0 -> ../rtc0lrwxrwxrwx 1 0 0  7 Jul  9 08:07 4:0 -> ../tty0lrwxrwxrwx 1 0 0  7 Jul  9 08:07 4:1 -> ../tty1lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:10 -> ../tty10lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:11 -> ../tty11lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:12 -> ../tty12lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:13 -> ../tty13lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:14 -> ../tty14lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:15 -> ../tty15lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:16 -> ../tty16lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:17 -> ../tty17lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:18 -> ../tty18lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:19 -> ../tty19lrwxrwxrwx 1 0 0  7 Jul  9 08:07 4:2 -> ../tty2lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:20 -> ../tty20lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:21 -> ../tty21lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:22 -> ../tty22lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:23 -> ../tty23lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:24 -> ../tty24lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:25 -> ../tty25lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:26 -> ../tty26lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:27 -> ../tty27lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:28 -> ../tty28lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:29 -> ../tty29lrwxrwxrwx 1 0 0  7 Jul  9 08:07 4:3 -> ../tty3lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:30 -> ../tty30lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:31 -> ../tty31lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:32 -> ../tty32lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:33 -> ../tty33lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:34 -> ../tty34lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:35 -> ../tty35lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:36 -> ../tty36lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:37 -> ../tty37lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:38 -> ../tty38lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:39 -> ../tty39lrwxrwxrwx 1 0 0  7 Jul  9 08:07 4:4 -> ../tty4lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:40 -> ../tty40lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:41 -> ../tty41lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:42 -> ../tty42lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:43 -> ../tty43lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:44 -> ../tty44lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:45 -> ../tty45lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:46 -> ../tty46lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:47 -> ../tty47lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:48 -> ../tty48lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:49 -> ../tty49lrwxrwxrwx 1 0 0  7 Jul  9 08:07 4:5 -> ../tty5lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:50 -> ../tty50lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:51 -> ../tty51lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:52 -> ../tty52lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:53 -> ../tty53lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:54 -> ../tty54lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:55 -> ../tty55lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:56 -> ../tty56lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:57 -> ../tty57lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:58 -> ../tty58lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:59 -> ../tty59lrwxrwxrwx 1 0 0  7 Jul  9 08:07 4:6 -> ../tty6lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:60 -> ../tty60lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:61 -> ../tty61lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:62 -> ../tty62lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:63 -> ../tty63lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:64 -> ../ttyS0lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:65 -> ../ttyS1lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:66 -> ../ttyS2lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:67 -> ../ttyS3lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:68 -> ../ttyS4lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:69 -> ../ttyS5lrwxrwxrwx 1 0 0  7 Jul  9 08:07 4:7 -> ../tty7lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:70 -> ../ttyS6lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:71 -> ../ttyS7lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:72 -> ../ttyS8lrwxrwxrwx 1 0 0  8 Jul  9 08:07 4:73 -> ../ttyS9lrwxrwxrwx 1 0 0  9 Jul  9 08:07 4:74 -> ../ttyS10lrwxrwxrwx 1 0 0  9 Jul  9 08:07 4:75 -> ../ttyS11lrwxrwxrwx 1 0 0  9 Jul  9 08:07 4:76 -> ../ttyS12lrwxrwxrwx 1 0 0  9 Jul  9 08:07 4:77 -> ../ttyS13lrwxrwxrwx 1 0 0  9 Jul  9 08:07 4:78 -> ../ttyS14lrwxrwxrwx 1 0 0  9 Jul  9 08:07 4:79 -> ../ttyS15lrwxrwxrwx 1 0 0  7 Jul  9 08:07 4:8 -> ../tty8lrwxrwxrwx 1 0 0  9 Jul  9 08:07 4:80 -> ../ttyS16lrwxrwxrwx 1 0 0  9 Jul  9 08:07 4:81 -> ../ttyS17lrwxrwxrwx 1 0 0  9 Jul  9 08:07 4:82 -> ../ttyS18lrwxrwxrwx 1 0 0  9 Jul  9 08:07 4:83 -> ../ttyS19lrwxrwxrwx 1 0 0  9 Jul  9 08:07 4:84 -> ../ttyS20lrwxrwxrwx 1 0 0  9 Jul  9 08:07 4:85 -> ../ttyS21lrwxrwxrwx 1 0 0  9 Jul  9 08:07 4:86 -> ../ttyS22lrwxrwxrwx 1 0 0  9 Jul  9 08:07 4:87 -> ../ttyS23lrwxrwxrwx 1 0 0  9 Jul  9 08:07 4:88 -> ../ttyS24lrwxrwxrwx 1 0 0  9 Jul  9 08:07 4:89 -> ../ttyS25lrwxrwxrwx 1 0 0  7 Jul  9 08:07 4:9 -> ../tty9lrwxrwxrwx 1 0 0  9 Jul  9 08:07 4:90 -> ../ttyS26lrwxrwxrwx 1 0 0  9 Jul  9 08:07 4:91 -> ../ttyS27lrwxrwxrwx 1 0 0  9 Jul  9 08:07 4:92 -> ../ttyS28lrwxrwxrwx 1 0 0  9 Jul  9 08:07 4:93 -> ../ttyS29lrwxrwxrwx 1 0 0  9 Jul  9 08:07 4:94 -> ../ttyS30lrwxrwxrwx 1 0 0  9 Jul  9 08:07 4:95 -> ../ttyS31lrwxrwxrwx 1 0 0  6 Jul  9 08:07 5:0 -> ../ttylrwxrwxrwx 1 0 0 10 Jul  9 08:07 5:1 -> ../consolelrwxrwxrwx 1 0 0  7 Jul  9 08:07 5:2 -> ../ptmxlrwxrwxrwx 1 0 0 12 Jul  9 08:07 5:3 -> ../ttyprintklrwxrwxrwx 1 0 0  6 Jul  9 08:07 7:0 -> ../vcslrwxrwxrwx 1 0 0  7 Jul  9 08:07 7:1 -> ../vcs1lrwxrwxrwx 1 0 0  7 Jul  9 08:07 7:128 -> ../vcsalrwxrwxrwx 1 0 0  8 Jul  9 08:07 7:129 -> ../vcsa1

/dev/cpu:total 0crw------- 1 0 0 10, 184 Jul  9 08:07 microcode

/dev/disk:total 0drwxr-xr-x 2 0 0 140 Jul  9 08:07 by-iddrwxr-xr-x 2 0 0 140 Jul  9 08:07 by-pathdrwxr-xr-x 2 0 0 100 Jul  9 08:07 by-uuid

/dev/disk/by-id:total 0lrwxrwxrwx 1 0 0  9 Jul  9 08:07 scsi-0QEMU_QEMU_HARDDISK_appliance -> ../../sdblrwxrwxrwx 1 0 0  9 Jul  9 08:07 scsi-0QEMU_QEMU_HARDDISK_hd0 -> ../../sdalrwxrwxrwx 1 0 0 10 Jul  9 08:07 scsi-0QEMU_QEMU_HARDDISK_hd0-part1 -> ../../sda1lrwxrwxrwx 1 0 0 10 Jul  9 08:07 scsi-0QEMU_QEMU_HARDDISK_hd0-part2 -> ../../sda2lrwxrwxrwx 1 0 0 10 Jul  9 08:07 scsi-0QEMU_QEMU_HARDDISK_hd0-part5 -> ../../sda5

/dev/disk/by-path:total 0lrwxrwxrwx 1 0 0  9 Jul  9 08:07 pci-0000:00:02.0-virtio-pci-virtio0-scsi-0:0:0:0 -> ../../sdalrwxrwxrwx 1 0 0 10 Jul  9 08:07 pci-0000:00:02.0-virtio-pci-virtio0-scsi-0:0:0:0-part1 -> ../../sda1lrwxrwxrwx 1 0 0 10 Jul  9 08:07 pci-0000:00:02.0-virtio-pci-virtio0-scsi-0:0:0:0-part2 -> ../../sda2lrwxrwxrwx 1 0 0 10 Jul  9 08:07 pci-0000:00:02.0-virtio-pci-virtio0-scsi-0:0:0:0-part5 -> ../../sda5lrwxrwxrwx 1 0 0  9 Jul  9 08:07 pci-0000:00:02.0-virtio-pci-virtio0-scsi-0:0:1:0 -> ../../sdb

/dev/disk/by-uuid:total 0lrwxrwxrwx 1 0 0 10 Jul  9 08:07 2a04dec6-66a7-4ab2-81ca-0b623f4aa7d8 -> ../../sda1lrwxrwxrwx 1 0 0  9 Jul  9 08:07 673c8a86-9322-4c9d-ae30-b3303b7e8fff -> ../../sdblrwxrwxrwx 1 0 0 10 Jul  9 08:07 9fd1fcdd-cd35-476b-b78f-30b37c9ca759 -> ../../sda5

/dev/input:total 0drwxr-xr-x 2 0 0     60 Jul  9 08:07 by-pathcrw------- 1 0 0 13, 64 Jul  9 08:07 event0crw------- 1 0 0 13, 63 Jul  9 08:07 mice

/dev/input/by-path:total 0lrwxrwxrwx 1 0 0 9 Jul  9 08:07 platform-i8042-serio-0-event-kbd -> ../event0

/dev/mapper:total 0crw------- 1 0 0 10, 236 Jul  9 08:07 control

/dev/net:total 0crw-rw-rw- 1 0 0 10, 200 Jul  9 08:07 tun

/dev/snd:total 0crw------- 1 0 0 116,  1 Jul  9 08:07 seqcrw------- 1 0 0 116, 33 Jul  9 08:07 timer

/dev/virtio-ports:total 0lrwxrwxrwx 1 0 0 11 Jul  9 08:07 org.libguestfs.channel.0 -> ../vport1p1rootfs / rootfs rw 0 0proc /proc proc rw,relatime 0 0/dev/root / ext2 rw,noatime 0 0/proc /proc proc rw,relatime 0 0/sys /sys sysfs rw,relatime 0 0tmpfs /run tmpfs rw,nosuid,relatime,size=97916k,mode=755 0 0/dev /dev devtmpfs rw,relatime,size=242608k,nr_inodes=60652,mode=755 0 0  No volume groups found  No volume groups found1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00    inet 127.0.0.1/8 brd 127.255.255.255 scope host lo       valid_lft forever preferred_lft forever    inet6 ::1/128 scope host        valid_lft forever preferred_lft foreverModule                  Size  Used bykvm_intel             143060  0 kvm                   451511  1 kvm_inteldm_multipath           22873  0 scsi_dh                14882  1 dm_multipathmac_hid                13205  0 psmouse               102222  0 serio_raw              13462  0 i2c_piix4              22155  0 virtio_scsi            18330  1 virtio_rng             13135  0 ideapad_laptop         18216  0 sparse_keymap          13948  1 ideapad_laptopsym53c8xx              76731  0 crc8                   12893  0 crc7                   12703  0 crc_ccitt              12707  0 crc32                  12714  0 crc_itu_t              12707  0 libcrc32c              12644  0 megaraid               44120  0 megaraid_sas           91199  0 megaraid_mbox          40158  0 megaraid_mm            18253  1 megaraid_mboxWed Jul  9 08:07:49 UTC 2014clocksource: kvm-clockuptime: 1.17 0.29

#启动guestfsd

verbose daemon enabledlinux commmand line: panic=1 console=ttyS0 udevtimeout=600 no_timer_check acpi=off printk.time=1 cgroup_disable=memory root=/dev/sdb selinux=0 guestfs_verbose=1 TERM=linux

#开通一个端口,C类库会通过RPC连接这个端口

trying to open virtio-serial channel '/dev/virtio-ports/org.libguestfs.channel.0'udevadm settlelibguestfs: recv_from_daemon: received GUESTFS_LAUNCH_FLAGlibguestfs: [02558ms] appliance is up>

查看原文