lima
lima copied to clipboard
attach and mount external drive (ssd / hdd) via usb [eg Ext4]
Description
mount into /mnt from external drive (even external filesystem is unreadable by macos, eg Ext4, NTFS)
The following steps MAY work (I didn't test):
Host
# Change N to the actual ID of the external disk
sudo qemu-nbd --socket=/tmp/nbd.sock /dev/rdiskN
sudo chown $(whoami) /tmp/nbd.sock
ssh -F ~/.lima/ssh.config -R /tmp/nbd.sock:/tmp/nbd.sock lima-default
Guest
sudo apt-get install nbd-client
sudo nbd-client -unix /tmp/nbd.sock /dev/nbd0
sudo kpartx -a /dev/nbd0
sudo mount /dev/nbd0p1 /mnt/foo
See also:
- https://www.qemu.org/docs/master/tools/qemu-nbd.html
- https://manpages.debian.org/bookworm/nbd-client/nbd-client.8.en.html
- https://gist.github.com/shamil/62935d9b456a6f9877b5?permalink_comment_id=3614387
i hope mounting feature is directly accessable via limactl command