---
title: VZVirtioFileSystemDeviceConfiguration
framework: virtualization
role: symbol
role_heading: Class
path: virtualization/vzvirtiofilesystemdeviceconfiguration
---

# VZVirtioFileSystemDeviceConfiguration

An object that represents the configuration of a Virtio file system device.

## Declaration

```swift
class VZVirtioFileSystemDeviceConfiguration
```

## Overview

Overview Use VZVirtioFileSystemDeviceConfiguration to create a Virtio file system device which allows the host to expose directories to a guest using a tag label. The example below shows the creation of a VZVirtioFileSystemDeviceConfiguration that shares a single directory that the user can manually mount after creating a mount point in the guest VM: A VZVirtioFileSystemDeviceConfiguration can also share multiple directories. The example below demonstrates sharing the ~/Invoices and ~/Projects directories from the user’s home directory to the guest VM: Mounting shared directories important: The commands required to mount shared directories in a guest VM aren’t commands that your app can execute or that you can script from inside your application to a VM; the user must perform them either interactively or as part of a script while logged in to the guest. You must communicate these requirements to the user of your app. Mounting a shared directory requires the user to execute a command in a terminal window, the specific mount command depends on the guest VM’s operating system: In macOS guests, use mount_virtiofs tag directory. In Linux guests, use mount -t virtiofs tag directory. The tag argument is the file system device configuration label — Projects in the single directory case and myfiles in the multiple directory case in these examples — and directory is the mount point in the guest file system to which the framework attaches the shared directories. Automounting shared directories in macOS VMs In macOS 13 and later, it’s possible to specify a file system device that macOS 13 or later guest VMs automount using the macOSGuestAutomountTag property. The example below demonstrates sharing a single macOS directory, to a macOS guest: // Define a URL to a specific file path, in this case the  // "Projects" directory in the user's home directory. let projectsURL = URL(fileURLWithPath: NSHomeDirectory() + "Projects")

static func createAutomountSingleDirectoryShareDeviceConfiguration() -> VZVirtioFileSystemDeviceConfiguration {     let sharedDirectory = VZSharedDirectory(url: projectsURL, readOnly: false)     let singleDirectoryShare = VZSingleDirectoryShare(directory: sharedDirectory)

// Assign the automount tag to this share. macOS shares automounted directories automatically under /Volumes in the guest.       let sharingConfiguration = VZVirtioFileSystemDeviceConfiguration(tag: VZVirtioFileSystemDeviceConfiguration.macOSGuestAutomountTag)     sharingConfiguration.share = singleDirectoryShare

return sharingConfiguration } The macOS guest automounts the user’s ~/Projects directory from the host and shares it under /Volumes/My Shared Files/ in the macOS guest. It’s also possible to automount multiple directories in macOS guests. The example below demonstrates sharing the ~/Invoices and ~/Projects directories from the user’s home directory to the macOS guest VM: // Define URLs at specific file paths, in this case the  // "Projects" and "Invoices" directories in the user's home directory. let projectsURL = URL(fileURLWithPath: NSHomeDirectory() + "Projects") let invoicesURL = URL(fileURLWithPath: NSHomeDirectory() + "Invoices")

static func createAutomountMultipleDirectoryShareDeviceConfiguration() -> VZVirtioFileSystemDeviceConfiguration {     // Share the contents of ~/Projects, which is writeable.     let sharedProjectsDirectory = VZSharedDirectory(url: projectsURL, readOnly: false)

// Share the contents of ~/Invoices, but make it read only.     let sharedInvoicesDirectory = VZSharedDirectory(url: invoicesURL, readOnly: true)

// Associate each shared directory with a name, which is how the framework lists them under the mount point in the guest.     let directoriesToShare = ["My Projects": sharedProjectsDirectory, "Invoices": sharedInvoicesDirectory]     let multipleDirectoryShare = VZMultipleDirectoryShare(directories: directoriesToShare)

// Assign the automount tag to this share. macOS will automatically mount each shared directory at /Volumes/My Shared Files.     let sharingConfiguration = VZVirtioFileSystemDeviceConfiguration(tag: VZVirtioFileSystemDeviceConfiguration.macOSGuestAutomountTag)     sharingConfiguration.share = multipleDirectoryShare

return sharingConfiguration } In the guest, the framework lists each shared directory by its specified name under /Volumes/My Shared Files. Here, the shared directories in the macOS guest are /Volumes/My Shared Files/My Projects and /Volumes/My Shared Files/Invoices.

## Topics

### Creating a file system device configuration

- [init(tag:)](virtualization/vzvirtiofilesystemdeviceconfiguration/init(tag:).md)

### Getting file system information

- [share](virtualization/vzvirtiofilesystemdeviceconfiguration/share.md)
- [tag](virtualization/vzvirtiofilesystemdeviceconfiguration/tag.md)
- [macOSGuestAutomountTag](virtualization/vzvirtiofilesystemdeviceconfiguration/macosguestautomounttag.md)

### Tag validation

- [validateTag(_:)](virtualization/vzvirtiofilesystemdeviceconfiguration/validatetag(_:).md)

## Relationships

### Inherits From

- [VZDirectorySharingDeviceConfiguration](virtualization/vzdirectorysharingdeviceconfiguration.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Related Documentation

- [VZMultipleDirectoryShare](virtualization/vzmultipledirectoryshare.md)
- [VZSingleDirectoryShare](virtualization/vzsingledirectoryshare.md)

### Configurations

- [VZDirectorySharingDeviceConfiguration](virtualization/vzdirectorysharingdeviceconfiguration.md)
- [VZLinuxRosettaDirectoryShare](virtualization/vzlinuxrosettadirectoryshare.md)
