大网数据广告活动
服务器运维问答

partition sizing recommendations for VM with 100GB disk running docker/nomad type workloads

· 52CE 我爱测

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 /…

问题原文

原帖链接 · 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
    • /home should 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/log on 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 /tmp is nowadays usually a tmpfs mounted, no partition needed.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2022-08-30)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。