QEMU - Transfer files between the VM and your HOST

Moderator: Forum moderators

Post Reply
Clarity
Posts: 3829
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1628 times
Been thanked: 523 times

QEMU - Transfer files between the VM and your HOST

Post by Clarity »

Introduction
This instructs an example to use WoofCE PUP services without installing anything on either your host system OR on your forum distro being booted in QEMU to access and post files to your HOST OS. Again, because SMB protocol sharing in built-into most every modern OS, there is no need to install anything at all:

  • on any of most of the forum's distros,

  • on any Windows PCs or

  • on any of the MAC PCs.

Yet, there are 2 requirements:

  1. You MUST have SAMBA active and sharing on your HOST OS (most everyone understands why)

  2. Your QEMU stanza must have parms telling the VM it has the ability to connect to the Host for SAMBA access; namely
    QEMU ... -net nic -net user

An example using F96... as the QEMU distro to launch:
qemu-system-x86_64 -enable-kvm -m 2G -vga cirrus -smp 2 -device AC97 -net nic -net user -cdrom F96_4-CE_radky6.iso

Steps to use sharing to exchange information
In the running VM, to access the HOST folder to exchange information

  1. Open a terminal in the VM

  2. Access the HOST shares using the following examples

    Code: Select all

    # echo "Test to ensure local SAMBA utilities are working"
    Test to ensure local SAMBA utilities are working
    # testparm # Test to ensure local SAMBA utilities are working
    Load smb config files from /etc/samba/smb.conf
    Loaded services file OK.
    Server role: ROLE_STANDALONE
    
    Press enter to see a dump of your service definitions
    ^C
    # 
    # arp # can you see your host OS
    Address                  HWtype  HWaddress           Flags Mask            Iface
    10.0.2.2                 ether   52:55:0a:00:02:02   C                     eth0
    10.0.2.3                 ether   52:55:0a:00:02:03   C                     eth0
    # 
    # smbclient -U% -L 10.0.2.2 # Is your host OS sharing folders-devices
    
    	Sharename       Type      Comment
    	---------       ----      -------
    	puppyshare      Disk      
    	IPC$            IPC       IPC Service (Puppy Samba Server)
    	CUPS-PDF        Printer   CUPS-PDF
    SMB1 disabled -- no workgroup available
    # 
    # echo "The HOST is sharing a folder named 'puppyshare' "
    The HOST is sharing a folder named 'puppyshare' 
    # 
    # mkdir -p /mnt/SOMEWHERE # create a mount-point in this VM
    # mount -o password=woofwoof //10.0.2.2/puppyshare /mnt/SOMEWHERE # mount host shares
  3. Move files to/from host at your leisure via the SOMEWHERE folder you created

.
Hope this is helpful

Edit: The 1st paragraph is redressed.
Edit2: Make plain that almost all systems are pre-built with the ability to share with every other system.

Last edited by Clarity on Wed Feb 01, 2023 12:16 am, edited 4 times in total.
Clarity
Posts: 3829
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1628 times
Been thanked: 523 times

Re: QEMU - Transfer files between the VM and your HOST

Post by Clarity »

This ALSO allows members to use the printers (and other devices that are shared too) that the hosts has connected to it.

Enjoy!

Geek3579
Posts: 269
Joined: Sat Jul 18, 2020 1:07 pm
Has thanked: 80 times
Been thanked: 68 times

Re: QEMU - Transfer files between the VM and your HOST

Post by Geek3579 »

There are two other ways to transfer data between the VM and host

The first given the host can run pure-ftpd. Once started I open gftp (or filezilla) in the VM which allows access to the host file structure and drives (if mounted). Its very quick to setup and all you need is the IP address of the host which can be obtained by hovering over the LAN tray icon, the channel (21), the user name (root) Puppy password (woofwoof by default).

The other way is a bit more messy, (adding a couple of switches to the QEMU script) which allows a shared USB or other drive . Best performed in AQEMU, as the switch requires specific information about the shared device.

User avatar
rockedge
Site Admin
Posts: 6547
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 2749 times
Been thanked: 2626 times
Contact:

Re: QEMU - Transfer files between the VM and your HOST

Post by rockedge »

@Geek3579 I do it the exact way you describe. One of the main reasons I want to include pure-ftpd in F96 and have a compiled xbps package for KLV, is for easy sharing between virtual machines and the host system. Once set up it is fast to start up. Some systems a SAMBA connection does the almost the same thing. Though SAMBA doesn't allow accessing certain directories which pure-ftpd does.

The methods you describe are what I would recommend. :thumbup2:

Clarity
Posts: 3829
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1628 times
Been thanked: 523 times

Re: QEMU - Transfer files between the VM and your HOST

Post by Clarity »

Having been a user of SAMBA for 3 decades, I am unaware of this:

rockedge wrote: Sun Jan 22, 2023 4:28 pm

... Though SAMBA doesn't allow accessing certain directories which pure-ftpd does. ...

Could you explain?

ALSO, If one chooses that an FTP would be a choice, wouldn't SFTP be a best choice to install and use?

Thanks for any helpful response

User avatar
rockedge
Site Admin
Posts: 6547
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 2749 times
Been thanked: 2626 times
Contact:

Re: QEMU - Transfer files between the VM and your HOST

Post by rockedge »

@Clarity It is that some partitions will disappear or /root is not accessible despite the configuration. But most of the time I have good results using SAMBA.

Clarity
Posts: 3829
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1628 times
Been thanked: 523 times

Re: QEMU - Transfer files between the VM and your HOST

Post by Clarity »

Hello @rockedge

rockedge wrote: Mon Jan 23, 2023 7:34 pm

... It is that some partitions will disappear or /root is not accessible despite the configuration. ...

I am having trouble visualizing the SAMBA issues you indicate. Since I haven't noticed this as an issue, Maybe you can help me so I can research that.

As you share, which of the following are you referencing?

  • SAMBA client lacking ability to access?

  • SAMBA server lacking ability to define?
    Or

  • somewhere in client use, shares are disappearing?

  • somewhere in serving use, defined system reference points are disappearing?
    Or

  • Is this a reference to something only occurring in the VM's operation?

  • Is this a general problem you have seen from time to time having nothing to do with VM use?

Thanks in advance for insight.

Post Reply

Return to “File Management”