lima icon indicating copy to clipboard operation
lima copied to clipboard

attach and mount external drive (ssd / hdd) via usb [eg Ext4]

Open erlangparasu opened this issue 1 year ago • 2 comments

Description

mount into /mnt from external drive (even external filesystem is unreadable by macos, eg Ext4, NTFS)

erlangparasu avatar Dec 25 '23 18:12 erlangparasu

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

AkihiroSuda avatar Dec 25 '23 20:12 AkihiroSuda

i hope mounting feature is directly accessable via limactl command

erlangparasu avatar Dec 26 '23 02:12 erlangparasu