From 2f1ea8f62d1cb326214b9ec8e0b8f9c433b31a0d Mon Sep 17 00:00:00 2001 From: Jernej Kos Date: Fri, 17 Jan 2025 14:00:07 +0100 Subject: [PATCH] rofl-containers: Resize persistent storage filesystem if needed --- rofl-containers/src/storage.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rofl-containers/src/storage.rs b/rofl-containers/src/storage.rs index 0c64e59fb5..c210f664d8 100644 --- a/rofl-containers/src/storage.rs +++ b/rofl-containers/src/storage.rs @@ -50,6 +50,11 @@ pub async fn init(kms: Arc) -> Result<()> { format_storage(&storage_key)?; } + // Resize filesystem if needed. + run_cmd!( + sh -c "e2fsck -f -p /dev/mapper/storage || [ $? -le 2 ]"; + resize2fs "/dev/mapper/storage"; + )?; // Mount filesystem as /storage. run_cmd!(mount "/dev/mapper/storage" "/storage")?;