问题原文
原帖链接 · rismoney · CC BY-SA 4.0
My understanding is from a security perspective, it's best to put things on separate partitions and use lvm groups. In doing so, how might you decide to allocate sizes for things like /var /opt, et al.
/ (root)
/home
/tmp
/var
/var/tmp
/var/log
/var/log/audit
/boot
/boot/efi
已采纳解答
原帖链接 · Gerald Schneider · CC BY-SA 4.0
From a security perspective it doesn't matter at all how you partition your disk.
Practical considerations:
/boot/needs to be readable by GRUB, so if you prefer a filesystem GRUB cannot read you need a separate partition for it. You also need a separate boot partition if your disk exceeds a certain size, for your 100GB disk it doesn't matter.- It makes sense to separate data from the system. When your root disk fills up your VM will be unusable and you will need to boot from a rescue disk to repair it, increasing downtime.
- Create a large separate partition for your data and mount it where you need it
- the root partition usually does not need to be very large
/homeshould not matter, it should not be used to store large amounts of data.- If you expect large amounts of log, it might be useful to put
/var/logon a separate partition/disk
My personal preferred partitioning for VMs with Docker workloads (which is of course opinionated):
/dev/sda1: 1 GB/boot/dev/sda2: X GB swap (X depends on the RAM size)/dev/sda3: ~10 GB//dev/sdb1: Y GB/var/lib/docker(Y depending on the containers)- (addidional disks (not partitions) for very large applications)
I don't care if the VM uses LVM or not, it doesn't really matter, resizing disks is easy enough either way. LVM adds an additional layer of complexity which is technically not necessary with VMs.
Other reasons for this rather simple partitioning schema:
- Placing the swap partition before the root partition makes resizing the root partition easier if needed at a later point
- Using to many partitions makes resizing harder at a later point. You never know WHICH partition will fill up first and needs resizing.
- Using separate smaller disks instead of many partitions in a larger disks makes resizing easier
- Always use GPT partitioning. You never know how large the disk will grow, don't limit it with the old MBR partitioning schema.
- For
/tmpis nowadays usually a tmpfs mounted, no partition needed.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
