Hello, On Tue, Dec 22, 2020 at 11:10:20PM +0000, mick crane wrote: > On 2020-12-22 22:19, Michael wrote: > >- pvcreate <partition> to add a partition to a pool of physical volumes
[…] > I have only skimmed reading the fine manual and other things but I'm > guessing that if the partition is full I'll either need to make it bigger or > make another one before invoking LVM? The partition can't be full because LVM works with block devices, completely owning them. So if you type: # pvcreate /dev/foo then /dev/foo better be already empty because whatever is on it already is going to be trashed¹. So the expectation is that the block device ("partition") is empty and unused when you start. Seeing as you were talking about installing a new drive and then putting that in LVM, that doesn't sound like it would pose a problem to you. Since it is easy to grow LVM things but often trickier to shrink them, I advise you to start small. e.g. if you install a drive and it shows up in your OS as /dev/foo of size 1TB, then: # pvcreate /dev/foo # vgcreate myvg /dev/foo Now you have a volume group called "myvg" with ~1TB (some space reserved for metadata) available for allocation. Your temptation at this point may be to create a logical volume that uses the whole ~1TB, and you can, but unless you actually immediately need that size of block device it would be best to hold off. Say you need 50GiB of scratch space right away. You'd be better off: # lvcreate -L50g /dev/myvg/scratch # mkdir /srv/scratch # mkfs.ext4 /dev/myvg/scratch # mount /dev/myvg/scratch /srv/scratch (names and filesystem types to taste) …because that leaves you plenty of capacity in the myvg volume group to later create other logical volumes. If you do end up needing to grow the scratch space you can do it online: # lvresize -r -L+50g -n /dev/myvg/scratch If instead you had immediately made your first LV use the entire capacity and then later found you wanted other LVs, there'd be no available capacity and you'd have to shrink the scratch one. Some filesystems can't be shrunk online (need umount). Some filesystems can't be shrunk at all! You also should think about what happens with drive failure, especially if you are thinking of putting multiple drives into a volume group with no redundancy. Cheers, Andy ¹ Yes I am aware that there are various tricks to move an existing filesystem directly on a block device into an LVM LV on the same block device, but discussion of this seems way above OP's level at this time. -- https://bitfolk.com/ -- No-nonsense VPS hosting