Skip to content

Instantly share code, notes, and snippets.

@grahamc
Created August 29, 2019 11:30
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/374e7f39a9a0600e3568a213a18e85e3 to your computer and use it in GitHub Desktop.
Save grahamc/374e7f39a9a0600e3568a213a18e85e3 to your computer and use it in GitHub Desktop.
[grahamc@Petunia:~/projects/github.com/grahamc/packet-nixos/cpr]$ cat ./metadata-examples/c2.medium.x86.02.zfs-fancy.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"
]
},
{
"mirror": [
"/dev/sdc",
"/dev/sdd"
]
},
{
"raidz3": [
"/dev/sde",
"/dev/sdf",
"/dev/sdg"
]
}
]
}
},
"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"
}
]
}
}
}
[
"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" "mirror" "/dev/sdc" "/dev/sdd" "raidz3" "/dev/sde" "/dev/sdf" "/dev/sdg",
"zfs" "create" "-o" "mountpoint=legacy" "npool/root",
"zfs" "create" "-o" "mountpoint=legacy" "npool/var",
"zfs" "create" "-o" "mountpoint=legacy" "npool/home",
"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