tessl install tessl/pypi-python-libmaas@0.6.0Python client library for MAAS 2.0+ with sync/async support, providing machine provisioning, network management, and storage configuration.
Access filesystem information on MAAS block devices and partitions.
The Filesystem object represents a formatted filesystem on either a block device or partition. Filesystem objects are read-only and provide access to properties after formatting operations.
Important: Filesystems cannot be created, modified, or deleted directly. They are created as a side effect of formatting a block device or partition using the format() method. The Filesystem object is primarily used for read-only property access to inspect the current state of formatted storage.
Filesystems are accessed through their parent block device or partition.
# Via BlockDevice
block_device.filesystem
# Via Partition
partition.filesystemfrom maas.client import connect
client = connect('http://maas.example.com:5240/MAAS/', apikey='key')
# Get a machine and block device
machine = client.machines.get('abc123')
sda = machine.block_devices.get_by_name('sda')
# Access filesystem on block device
if sda.filesystem:
print(f"Filesystem: {sda.filesystem.fstype}")
print(f"Mount point: {sda.filesystem.mount_point}")
print(f"UUID: {sda.filesystem.uuid}")
# Access filesystem on partition
partition = sda.partitions[0]
if partition.filesystem:
print(f"Filesystem: {partition.filesystem.fstype}")
print(f"Mount point: {partition.filesystem.mount_point}")Filesystems are created through formatting operations on block devices or partitions.
# Format block device to create filesystem
sdb = machine.block_devices.get_by_name('sdb')
await sdb.format('ext4')
await sdb.mount('/data')
# Access the created filesystem
fs = sdb.filesystem
print(f"Type: {fs.fstype}")
print(f"Mounted at: {fs.mount_point}")
# Format partition to create filesystem
partition = sda.partitions[0]
await partition.format('xfs')
await partition.mount('/var')
# Access the created filesystem
fs = partition.filesystem
print(f"Type: {fs.fstype}")
print(f"Mounted at: {fs.mount_point}")All filesystem properties are read-only. Filesystems are created and configured through block device or partition formatting operations, not directly.
label (str, readonly): Filesystem labelfstype (str, readonly): Filesystem type (ext4, xfs, btrfs, swap, etc.)mount_point (str, readonly): Mount point path (e.g., '/', '/var', '/home')mount_options (str, readonly): Mount options (e.g., 'noatime,nodiratime')uuid (str, readonly): Filesystem UUIDNote: To modify filesystem properties, you must format the block device or partition again with new parameters. There are no save(), update(), or delete() methods on Filesystem objects.
MAAS supports the following filesystem types:
from maas.client import connect
client = connect('http://maas.example.com:5240/MAAS/', apikey='key')
machine = client.machines.get('abc123')
# Configure multiple filesystems
sdb = machine.block_devices.get_by_name('sdb')
# Create and format partitions
boot = await sdb.partitions.create(sdb, size=1073741824) # 1 GB
await boot.format('ext4')
await boot.mount('/boot')
root = await sdb.partitions.create(sdb, size=sdb.available_size)
await root.format('ext4')
await root.mount('/')
# Inspect created filesystems
print(f"Boot filesystem: {boot.filesystem.fstype} at {boot.filesystem.mount_point}")
print(f"Root filesystem: {root.filesystem.fstype} at {root.filesystem.mount_point}")