← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1955858] [NEW] cc_resizefs does not allocate space on all disks of a multi disk btrfs volume

 

Public bug reported:

cloud provider: self-hosted, proxmox

cloud-init config:
growpart:
  mode: auto
  devices:
    - /dev/sda1
    - /dev/sdb1
    - /dev/sdc1
    - /dev/sdd1

I have a multi disk btrfs volume as root fs for the vm.
Each disk needs to grow on first boot and the btrfs filesystem should be resized.
Partitions are grown just fine and btrfs detects that, however, running `btrfs filesystem resize max /` as currently used in https://github.com/canonical/cloud-init/blob/bae9b11da9ed7dd0b16fe5adeaf4774b7cc628cf/cloudinit/config/cc_resizefs.py#L81 does not account for having multiple disks.

>From the `btrfs-filesystem` man page (debian 11, Btrfs v5.10.1):
> The devid can be found in the output of btrfs filesystem show and defaults to 1 if not specified.

Since a devid is not passed only the first disk will be resized, other
disks will stay with "slack" space.

This is after I manually resized disk id 2 for testing, before it also
had 3GiB slack:

root@test-vm:~# btrfs device usage /
/dev/sda1, ID: 1
   Device size:             4.00GiB
   Device slack:            3.50KiB
   Data,RAID10:           310.25MiB
   Metadata,RAID10:        64.00MiB
   System,RAID10:           8.00MiB
   Unallocated:             3.62GiB

/dev/sdb1, ID: 2
   Device size:             4.00GiB
   Device slack:            3.50KiB
   Data,RAID10:           310.25MiB
   Metadata,RAID10:        64.00MiB
   System,RAID10:           8.00MiB
   Unallocated:             3.62GiB

/dev/sdc1, ID: 3
   Device size:             4.00GiB
   Device slack:            3.00GiB
   Data,RAID10:           310.25MiB
   Metadata,RAID10:        64.00MiB
   System,RAID10:           8.00MiB
   Unallocated:           640.73MiB

/dev/sdd1, ID: 4
   Device size:             4.00GiB
   Device slack:            3.00GiB
   Data,RAID10:           310.25MiB
   Metadata,RAID10:        64.00MiB
   System,RAID10:           8.00MiB
   Unallocated:           640.73MiB

** Affects: cloud-init
     Importance: Undecided
         Status: New

** Attachment added: "cloud-init.tar.gz"
   https://bugs.launchpad.net/bugs/1955858/+attachment/5549886/+files/cloud-init.tar.gz

** Description changed:

  cloud provider: self-hosted, proxmox
  
  cloud-init config:
  growpart:
-   mode: auto
-   devices:
-     - /dev/sda1
-     - /dev/sdb1
-     - /dev/sdc1
-     - /dev/sdd1
- 
+   mode: auto
+   devices:
+     - /dev/sda1
+     - /dev/sdb1
+     - /dev/sdc1
+     - /dev/sdd1
  
  I have a multi disk btrfs volume as root fs for the vm.
  Each disk needs to grow on first boot and the btrfs filesystem should be resized.
  Partitions are grown just fine and btrfs detects that, however, running `btrfs filesystem resize max /` as currently used in https://github.com/canonical/cloud-init/blob/bae9b11da9ed7dd0b16fe5adeaf4774b7cc628cf/cloudinit/config/cc_resizefs.py#L81 does not account for having multiple disks.
  
- From the `btrfs-filesystem` man page (debian, Btrfs v5.10.1):
+ From the `btrfs-filesystem` man page (debian 11, Btrfs v5.10.1):
  > The devid can be found in the output of btrfs filesystem show and defaults to 1 if not specified.
  
  Since a devid is not passed only the first disk will be resized, other
  disks will stay with "slack" space.
  
  This is after I manually resized disk id 2 for testing, before it also
  had 3GiB slack:
  
  root@test-vm:~# btrfs device usage /
  /dev/sda1, ID: 1
-    Device size:             4.00GiB
-    Device slack:            3.50KiB
-    Data,RAID10:           310.25MiB
-    Metadata,RAID10:        64.00MiB
-    System,RAID10:           8.00MiB
-    Unallocated:             3.62GiB
+    Device size:             4.00GiB
+    Device slack:            3.50KiB
+    Data,RAID10:           310.25MiB
+    Metadata,RAID10:        64.00MiB
+    System,RAID10:           8.00MiB
+    Unallocated:             3.62GiB
  
  /dev/sdb1, ID: 2
-    Device size:             4.00GiB
-    Device slack:            3.50KiB
-    Data,RAID10:           310.25MiB
-    Metadata,RAID10:        64.00MiB
-    System,RAID10:           8.00MiB
-    Unallocated:             3.62GiB
+    Device size:             4.00GiB
+    Device slack:            3.50KiB
+    Data,RAID10:           310.25MiB
+    Metadata,RAID10:        64.00MiB
+    System,RAID10:           8.00MiB
+    Unallocated:             3.62GiB
  
  /dev/sdc1, ID: 3
-    Device size:             4.00GiB
-    Device slack:            3.00GiB
-    Data,RAID10:           310.25MiB
-    Metadata,RAID10:        64.00MiB
-    System,RAID10:           8.00MiB
-    Unallocated:           640.73MiB
+    Device size:             4.00GiB
+    Device slack:            3.00GiB
+    Data,RAID10:           310.25MiB
+    Metadata,RAID10:        64.00MiB
+    System,RAID10:           8.00MiB
+    Unallocated:           640.73MiB
  
  /dev/sdd1, ID: 4
-    Device size:             4.00GiB
-    Device slack:            3.00GiB
-    Data,RAID10:           310.25MiB
-    Metadata,RAID10:        64.00MiB
-    System,RAID10:           8.00MiB
-    Unallocated:           640.73MiB
+    Device size:             4.00GiB
+    Device slack:            3.00GiB
+    Data,RAID10:           310.25MiB
+    Metadata,RAID10:        64.00MiB
+    System,RAID10:           8.00MiB
+    Unallocated:           640.73MiB

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1955858

Title:
  cc_resizefs does not allocate space on all disks of a multi disk btrfs
  volume

Status in cloud-init:
  New

Bug description:
  cloud provider: self-hosted, proxmox

  cloud-init config:
  growpart:
    mode: auto
    devices:
      - /dev/sda1
      - /dev/sdb1
      - /dev/sdc1
      - /dev/sdd1

  I have a multi disk btrfs volume as root fs for the vm.
  Each disk needs to grow on first boot and the btrfs filesystem should be resized.
  Partitions are grown just fine and btrfs detects that, however, running `btrfs filesystem resize max /` as currently used in https://github.com/canonical/cloud-init/blob/bae9b11da9ed7dd0b16fe5adeaf4774b7cc628cf/cloudinit/config/cc_resizefs.py#L81 does not account for having multiple disks.

  From the `btrfs-filesystem` man page (debian 11, Btrfs v5.10.1):
  > The devid can be found in the output of btrfs filesystem show and defaults to 1 if not specified.

  Since a devid is not passed only the first disk will be resized, other
  disks will stay with "slack" space.

  This is after I manually resized disk id 2 for testing, before it also
  had 3GiB slack:

  root@test-vm:~# btrfs device usage /
  /dev/sda1, ID: 1
     Device size:             4.00GiB
     Device slack:            3.50KiB
     Data,RAID10:           310.25MiB
     Metadata,RAID10:        64.00MiB
     System,RAID10:           8.00MiB
     Unallocated:             3.62GiB

  /dev/sdb1, ID: 2
     Device size:             4.00GiB
     Device slack:            3.50KiB
     Data,RAID10:           310.25MiB
     Metadata,RAID10:        64.00MiB
     System,RAID10:           8.00MiB
     Unallocated:             3.62GiB

  /dev/sdc1, ID: 3
     Device size:             4.00GiB
     Device slack:            3.00GiB
     Data,RAID10:           310.25MiB
     Metadata,RAID10:        64.00MiB
     System,RAID10:           8.00MiB
     Unallocated:           640.73MiB

  /dev/sdd1, ID: 4
     Device size:             4.00GiB
     Device slack:            3.00GiB
     Data,RAID10:           310.25MiB
     Metadata,RAID10:        64.00MiB
     System,RAID10:           8.00MiB
     Unallocated:           640.73MiB

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1955858/+subscriptions



Follow ups