After managing dozens of production servers, I've found that the classic "one root partition" approach often leads to operational headaches. Let me share a battle-tested partitioning scheme specifically optimized for LAMP environments with large file handling requirements.
While your proposed layout shows good intention, these issues stand out:
- Over-allocating to /tmp (800GB for PHP uploads is excessive)
- Underestimating MySQL's I/O patterns
- Missing critical partitions like /var/log
For a 2TB RAID1 LAMP server handling 2GB uploads:
# fdisk -l output example
Disk /dev/sda: 2 TiB, 2199023255552 bytes
/dev/sda1 / 50G ext4
/dev/sda2 /var 800G ext4 # Apache docroot
/dev/sda3 /var/lib/mysql 300G xfs # Database optimized
/dev/sda4 /tmp 200G ext4 # PHP upload_tmp_dir
/dev/sda5 /home 50G ext4
/dev/sda6 /var/log 20G ext4 # Isolated logs
/dev/sda7 swap 4G swap
Notice the XFS for MySQL - here's why:
# MySQL config snippet
[mysqld]
innodb_file_per_table=1
innodb_flush_method=O_DIRECT
innodb_io_capacity=2000
# Requires XFS for optimal performance
For the PHP upload requirement:
# php.ini adjustments
upload_max_filesize = 2G
post_max_size = 2.1G
memory_limit = 256M
# Systemd tmpfile.d config
# /etc/tmpfiles.d/php-uploads.conf
D /tmp/php_uploads 1770 www-data www-data 1d
For RAID1 arrays, consider these mount options:
# /etc/fstab example
/dev/md0 /var/lib/mysql xfs defaults,noatime,nodiratime,logbsize=256k 0 2
/dev/md1 /var/www ext4 defaults,noatime,data=writeback,barrier=0 0 2
Set up these critical alerts:
- 90% full on /var/log
- IOwait > 20% on database partition
- inode usage > 80% on /tmp
When configuring a production server with a 2TB RAID 1 array for LAMP stack operations, the partitioning scheme must balance performance, security, and maintainability. The proposed layout shows good understanding of separation of concerns:
# Sample fdisk output showing partition structure
Disk /dev/sda: 2 TiB, 2199023255040 bytes
Device Start End Sectors Size Type
/dev/sda1 2048 2099199 2097152 1G Linux swap
/dev/sda2 2099200 211964927 209865728 100G Linux filesystem (/)
/dev/sda3 211964928 2319649279 2107684352 1000G Linux filesystem (/var)
/dev/sda4 2319649280 4095999999 1776350720 800G Linux filesystem (/tmp)
/dev/sda5 4096000000 4194303999 98304000 96G Linux filesystem (/home)
/var Allocation: The 1TB allocation is justified for several reasons:
- MySQL databases (typically /var/lib/mysql)
- Apache logs (/var/log/apache2)
- Package manager cache (/var/cache/apt)
- Mail spool (/var/mail)
For MySQL optimization, consider adding this to /etc/fstab:
/dev/sda3 /var ext4 noatime,nodiratime,data=writeback,barrier=0 0 1
The 800GB /tmp partition addresses PHP file uploads through these php.ini settings:
upload_max_filesize = 2048M
post_max_size = 2056M
upload_tmp_dir = /tmp/php_uploads
Create a dedicated tmpfs for session data:
tmpfs /tmp/php_sessions tmpfs defaults,noexec,nosuid,size=2G 0 0
For RAID 1 arrays, we can improve performance with these kernel parameters in /etc/sysctl.conf:
vm.swappiness = 10
vm.dirty_ratio = 15
vm.dirty_background_ratio = 5
Consider adding these mount options for the database partitions:
/dev/md0 /var/lib/mysql ext4 rw,noatime,nodiratime,data=writeback,stripe=256 0 2
For high-availability setups, consider:
- Using LVM for flexible resizing
- Separate /var/lib/mysql to dedicated partition
- Implementing XFS for large file operations
Example LVM setup:
pvcreate /dev/sda2 /dev/sda3 /dev/sda4
vgcreate vg_server /dev/sda2 /dev/sda3 /dev/sda4
lvcreate -L 100G -n lv_root vg_server
lvcreate -L 1T -n lv_var vg_server
lvcreate -L 800G -n lv_tmp vg_server