Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kernels/microvm-kernel-x86_64-5.10.config
Original file line number Diff line number Diff line change
Expand Up @@ -2113,7 +2113,7 @@ CONFIG_FS_MBCACHE=y
# CONFIG_JFS_FS is not set
# CONFIG_XFS_FS is not set
# CONFIG_GFS2_FS is not set
# CONFIG_BTRFS_FS is not set
CONFIG_BTRFS_FS=y
# CONFIG_NILFS2_FS is not set
# CONFIG_F2FS_FS is not set
# CONFIG_FS_DAX is not set
Expand Down
14 changes: 9 additions & 5 deletions vm_supervisor/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ async def create_volume_file(
volume: Union[PersistentVolume, RootfsVolume], namespace: str
) -> Path:
volume_name = volume.name if isinstance(volume, PersistentVolume) else "rootfs"
path = Path(settings.PERSISTENT_VOLUMES_DIR) / namespace / f"{volume_name}.ext4"
# Assume that the main filesystem format is BTRFS
path = settings.PERSISTENT_VOLUMES_DIR / namespace / f"{volume_name}.btrfs"
if not path.is_file():
logger.debug(f"Creating {volume.size_mib}MB volume")
# Ensure that the parent directory exists
Expand Down Expand Up @@ -236,9 +237,10 @@ async def create_mapped_device(device_name: str, table_command: str) -> None:
await run_in_subprocess(command, stdin_input=table_command.encode())


async def e2fs_check_and_resize(device_path: Path) -> None:
await run_in_subprocess(["e2fsck", "-fy", str(device_path)])
await run_in_subprocess(["resize2fs", str(device_path)])
async def resize_file_system(device_path: Path, mount_path: Path) -> None:
await run_in_subprocess(["mount", str(device_path), str(mount_path)])
await run_in_subprocess(["btrfs", "filesystem", "resize", "max", str(mount_path)])
await run_in_subprocess(["umount", str(mount_path)])


async def create_devmapper(
Expand Down Expand Up @@ -271,7 +273,9 @@ async def create_devmapper(
snapshot_table_command = f"0 {extended_block_size} snapshot {path_base_device_name} {extended_loop_device} P 8"
await create_mapped_device(mapped_volume_name, snapshot_table_command)

await e2fs_check_and_resize(path_mapped_volume_name)
mount_path = Path(f"/mnt/{mapped_volume_name}")
mount_path.mkdir(parents=True, exist_ok=True)
await resize_file_system(path_mapped_volume_name, mount_path)
await chown_to_jailman(path_base_device_name)
await chown_to_jailman(path_mapped_volume_name)
return path_mapped_volume_name
Expand Down