← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1943156] [NEW] cc_disk_setup always overwrites filesystem on raw disk

 

Public bug reported:

See https://github.com/canonical/cloud-
init/blob/758acf976f2cb67a85411467fa5fca2ea17a2283/cloudinit/config/cc_disk_setup.py#L1005-L1009

```
        # File systems that support the -F flag
        if overwrite or device_type(device) == "disk":
            force_flag = lookup_force_flag(fs_type)
            if force_flag:
                fs_cmd.append(force_flag)
```

Even with `overwrite: false` when using a raw disk device (ie. /dev/sdb)
the filesystem will always be overwritten. This seems unintended, as
it's definitely not clarified in the documentation.

I think at the very least the documentation should be clarified that raw
disk devices will ALWAYS be overwritten by default.

We ended up overwriting our `cmd` value to prevent the force flag from
being added...

```
  - label: DATA
    filesystem: xfs
    device: /dev/sdb
    cmd: '/usr/sbin/mkfs.xfs %(device)s -L %(label)s'

```

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

-- 
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/1943156

Title:
  cc_disk_setup always overwrites filesystem on raw disk

Status in cloud-init:
  New

Bug description:
  See https://github.com/canonical/cloud-
  init/blob/758acf976f2cb67a85411467fa5fca2ea17a2283/cloudinit/config/cc_disk_setup.py#L1005-L1009

  ```
          # File systems that support the -F flag
          if overwrite or device_type(device) == "disk":
              force_flag = lookup_force_flag(fs_type)
              if force_flag:
                  fs_cmd.append(force_flag)
  ```

  Even with `overwrite: false` when using a raw disk device (ie.
  /dev/sdb) the filesystem will always be overwritten. This seems
  unintended, as it's definitely not clarified in the documentation.

  I think at the very least the documentation should be clarified that
  raw disk devices will ALWAYS be overwritten by default.

  We ended up overwriting our `cmd` value to prevent the force flag from
  being added...

  ```
    - label: DATA
      filesystem: xfs
      device: /dev/sdb
      cmd: '/usr/sbin/mkfs.xfs %(device)s -L %(label)s'

  ```

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



Follow ups