or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/python-libmaas@0.6.x

docs

index.md
tile.json

tessl/pypi-python-libmaas

tessl install tessl/pypi-python-libmaas@0.6.0

Python client library for MAAS 2.0+ with sync/async support, providing machine provisioning, network management, and storage configuration.

filesystems.mddocs/reference/

Filesystem Management

Access filesystem information on MAAS block devices and partitions.

Overview

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.

Accessing Filesystems

Filesystems are accessed through their parent block device or partition.

# Via BlockDevice
block_device.filesystem

# Via Partition
partition.filesystem
from 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}")

Creating Filesystems

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}")

Filesystem Properties

All filesystem properties are read-only. Filesystems are created and configured through block device or partition formatting operations, not directly.

  • label (str, readonly): Filesystem label
  • fstype (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 UUID

Note: 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.

Supported Filesystem Types

MAAS supports the following filesystem types:

  • ext2: Legacy Linux filesystem
  • ext3: Journaled Linux filesystem
  • ext4: Modern Linux filesystem with improved performance
  • xfs: High-performance journaled filesystem
  • btrfs: Advanced filesystem with snapshot and compression support
  • swap: Linux swap space
  • fat32: FAT32 filesystem (legacy compatibility)
  • vfat: VFAT filesystem (legacy compatibility)

Example: Complete Storage Configuration

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}")

Related Documentation

  • Block Device Management - Format and mount block devices
  • Partition Management - Format and mount partitions
  • RAID Configuration - Filesystems on RAID arrays
  • LVM Volume Groups - Filesystems on logical volumes