Skip to content

Commit 18b3dc2

Browse files
bene2k1RoRoJ
andauthored
feat(em): add custom partitioning (#3779)
* feat(em): add custom partitioning * Apply suggestions from code review Co-authored-by: Rowena Jones <[email protected]> * feat(em): add link to api --------- Co-authored-by: Rowena Jones <[email protected]>
1 parent 0a0876e commit 18b3dc2

File tree

3 files changed

+236
-4
lines changed

3 files changed

+236
-4
lines changed
Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
---
2+
meta:
3+
title: How to configure custom disk partitioning on Scaleway Elastic Metal servers
4+
description: Learn how to configure custom disk partitions on Scaleway Elastic Metal servers
5+
content:
6+
h1: How to configure custom disk partitioning on Scaleway Elastic Metal servers
7+
paragraph: This guide explains how to configure custom disk partitions on Scaleway Elastic Metal servers.
8+
tags: attach, detach, flexible-ip, elastic-metal
9+
dates:
10+
validation: 2024-10-01
11+
posted: 2024-10-01
12+
categories:
13+
- bare-metal
14+
---
15+
16+
Scaleway Elastic Metal servers come with a default partition layout, suitable for most users and intended to speed up and simplify the installation process of the server.
17+
However, if you have specific requirements, you can define custom partitioning of your machine using a JSON configuration during server installation.
18+
19+
<Message type="tip">
20+
You can change the partitioning of your server during installation or re-installation only.
21+
Be aware that all your data will be deleted if you reinstall your server.
22+
</Message>
23+
24+
<Macro id="requirements" />
25+
- A Scaleway account logged into the [console](https://console.scaleway.com)
26+
- [Owner](/identity-and-access-management/iam/concepts/#owner) status or [IAM permissions](/identity-and-access-management/iam/concepts/#permission) allowing you to perform actions in the intended Organization
27+
- An [SSH key](/identity-and-access-management/organizations-and-projects/how-to/create-ssh-key/)
28+
- An [Elastic Metal server](/bare-metal/elastic-metal/quickstart/#how-to-create-an-elastic-metal-server)
29+
30+
## Example configuration
31+
32+
During [server installation](/bare-metal/elastic-metal/) click **Advanced JSON** configuration in step 5 of the server creation wizard.
33+
You can then edit the partition configuration directly in the editor within your browser. The configuration is done via a JSON description of the partitioning.
34+
Below is an example of how to define a partitioning schema with RAID and NVMe disks.
35+
36+
<Message type="important">
37+
- Disk Type Naming: Device names differ based on the disk type. For example, HDD/SSD will use `/dev/sdXXX`, while NVMe devices use `/dev/nvmeXXX`.
38+
- UEFI Partition: The EFI partition should only exist if the server uses UEFI. If UEFI is not in use, this partition should be omitted.
39+
- ZFS and LVM: ZFS is optional and can be configured if needed, while LVM should not be used for now due to functionality issues.
40+
</Message>
41+
42+
<Message type="tip">
43+
Refer to the Elastic Metal API documentation for a complete overview of the expected values for filesystem types, RAID configurations, and other related parameters required for partitioning. For more details, visit the [Scaleway Elastic Metal API Documentation – Default Partitioning Schema](https://www.scaleway.com/en/developers/api/elastic-metal/#path-partitioning-schemas-get-default-partitioning-schema).
44+
</Message>
45+
46+
```json
47+
{
48+
"partitioning_schema": {
49+
"disks": [
50+
{
51+
"device": "/dev/nvme0n1",
52+
"partitions": [
53+
{
54+
"label": "uefi",
55+
"number": 1,
56+
"size": 536870912
57+
},
58+
{
59+
"label": "swap",
60+
"number": 2,
61+
"size": 4294967296
62+
},
63+
{
64+
"label": "boot",
65+
"number": 3,
66+
"size": 536870912
67+
},
68+
{
69+
"label": "root",
70+
"number": 4,
71+
"size": 64424509440
72+
},
73+
{
74+
"label": "data",
75+
"number": 5,
76+
"size": 1850588790784
77+
}
78+
]
79+
},
80+
{
81+
"device": "/dev/nvme1n1",
82+
"partitions": [
83+
{
84+
"label": "swap",
85+
"number": 1,
86+
"size": 4294967296
87+
},
88+
{
89+
"label": "boot",
90+
"number": 2,
91+
"size": 536870912
92+
},
93+
{
94+
"label": "root",
95+
"number": 3,
96+
"size": 64424509440
97+
},
98+
{
99+
"label": "data",
100+
"number": 4,
101+
"size": 1850588790784
102+
}
103+
]
104+
}
105+
],
106+
"raids": [
107+
{
108+
"name": "/dev/md0",
109+
"level": "raid_level_1",
110+
"devices": [
111+
"/dev/nvme0n1p3",
112+
"/dev/nvme1n1p2"
113+
]
114+
},
115+
{
116+
"name": "/dev/md1",
117+
"level": "raid_level_1",
118+
"devices": [
119+
"/dev/nvme0n1p4",
120+
"/dev/nvme1n1p3"
121+
]
122+
}
123+
],
124+
"filesystems": [
125+
{
126+
"device": "/dev/nvme0n1p1",
127+
"format": "fat32",
128+
"mountpoint": "/boot/efi"
129+
},
130+
{
131+
"device": "/dev/md0",
132+
"format": "ext4",
133+
"mountpoint": "/boot"
134+
},
135+
{
136+
"device": "/dev/md1",
137+
"format": "ext4",
138+
"mountpoint": "/"
139+
}
140+
],
141+
"lvm": null,
142+
"zfs": {
143+
"pools": [
144+
{
145+
"name": "zpve",
146+
"type": "mirror",
147+
"devices": [
148+
"/dev/nvme0n1p5",
149+
"/dev/nvme1n1p4"
150+
],
151+
"options": [
152+
"ashift=12"
153+
],
154+
"filesystem_options": []
155+
}
156+
]
157+
}
158+
}
159+
}
160+
```
161+
162+
## Explanation of key sections:
163+
164+
- Disks:
165+
- Each disk is specified with its device path (e.g., `/dev/nvme0n1` or `/dev/nvme1n1`).
166+
- Partitions are defined with labels like `swap`, `boot`, `root`, `data`, and an optional `uefi` partition for systems using UEFI.
167+
- Each partition has a `number` and `size` in bytes.
168+
169+
- RAID (Optional):
170+
- If RAID is required, declare the disks and the desired RAID level. In this example, we are configuring two RAID-1 arrays, one for the boot partition and one for the root partition.
171+
- Devices participating in each RAID array are specified by their partition paths (e.g., `/dev/nvme0n1p3` for partition 3 of the first NVMe disk).
172+
173+
- Filesystems:
174+
- Each partition is assigned a filesystem type and a mount point.
175+
- For example, the `/boot/efi` partition is formatted with `fat32`, while `/boot` and `/` are formatted with `ext4`.
176+
177+
- ZFS (Optional):
178+
- ZFS can be configured if wished. In this example, a ZFS mirror is created using partitions from two NVMe devices.
179+
- ZFS options such as `ashift=12` can be included for performance tuning, but they are optional.
180+
181+
### Simple configuration (No RAID or ZFS)
182+
183+
If you prefer a simpler configuration without RAID or ZFS, you can remove the `raids` and `zfs` sections. For example, if you only need a single disk setup with no RAID, declare just one disk with the partitions and filesystems as shown below:
184+
185+
```json
186+
{
187+
"partitioning_schema": {
188+
"disks": [
189+
{
190+
"device": "/dev/nvme0n1",
191+
"partitions": [
192+
{
193+
"label": "swap",
194+
"number": 1,
195+
"size": 4294967296
196+
},
197+
{
198+
"label": "boot",
199+
"number": 2,
200+
"size": 536870912
201+
},
202+
{
203+
"label": "root",
204+
"number": 3,
205+
"size": 64424509440
206+
}
207+
]
208+
}
209+
],
210+
"filesystems": [
211+
{
212+
"device": "/dev/nvme0n1p2",
213+
"format": "ext4",
214+
"mountpoint": "/boot"
215+
},
216+
{
217+
"device": "/dev/nvme0n1p3",
218+
"format": "ext4",
219+
"mountpoint": "/"
220+
}
221+
],
222+
"raids": [],
223+
"zfs": null,
224+
"lvm": null
225+
}
226+
}
227+
```

bare-metal/elastic-metal/how-to/create-server.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Scaleway [Elastic Metal servers](https://www.scaleway.com/en/elastic-metal/) pro
3535
- Choose your preferred billing method: **hourly** or **monthly**.
3636
- Select a server configuration from the available options.
3737
- Choose an OS to run on your server or opt for no preinstalled image.
38+
- Configure server partitioning. You can either choose a default configuration or [configure your own partitioning](/bare-metal/elastic-metal/how-to/configure-disk-partitions/) using a JSON configuration.
3839
- Enter a name and, optionally, add tags to identify your server.
3940
- Add your SSH key (required if installing an image on your server). Depending on the OS image, you may also be asked to configure the panel user for your server.
4041
- Optionally, configure the available public bandwidth for your server. This option may not be available for all offers.

menu/navigation.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -868,14 +868,18 @@
868868
"label": "Connect to your server",
869869
"slug": "connect-to-server"
870870
},
871-
{
872-
"label": "Order a flexible IP",
873-
"slug": "order-flexible-ip"
874-
},
875871
{
876872
"label": "Adjust the available bandwidth",
877873
"slug": "adjust-available-bandwidth"
878874
},
875+
{
876+
"label": "Configure custom disk partitioning",
877+
"slug": "configure-disk-partitions"
878+
},
879+
{
880+
"label": "Order a flexible IP",
881+
"slug": "order-flexible-ip"
882+
},
879883
{
880884
"label": "Attach/detach a flexible IP",
881885
"slug": "attach-detach-flexible-ip"

0 commit comments

Comments
 (0)