💾 Archived View for gemini.ctrl-c.club › ~zenspace › library › tech › create_read_only_lvm.gmi captured on 2023-12-28 at 17:47:49. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-05-24)
-=-=-=-=-=-=-
The first thing I do when deploying a new server is install aide, and initialize the database. The second thing that needs to be done is to move this database to a read-only partition or media.
If you want, you can add a new disk to use for the new logical volume this step can be skipped if you want the aide-lv to reside on the existing volume group. To do this, execute the following:
`pvcreate /dev/sdxn`, i.e `pvcreate /dev/sdb1`
This creates a new physical volume for the disk.
`vgcreate vg-aide /dev/sdb1`
This creates a volume group for aide called vg-aide.
Now, let's create a new logical volume for aide.
`lvcreate -L 4G -n lv-aide vg-aide`
This creates a new logical volume called lv-aide on the volume group vg-aide. If you skipped creating a new volume group, check the existing volume group name using:
`vgs`
This will show all volume groups. You can show information about them using:
`vgdisplay`
Next, create a filesystem on the new logical volume:
`mkfs.xfs /dev/vg-aide/lv-aide`
Now let's create a mountpoint for the logical volume:
`mkdir /aide-db`
Finally, mount the logical volume:
`mount -o ro /dev/vg-aide/lv-aide /aide-db`