I'll be running my server in a VMware virtual machine[1]At some point, I might move all this stuff to a mini-PC, or an old laptop., with a second disk for the application data. This is important, since every time we update the OS, it will blow away the system disk and replace it with a new image, so we don't want that process to take out our data, as well[2]This means that we need to configure things like K3s and Docker to store their data on this data disk..
Get the Live DVD from here and boot from it. You will end up at a console running in an in-memory version of Linux, where we can prepare the machine for installation.
Setting up the data disk
I'd like to use LVM for my data disk, but CoreOS doesn't really support it all that well. The thinking seems to be that if you need to embiggen a disk, you just blow the server away and create a new one, but for my use case, it's much more convenient to just add another disk, and then add it to the LVM pool. The pre-installation environment does support LVM, so we'll set the data disk up there.
First, we create a new partition on the second disk[3]This is not strictly necessary, but it's not a bad idea to do so.:
[core@localhost ~]$ sudo fdisk /dev/sdb Welcome to fdisk (util-linux 2.39.3). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table. Created a new DOS (MBR) disklabel with disk identifier 0xced1ae96. Command (m for help): n Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p): Using default response p. Partition number (1-4, default 1): First sector (2048-209715199, default 2048): Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-209715199, default 209715199): Created a new partition 1 of type 'Linux' and of size 100 GiB. Command (m for help): t Selected partition 1 Hex code or alias (type L to list all): 8e ← this is important! Changed type of partition 'Linux' to 'Linux LVM'. Command (m for help): p Disk /dev/sdb: 100 GiB, 107374182400 bytes, 209715200 sectors Disk model: VMware Virtual S Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0xced1ae96 Device Boot Start End Sectors Size Id Type /dev/sdb1 2048 209715199 209713152 100G 8e Linux LVM Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks.
Then set LVM up:
[core@localhost ~]$ sudo pvcreate /dev/sdb1 Physical volume "/dev/sdb1" successfully created. [core@localhost ~]$ sudo pvs PV VG Fmt Attr PSize PFree /dev/sdb1 lvm2 --- <100.00g <100.00g [core@localhost ~]$ sudo vgcreate vg-data /dev/sdb1 Volume group "vg-data" successfully created [core@localhost ~]$ sudo vgs VG #PV #LV #SN Attr VSize VFree vg-data 1 0 0 wz--n- <100.00g <100.00g [core@localhost ~]$ sudo lvcreate -l 100%FREE -n lv-data vg-data Logical volume "lv-data" created. [core@localhost ~]$ sudo lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert lv-data vg-data -wi-a----- <100.00g [core@localhost ~]$ sudo mkfs.ext4 /dev/vg-data/lv-data mke2fs 1.47.0 (5-Feb-2023) Creating filesystem with 26213376 4k blocks and 6553600 inodes Filesystem UUID: f0d584f1-ce7a-412a-b5c8-412933082f97 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872 Allocating group tables: done Writing inode tables: done Creating journal (131072 blocks): done Writing superblocks and filesystem accounting information: done
For reference, if you want to add an extra disk, create an LVM partition on it as before, then:
[core@localhost ~]$ sudo pvcreate /dev/sdc1 Physical volume "/dev/sdc1" successfully created. [core@localhost ~]$ sudo pvs PV VG Fmt Attr PSize PFree /dev/sdb1 vg-data lvm2 a-- <100.00g 0 /dev/sdc1 lvm2 --- <50.00g <50.00g [core@localhost ~]$ sudo vgextend vg-data /dev/sdc1 Volume group "vg-data" successfully extended [core@localhost ~]$ sudo vgs VG #PV #LV #SN Attr VSize VFree vg-data 2 1 0 wz--n- 149.99g <50.00g [core@localhost ~]$ sudo lvextend -l +100%FREE /dev/vg-data/lv-data Size of logical volume vg-data/lv-data changed from <100.00 GiB (25599 extents) to 149.99 GiB (38398 extents). Logical volume vg-data/lv-data successfully resized. [core@localhost ~]$ sudo lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert lv-data vg-data -wi-a----- 149.99g [core@localhost ~]$ sudo e2fsck -f /dev/vg-data/lv-data e2fsck 1.47.0 (5-Feb-2023) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /dev/vg-data/lv-data: 12/6553600 files (0.0% non-contiguous), 558360/26213376 blocks [core@localhost ~]$ sudo resize2fs /dev/vg-data/lv-data resize2fs 1.47.0 (5-Feb-2023) Resizing the filesystem on /dev/vg-data/lv-data to 39319552 (4k) blocks. The filesystem on /dev/vg-data/lv-data is now 39319552 (4k) blocks long.
References
| ↑1 | At some point, I might move all this stuff to a mini-PC, or an old laptop. |
|---|---|
| ↑2 | This means that we need to configure things like K3s and Docker to store their data on this data disk. |
| ↑3 | This is not strictly necessary, but it's not a bad idea to do so. |










I am a 
