When managing ISPConfig 3 servers, bind mounts between /var/log/ispconfig/httpd/
and client web directories are crucial for proper log handling. The issue arises when:
# Original incorrect bind (before changes)
/var/log/ispconfig/httpd/mydomain.com /var/www/clients/client1/web1/log none bind,nobootwait 0 0
needs to be corrected to:
# Corrected bind (after changes)
/var/log/ispconfig/httpd/mydomain.com /var/www/clients/client1/web2/log none bind,nobootwait 0 0
The /etc/mtab
file is maintained automatically by the mount
command and reflects current mount points. Manual edits can cause:
- Mount point desynchronization
- Potential filesystem corruption
- Inconsistent system state
Here's the safe workflow to correct mount points without reboots:
# 1. Unmount the incorrect bind
sudo umount /var/www/clients/client1/web1/log
# 2. Update /etc/fstab with correct paths
sudo nano /etc/fstab
# 3. Apply changes without reboot
sudo mount -a
After making changes, verify with:
# Check current mounts
mount | grep bind
# Verify mtab consistency
cat /proc/mounts | grep bind
For bulk changes across multiple domains, use this bash script:
#!/bin/bash
# Correct bind mounts for ISPConfig log directories
OLD_PATH="/var/www/clients/client1/web1/log"
NEW_PATH="/var/www/clients/client1/web2/log"
sudo umount $OLD_PATH
sudo sed -i "s|$OLD_PATH|$NEW_PATH|g" /etc/fstab
sudo mount -a
Always test scripts in a staging environment before production use.
In rare cases where services maintain open file handles to the old mount points, consider:
# Restart dependent services
sudo systemctl restart apache2 nginx
When working with ISPConfig 3 on Ubuntu, bind mounts in /etc/fstab
and /etc/mtab
sometimes get out of sync with actual website directory structures after account modifications. The key symptom is logs being written to incorrect webX subdirectories.
/etc/mtab
is automatically maintained by the system and reflects currently mounted filesystems. Manual edits to mtab will be:
- Overwritten on next mount/umount operation
- Potentially cause system instability
- Not actually remount the filesystems
For your case with ISPConfig logs, here's the correct workflow:
# 1. Unmount the incorrect bind mounts
sudo umount /var/www/clients/client1/web1/log
sudo umount /var/www/clients/client1/web2/log
# 2. Verify mounts are cleared
mount | grep clients
# 3. Update ONLY /etc/fstab with correct paths
sudo nano /etc/fstab
# Change to:
/var/log/ispconfig/httpd/mydomain.com /var/www/clients/client1/web2/log none bind,nobootwait 0 0
/var/log/ispconfig/httpd/example.com /var/www/clients/client1/web3/log none bind,nobootwait 0 0
# 4. Remount all from fstab
sudo mount -a
# 5. Verify new mounts
ls -l /var/www/clients/client1/web2/log
ls -l /var/www/clients/client1/web3/log
For web server logs specifically, you may need to:
# Restart just the web server processes
sudo service nginx restart
sudo service apache2 restart
# Or for ISPConfig specifically
sudo ispconfig_server restart
Create a verification script /usr/local/bin/check_ispconfig_mounts.sh
:
#!/bin/bash
EXPECTED_MOUNTS=(
"/var/www/clients/client1/web2/log"
"/var/www/clients/client1/web3/log"
)
for mountpt in "${EXPECTED_MOUNTS[@]}"; do
if ! grep -qs "$mountpt" /proc/mounts; then
echo "WARNING: $mountpt not mounted!"
exit 1
fi
done
echo "All ISPConfig mounts OK"
exit 0
Then add to cron:
*/5 * * * * root /usr/local/bin/check_ispconfig_mounts.sh
In rare cases where mounts remain stuck, a reboot may help. But first try:
sudo lsof /var/www/clients/client1/web*/log
# Kill any processes using old mounts
sudo fuser -km /var/www/clients/client1/web1/log