Skip to content

Instantly share code, notes, and snippets.

@grahamc

grahamc/ex.md Secret

Last active August 23, 2019 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grahamc/3c9649b5b29a6a4166950a3b391d72e8 to your computer and use it in GitHub Desktop.
Save grahamc/3c9649b5b29a6a4166950a3b391d72e8 to your computer and use it in GitHub Desktop.

./metadata-examples/c2.medium.x86.02.zfs.json

{
  "slug": "c2.medium.x86.02",
  "storage": {
    "disks": [
      {
        "device": "/dev/sdb",
        "partitions": [
          {
            "label": "BIOS",
            "number": 1,
            "size": "512M"
          },
          {
            "label": "SWAP",
            "number": 2,
            "size": "3993600"
          },
          {
            "label": "ROOT",
            "number": 3,
            "size": 0
          }
        ]
      }
    ],
    "filesystems": [
      {
        "mount": {
          "device": "/dev/sdb1",
          "format": "vfat",
          "point": "/boot/efi",
          "create": {
            "options": [
              "32",
              "-n",
              "EFI"
            ]
          }
        }
      },
      {
        "mount": {
          "device": "/dev/sdb3",
          "format": "ext4",
          "point": "/",
          "create": {
            "options": [
              "-L",
              "ROOT"
            ]
          }
        }
      },
      {
        "mount": {
          "device": "/dev/sdb2",
          "format": "swap",
          "point": "none",
          "create": {
            "options": [
              "-L",
              "SWAP"
            ]
          }
        }
      }
    ]
  },
  "customdata": {
    "cpr_zfs": {
      "pools": {
        "npool": {
          "pool_properties": {},
          "vdevs": [
            {
              "disk": [
                "/dev/sda",
                "/dev/sdb3",
                "/dev/sdc",
                "/dev/sdd"
              ]
            }
          ]
        }
      },
      "datasets": {
        "npool/root": {
          "properties": {
            "mountpoint": "legacy"
          }
        },
        "npool/nix": {
          "properties": {
            "mountpoint": "legacy"
          }
        },
        "npool/home": {
          "properties": {
            "mountpoint": "legacy"
          }
        },
        "npool/var": {
          "properties": {
            "mountpoint": "legacy"
          }
        }
      },
      "mounts": [
        {
          "dataset": "npool/root",
          "point": "/"
        },
        {
          "dataset": "npool/nix",
          "point": "/nix"
        },
        {
          "dataset": "npool/var",
          "point": "/var"
        },
        {
          "dataset": "npool/home",
          "point": "/home"
        }
      ]
    }
  }
}
ZFS {
   pools: {
       PoolName(
           "npool",
       ): PoolOptions {
           disable_all_features: false,
           mountpoint: None,
           pool_properties: {},
           pool_features: {},
           filesystem_properties: {},
           vdevs: [
               Disk(
                   [
                       Disk(
                           "/dev/sda",
                       ),
                       Disk(
                           "/dev/sdb3",
                       ),
                       Disk(
                           "/dev/sdc",
                       ),
                       Disk(
                           "/dev/sdd",
                       ),
                   ],
               ),
           ],
       },
   },
   datasets: {
       DatasetName(
           "npool/var",
       ): DatasetOptions {
           create_all_parents: false,
           properties: {
               "mountpoint": "legacy",
           },
       },
       DatasetName(
           "npool/home",
       ): DatasetOptions {
           create_all_parents: false,
           properties: {
               "mountpoint": "legacy",
           },
       },
       DatasetName(
           "npool/root",
       ): DatasetOptions {
           create_all_parents: false,
           properties: {
               "mountpoint": "legacy",
           },
       },
       DatasetName(
           "npool/nix",
       ): DatasetOptions {
           create_all_parents: false,
           properties: {
               "mountpoint": "legacy",
           },
       },
   },
   mounts: [
       ZFSMountOptions {
           dataset: DatasetName(
               "npool/root",
           ),
           point: MountPoint(
               "/",
           ),
       },
       ZFSMountOptions {
           dataset: DatasetName(
               "npool/nix",
           ),
           point: MountPoint(
               "/nix",
           ),
       },
       ZFSMountOptions {
           dataset: DatasetName(
               "npool/var",
           ),
           point: MountPoint(
               "/var",
           ),
       },
       ZFSMountOptions {
           dataset: DatasetName(
               "npool/home",
           ),
           point: MountPoint(
               "/home",
           ),
       },
   ],
}
[
   "sgdisk" "--new=1:0:512M" "--change-name=1:BIOS" "--typecode=1:ef00" "/dev/sdb",
   "sgdisk" "--new=2:0:3993600" "--change-name=2:SWAP" "--typecode=2:8300" "/dev/sdb",
   "sgdisk" "--new=3:0:0" "--change-name=3:ROOT" "--typecode=3:8300" "/dev/sdb",
   "zpool" "create" "npool" "disk" "/dev/sda" "/dev/sdb3" "/dev/sdc" "/dev/sdd",
   "zfs" "create" "-o" "mountpoint=legacy" "npool/var",
   "zfs" "create" "-o" "mountpoint=legacy" "npool/home",
   "zfs" "create" "-o" "mountpoint=legacy" "npool/root",
   "zfs" "create" "-o" "mountpoint=legacy" "npool/nix",
]
npool/root	/	zfs	defaults	0	0
npool/nix	/nix	zfs	defaults	0	0
npool/var	/var	zfs	defaults	0	0
npool/home	/home	zfs	defaults	0	0
/dev/sdb1	/boot/efi	vfat	errors=remount-ro	0	2
/dev/sdb2	none	swap	none	0	0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment