黑果日记

macOS下VMware合并vmdk

1 条评论 默认分类 黑果日记 Yunoon

前言

业务需求,导致需要做vmdk镜像,故有这篇文章

正文

查找工具路径

合并vmdk需要用到vmware-vdiskmanager,在安装了DMG后,系统是无法直接识别到该命令的。

右键进入该应用

进入对应路径,找到该工具

该工具的路径为/Applications/VMware Fusion.app/Contents/Library/vmware-vdiskmanager

正式使用

  1. 直接在终端中进入工具目录
    cd /Applications/VMware\ Fusion.app/Contents/Library
  2. 查看帮助文档
    ➜  Library ./vmware-vdiskmanager -h
    ./vmware-vdiskmanager: illegal option -- h
    VMware Virtual Disk Manager - build 18811640.
    Usage: vmware-vdiskmanager OPTIONS <disk-name> | <mount-point>
    Offline disk manipulation utility
      Operations, only one may be specified at a time:
         -c                   : create disk.  Additional creation options must
                                be specified.  Only local virtual disks can be
                                created.
         -d                   : defragment the specified virtual disk. Only
                                local virtual disks may be defragmented.
         -k                   : shrink the specified virtual disk. Only local
                                virtual disks may be shrunk.
         -n <source-disk>     : rename the specified virtual disk; need to
                                specify destination disk-name. Only local virtual
                                disks may be renamed.
         -p                   : prepare the mounted virtual disk specified by
                                the volume path for shrinking.
         -r <source-disk>     : convert the specified disk; need to specify
                                destination disk-type.  For local destination disks
                                the disk type must be specified.
         -x <new-capacity>    : expand the disk to the specified capacity. Only
                                local virtual disks may be expanded.
         -R                   : check a sparse virtual disk for consistency and attempt
                                to repair any errors.
         -e                   : check for disk chain consistency.
         -D                   : make disk deletable.  This should only be used on disks
                                that have been copied from another product.
         -U                   : delete/unlink a single disk link.
    
      Other Options:
         -q                   : do not log messages
    
      Additional options for create and convert:
         -a <adapter>         : (for use with -c only) adapter type
                                (ide, buslogic, lsilogic). Pass lsilogic for other adapter types.
         -s <size>            : capacity of the virtual disk
         -t <disk-type>       : disk type id
         -z <level>           : compression level for -t 5. Valid range: [0,9]
                                Default: 1
    
      Disk types:
          0                   : single growable virtual disk
          1                   : growable virtual disk split into multiple files
          2                   : preallocated virtual disk
          3                   : preallocated virtual disk split into multiple files
          4                   : preallocated ESX-type virtual disk
          5                   : compressed disk optimized for streaming
          6                   : thin provisioned virtual disk - ESX 3.x and above
    
         The capacity can be specified in sectors, KB, MB or GB.
         The acceptable ranges:
                               ide/scsi adapter : [1MB, 8192.0GB]
                               buslogic adapter : [1MB, 2040.0GB]
            ex 1: vmware-vdiskmanager -c -s 850MB -a ide -t 0 myIdeDisk.vmdk
            ex 2: vmware-vdiskmanager -d myDisk.vmdk
            ex 3: vmware-vdiskmanager -r sourceDisk.vmdk -t 0 destinationDisk.vmdk
            ex 4: vmware-vdiskmanager -x 36GB myDisk.vmdk
            ex 5: vmware-vdiskmanager -n sourceName.vmdk destinationName.vmdk
            ex 6: vmware-vdiskmanager -k myDisk.vmdk
            ex 7: vmware-vdiskmanager -p <mount-point>
                  (A virtual disk first needs to be mounted at <mount-point>)
    
  3. 参考最后的example3,更改对应的原vmdk,以及最终输出的vmdk路径。
    ./vmware-vdiskmanager -r sourceDisk.vmdk -t 0 destinationDisk.vmdk
  4. 最终成果
    ➜  Library ./vmware-vdiskmanager -r /<Your_Source_Path>/win2k3.vmdk -t 0 /<Your_Dest_Path>/win2k3.vmdk
    
    Creating disk '<Your_Dest_Path>/win2k3.vmdk'
      Convert: 100% done.
    Virtual disk conversion successful.
    ➜  packet ll
    total 37478144
    -rw-------  1 yunoon  admin   4.0G  9  6 17:05 win2k3.vmdk
    -rw-------@ 1 yunoon  admin    14G  9  6 11:14 win7.vmdk
    ➜  packet
    
    

brew报错记录

0 条评论 默认分类 黑果日记 Yunoon

报错内容


➜  ~ brew reinstall ca-certificates


==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/manifests/2022-07-19_1
Already downloaded: /Users/yunoon/Library/Caches/Homebrew/downloads/c95acf8107b31ec83053f411f74e85b2626e1a0c051467aff6b98acf996883d7--ca-certificates-2022-07-19_1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/blobs/sha256:9e0df163364a5ae07f3ee2cf39083cd74bcb38eeb5250b706e1c02f878d8d632
Already downloaded: /Users/yunoon/Library/Caches/Homebrew/downloads/35d5190bc4a6a8eaf390498d1fa15dbf9dc06e7f01c8ca3f4e7fa1d2615790d9--ca-certificates--2022-07-19_1.all.bottle.tar.gz
==> Reinstalling ca-certificates
==> Pouring ca-certificates--2022-07-19_1.all.bottle.tar.gz
Error: could not find a temporary directory
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.8_1/lib/ruby/2.6.0/tmpdir.rb:35:in `tmpdir'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.8_1/lib/ruby/2.6.0/tmpdir.rb:112:in `tmpdir'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.8_1/lib/ruby/2.6.0/tmpdir.rb:120:in `create'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.8_1/lib/ruby/2.6.0/tmpdir.rb:87:in `mktmpdir'
/usr/local/Homebrew/Library/Homebrew/unpack_strategy.rb:146:in `extract_nestedly'
/usr/local/Homebrew/Library/Homebrew/download_strategy.rb:99:in `stage'
/usr/local/Homebrew/Library/Homebrew/download_strategy.rb:37:in `stage'
/usr/local/Homebrew/Library/Homebrew/software_spec.rb:357:in `stage'
/usr/local/Homebrew/Library/Homebrew/formula_installer.rb:1212:in `block in pour'
/usr/local/Homebrew/Library/Homebrew/extend/pathname.rb:303:in `block in cd'
/usr/local/Homebrew/Library/Homebrew/extend/pathname.rb:303:in `chdir'
/usr/local/Homebrew/Library/Homebrew/extend/pathname.rb:303:in `cd'
/usr/local/Homebrew/Library/Homebrew/formula_installer.rb:1211:in `pour'
/usr/local/Homebrew/Library/Homebrew/formula_installer.rb:419:in `install'
/usr/local/Homebrew/Library/Homebrew/reinstall.rb:64:in `reinstall_formula'
/usr/local/Homebrew/Library/Homebrew/cmd/reinstall.rb:114:in `block in reinstall'
/usr/local/Homebrew/Library/Homebrew/cmd/reinstall.rb:108:in `each'
/usr/local/Homebrew/Library/Homebrew/cmd/reinstall.rb:108:in `reinstall'
/usr/local/Homebrew/Library/Homebrew/brew.rb:93:in `<main>'

解决方案

sudo chmod +t /tmp

Reference

https://en.wikipedia.org/wiki/Sticky_bit


关于无法登陆到App Store的解决方案

0 条评论 笔记 黑果日记 Yunoon

前言

一直都没解决无法登陆App Store的问题,无限输入密码,后面查阅资料发现是App Store 默认走的是en0,我的无线网卡为en5,导致无法出去。以下为解决方案。

实践

  1. 删除所有的网络驱动器 系统偏好设置->网络
  2. 打开访达 -> 快捷键(Command+Shift+G)-> 输入/Library/Preferences/SystemConfiguration
  3. 删去NetworkInterfaces.plist

  4. 重启即可


使用Karabiner做到键位映射

0 条评论 笔记 黑果日记 Yunoon

前言

黑果的键位与Mac键位不一致,这里利用了Karabiner实现了映射自己想要的键位。
GitHub项目地址:Karabiner-DriverKit-VirtualHIDDevice

安装

安装见GitHub项目中的Usage

  1. Open dist/Karabiner-DriverKit-VirtualHIDDevice-x.x.x.dmg, and then open Karabiner-DriverKit-VirtualHIDDevice.pkg (installer).

  2. Install files via installer.

  3. Execute the following command in Terminal.

    /Applications/.Karabiner-VirtualHIDDevice-Manager.app/Contents/MacOS/Karabiner-VirtualHIDDevice-Manager activate

  4. Run a client program to test the driver extension.

    cd Karabiner-DriverKit-VirtualHIDDevice/examples/virtual-hid-device-service-client
    brew install xcodegen
    make
    make run

使用

  1. 安装后就可以直接添加相应的条目虚拟键盘就可以使用了。

  2. 这个虚拟键盘就会将你的USB输入设备进行代理,然后对相应的键位进行映射,就可以达到你想要的效果。

  3. 这里有个想要注意的点,也是写这篇博客的原因:


    1. 由于虚拟键盘是默认代理了你的所有设备,如果你新插入一个键盘,你在设置中对键盘的更改是无效的,想要对虚拟键盘进行修改才行。
    2. 如上图中,对Keyboard/Dell Universal Receiver的更改都无法生效,只能通过对Karabiner这个虚拟键盘的更改,才能生效。
    3. 但我黑果的笔记本内置键盘默认映射了Command/Option,这样就与外置键盘产生了冲突。
    4. 这里Karabiner官方也提供了选项,研究应用时才发现,可以对是否映射该设备进行选择。
    5. 堪称要命

      25B154A185AE7B1FC7FF2DD304A380AB

总结

国庆摸了大半时间的鱼,也该卷起来了。


利用AltStore做到iPad免越狱即可安装应用的实践记录

0 条评论 默认分类 笔记 黑果日记 Yunoon

前言

在iPad上安装应用,大多数情况只能通过App Store下载。但有很多个人开发者的项目尚未发布上线在AppStore内,因此便有了AltStore这款应用。

知识点

Apple开发者ID
AltStore的使用

实践

  1. 在Windows/MacOS上安装AltServer。

  2. 安装邮箱插件

  3. 打开邮箱偏好设置,选择管理插件,启用该插件。

  4. 登陆Apple ID

  5. 通过有线连接,在访达中找到并且启用接入Wi-Fi时显示此iPad

  6. 选择安装后,即可在iPad上找到AltStore

    IMG_5FF13451E2BA-1

  7. 在设置中,选择并且相信您的Apple IDIMG_3B05717BB672-1

  8. 最后在选择您的ipa文件,分享至AltStore即可安装。IMG_A6CD5C350BC7-1

  9. 至此就可以安装ipa应用至iPad上。但每隔7天需要刷新使用时间,个人开发者用户的APP有效时间为7天,每隔7天需要重新申请。当然,也可以保持您Windows/MacOS上的AltStore与邮箱开启,AltStore会自动刷新。
    IMG_5C2B2E61C995-1

结束

以上就是本次的利用AltStore安装个人开发APP在iPad上的全过程,感谢您的观看。