cloud-init icon indicating copy to clipboard operation
cloud-init copied to clipboard

mounts should support mounting by label

Open ubuntu-server-builder opened this issue 2 years ago • 1 comments

This bug was originally filed in Launchpad as LP: #2016030

Launchpad details
affected_projects = []
assignee = None
assignee_name = None
date_closed = None
date_created = 2023-04-12T16:39:39.878935+00:00
date_fix_committed = None
date_fix_released = None
id = 2016030
importance = wishlist
is_complete = False
lp_url = https://bugs.launchpad.net/cloud-init/+bug/2016030
milestone = None
owner = eherot
owner_name = Eric Herot
private = False
status = triaged
submitter = eherot
submitter_name = Eric Herot
tags = ['fstab', 'mount-by-label', 'mounts']
duplicates = []

Launchpad user Eric Herot(eherot) wrote on 2023-04-12T16:39:39.878935+00:00

This is legal in fstab:

LABEL=myvol /mountpoint ext4 defaults 0 0

It would be cool if cc_mounts would support mounting this way. It would also make mounting the correct EBS volume in the right place on EC2 a little more reliable, especially since fs_setup already supports applying a label.

Additionally, if mounts is unable to figure out how to resolve the filesystem identifier, perhaps it should just try to use it (and place it in fstab) anyway? Or at least have an option to "force" application instead of skipping it (and let the user deal with their non-booting instance).

ubuntu-server-builder avatar May 12 '23 22:05 ubuntu-server-builder

Just tested this on Fedora 41, but:

disk_setup:
  /dev/vdb:
    table_type: gpt
    layout: true
    overwrite: true

fs_setup:
  - label: data
    filesystem: ext4
    device: /dev/vdb1
    partition: auto

mounts:
  - ["LABEL=data", /opt/disk, ext4, "defaults,discard", "0", "0"]

This worked for me.

The disk was created with the partition, and the fstab contains:

LABEL=data        /opt/disk      ext4    defaults,discard,comment=cloudconfig    0    0

bhundven avatar Jan 15 '25 07:01 bhundven