Correcting Mount information in a SUSE VE
After creating VPSs for 2 Suse templates (suse-9.3-x86_64 and opensuse-10-x86_64-default) I found that both showed incorrect mount information, both from the df -k command and the mount command. In both cases the /etc/fstab file had the wrong information.
I searched for evidence that others had found this problem, but didn't find any reports or posts. The answer to my problem was found in the document on Slackware Template Creation.
Before making the changes described below, one should stop the VPS, if it is running:
/usr/sbin/vzctl stop nnn
Look in the document section, Preparing the new VE Getting the filesystem ready to run in a VE. "Delete the file /etc/mtab and make it a symlink to /proc/mounts"
This is the key to solving the problem, because the VPS needs to get its mount information from /proc/mounts
rm /vz/private/nnn/etc/mtab ln -s /proc/mounts /vz/private/nnn/etc/mtab
Clean the /etc/fstab file
echo -n > /vz/private/nnn/etc/fstab
Slightly slower ways to accomplish the same goal are 1) edit the fstab file manually and delete all lines, or 2) with the commands:
rm -f /vz/private/nnn/etc/fstab touch /vz/private/nnn/etc/fstab (make sure the permissions on the new empty fstab file are the same as on the old one)
It was necessary to modify the procedure slightly because of minor differences between Slackware and Suse. Suse does not have an rc.S file. Instead it uses script files whose names start with bootxxx. Suse has 2 files in /etc/rc.d/ that need to be edited; these are bootlocalfs and bootrootfsck. The edit action is almost the same: put a # character before any line that has
rm -f /etc/mtab(*)
In one of these files, the line containing the remove command had some other files as well. I deleted /etc/mtab from this list.
The Slackware document contains a number of other procedures too, but I was primarily interested in solving the mount problem.
After the changes are made, the VPS can be started:
/usr/sbin/vzctl start nnn
Log into the VPS with ssh.
Check the file /etc/fstab to make sure it is still empty:
Check that the link exists from /proc/mounts to /etc/mtab
ls -l /etc/mtab
Verify that mount and df -k correctly show that simfs is mounted on / (the root filesystem) and has the correct disk allocation.