|Free Software at Schools: Installing and Maintaining a Debian-Edu Network; Also Known as Skolelinux|
|Prev||Chapter 8. Fine-tuning[id=finetuning]||Next|
At the moment, there are 7 partitions of the lvm type in Skolelinux/Debian-edu. They are grouped in two different vg's, vg_system and vg_data:
All installed programs are placed in this partition. If this partition is full, you can't add new packages to the system.
The resizing of this partition is a bit tricky.
The tricky part about resizing this partition is that you have to unmount the partition that you are using, which is kind of like sawing off a tree branch that you are sitting on. However, we can manage it by using a neat little trick- switching to the shell ash. First, you need to bring the machine down to runlevel 1, then you switch to the shell ash.
First of all, you need to tell all your users that they have to logout, otherwise they will be forcibly logged out, then type
init 1from the command line
The machine is now in runlevel 1. Login as user root and switch to another shell
exec /bin/ashYou will recognise that you are using a different shell by the prompt, which looks like: \h:w\$. If you make a typo in the shell ash, you have to start writing the command all over again, because the BACKSPACE and Arrow keys don't work here. You start all over with CTRL-C
First you need to notice the current size of /usr before you change it df -h /usr
Filesystem Size Used Avail Use% Mounted on /dev/vg_system/lv_usr 1.0G 400M 600M 40% /usr
Then have a look at how much free space there is in vg_system
Look for a line such as:
Free PE / Size 175 / 5.47 GB
Then you unmount the partition (Note: the command for unmount is umount)
Then, to be on the safe side, do a check of the file system
fsck -yf /dev/vg_system/lv_usr
If you found, when checking the space available in vg_system, something like this:
Free PE / Size 175 / 5.47 GBthen you have 5.47GB free space that you can use to extend lv_usr
If you want to increase the size with 1GB, then this is the command to use:
e2fsadm -L +1G /dev/vg_system/lv_usr
If you want to increase the size with 100MB, then this is the command to use:
e2fsadm -L +100M /dev/vg_system/lv_usr
If you want to decrease the size with 250MB, then this is the command to use:
e2fsadm -L -250M /dev/vg_system/lv_usr. Due to the bug 
Watch for this pattern when resizing:
resize2fs 1.27 (8-Mar-2002) Begin pass 1 (max = 2564) Extending the inode table XXXXXXXXXXXXXXXXXXXXXXXXXXX Begin pass 2 (max = 160) Relocating blocks XXXXXXXXXXXXXXXXXXXXXXXXXXX Begin pass 3 (max = 52) Scanning inode table XXXXXXXXXXXXXXXXXXXXXXXXXXX Begin pass 5 (max = 9) Moving inode table XXXXXXXXXXXXXXXXXXXXXXXXXXX
If you do not see on your screen a long line of uppercase Xs, like this:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXwhen you resize a partition, then something has gone wrong.
If something has gone wrong, you can try to mount, and the unmount the partition again, and then try to resize it again, but do not try to resize it with the same amount as last time.
If you have to resize your partition a second time, because the first try failed, then you should try to resize it with only 32MB, because it will "remember" the size you tried to resize it with the first time, and will use that value in addition to the amount you specify the second time. So, if you failed resizing the first time using +1200M, and try again with +1200M, the net effect will be +2400M, probably not what you wanted. If you try with +32M in the second try, then the net effect will be +1232M, which is probably close to what you wanted.
If the resize was successful, then you can mount the partition with mount /usr. Then check the new size of the partition with df -h /usr. In this case it should look something like:
Filesystem Size Used Avail Use% Mounted on /dev/vg_system/lv_usr 2.0G 400M 1.6G 20% /usr
Now you can restart the machine with init 6, and your users can logon.
A: This is most likely due to the fact that a user, or a program, is using that partition. If you are trying to unmount /skole/tjener/home0, then it is possible that not all of your users have logged out. If you are trying to unmount /var, then you must first unmount the partition /var/opt/ltsp/swapfiles. If the device is still busy, then if possible, try to bring the machine down to runlevel 1, init 1 .
A: This might be bug #439; the solution is to remember to check and repair the file system before you try to change it, fsck -fy. Then you try a second time to resize the partition, but don't try to change it with more than 32M, use e2fsadm -L +32M.
A: The only solution I know of, is to restart the machine hard, which means to use the power button to turn the machine off and then on again. This problem could have been avoided if you had used init 6, or reboot after you had resized the partition in runlevel 1, and not just used the exit.
This lv belongs to vg_data. It's only present in the profile mainserver
This is the partition where the users' home directories are stored.
The resizing of /skole/tjener/home0 is done pretty much the same way as with /usr. As a matter of fact it's much easier, since it doesn't involve changing to runlevel 1 or changing the shell. I'll briefly mention the relevant commands; see resize /usr for more info.
Login as root, and tell all your users they must logout.
Check the current size of your partition,df -h /skole/tjener/home0
Unmount the partition, umount /skole/tjener/home0
Check and repair the file system, fsck -fy /skole/tjener/home0
Check the amount of available space in the volume group,vgdisplay /dev/vg_data. You can also use pvscan
Resize the partition, in this example it's increased with 400M, e2fsadm -L +400M /dev/vg_data/lv_home0
Mount the partition, mount /skole/tjener/home0
Check the new size of the partition, df -h /skole/tjener/home0
This lv belongs to vg_data. It's only present in the profile mainserver
This is the default partition used for placing the backups made and administered with the Skolelinux/Debian-edu-developed Webmin module slbackup.
Resizing this partition is very similar to resizing /skole/tjener/home0. See Section 8.5.2- it belongs to the same vg-group, vg_data.
If you want to increase /skole/backup with 600MB, the command would be
e2fsadm -L +600M /dev/vg_data/lv_backup
The resizing of this partition is done in a similar way to the resizing of /usr, except that you don't need to switch to another shell. But you must remember to unmount the partition /var/opt/ltsp/swapfiles if this is done a machine with the profile Thinclientserver installed. See swapfiles
If you want to increase /var with 400MB, the command would be
e2fsadm -L +400M /dev/vg_system/lv_var
This lv belongs to vg_system. It's only present in the profile thinclientserver
This partition is resized similarly to /skole/tjener/home0.
A reasonable size for this partition would be 32MB times the number of thin clients you plan to have. If you try to boot more thin clients with swapfiles than you have space for in /var/opt/ltsp/swapfiles, then the thin client will not boot.
These swapfiles will be placed in /var/opt/ltsp/swapfiles, with the file names ltsp010.swap, ltsp011.swap,ltsp012.swap. If you delete these swapfiles, they will be created again next time the thin client boots.
If you want to increase /var/opt/ltsp/swapfiles with 600MB, the command would be
e2fsadm -L +600M /dev/vg_system/lv_ltsp_swap
Unless you first umount the partition /var before trying to change this partition, you will not succeed. You will then only get the message
device is busy. If you see this, make sure you have first umounted /var
This lv belongs to vg_system and it's only present in the profile mainserver. This partition hold the cache belonging to squid, which is a FTP, HTTP and HTTPS proxy cache. This partition is changed the same way as swapfiles. Make sure you stop squid before you try to resize,
/etc/init.d/squid stopotherwise you only end up with
umount: /var/spool/squid: device is busy
The maximum size of this cache is default set to 100MB; look in the file /etc/squid.conf for the line
# cache_dir ufs /var/spool/squid 100 16 256
For things such as video and picture, as well as users that need extra file space, you might need to create a new volume. Let's pretend you need a volume for our video footage. Let us name it video, and place it in vg_data as /dev/vg_data/lv_video, and mount it at /skole/video
First you need to find out how much space you have available in vg_data
vgdisplay /dev/vg_dataor maybe there is more space in vg_system
vgdisplay /dev/vg_systemAnother option that displays the same kind of information is
You must create the mount point /skole/video
mkdir /skole/videoThen you create the new volume
lvcreate -L 2G -n lv_video vg_dataIn this example, the size is 2GB. Have a look at lvm-home0 to find out how to resize this. Then you need to make a file system
mke2fs -j /dev/vg_data/lv_video
Then add this new partition, using your favourite texteditor, to /etc/fstab, otherwise this new partition won't be mounted automatically at boot. In our example you add this line at the end of /etc/fstab
/dev/vg_data/lv_video /skole/video ext3 defaults 0 2
Now you test your new partition by mounting it manually with mount /skole/video. Have a look at the size with
df -h /skole/video
This has not yet been tested with the new LDAP schemas that comes with Skolelinux/Debian-edu 1.0.
Skolelinux/Debian-edu uses autofs to export partitions to machines that might need them, workstation and thinclientserver needs to be able to mount the users home directories. So, if you have made another home partition, for example /skole/tjener/home1 and /skole/tjener/home2 then you must make sure that they are also exported along with /skole/tjener/home0 via auofs to the needed machines. The necessary information lies in the LDAP-database, so we must add this new information the LDAP-database. This is most easily done by adding this new information to a file, and then adding the contents of this file to our LDAP-database. Let's call this file /root/video.ldif, with these contents:
dn: cn=video,ou=tjener,ou=skole,ou=Automount,dc=skole,dc=skolelinux,dc=no objectClass: top objectClass: automount cn: video automountInformation: -rw,rsize=8192,wsize=8192,intr tjener:/skole/video description: /skole/video mount pointThis is the info that you want to add, like this:
slapadd -l /root/video.ldif
In addition, this partition must be added to the export file by adding the following line to the file /etc/exports
/skole/video @allhosts(rw) 10.0.2.0/255.255.254.0(rw)After that you must run exportfs -ra
This is a short recipe; additional details will be available at a later date.
Hook up the new disk to the system. In this example, it becomes /dev/hdb, and you want to add it to the volume group vg_data
Check with pvscan what the devfs-path to your new disc is
vgextend vg_data /dev/ide/host0/bus0/target1/disc
To remove the disk again from the vg-group, unmount all partitions, and then do a
vgreduce vg_data /dev/ide/host0/bus0/target1/disc
There have been discussions about adding further partitions, such as one for /var/log/squid. This has been done in version 1.0r1
This check and repair is also done as a part of the resizing process by the command e2fsadm, but it's better to be on the safe side.
http://bugs.skolelinux.no/show_bug.cgi?id=439, you need to be a bit careful when resizing partitions.
The thin clients must have their MAC address locked to an IP address in /etc/dhcp3/dhcpd-skolelinux in order to get a swapfile.
The size of these swapfiles, and whether they are enabled or not, is defined in /opt/ltsp/i386/etc/lts.conf. Look for the lines SWAPFILE_SIZE=32m and USE_NFS_SWAP =
As of Skolelinux/Debian-edu pr47, all machines that you want to export must be members of a netgroup. See Section 8.6. The line will then look like this /skole/video @ltsp-server-hosts(rw) @workstation-hosts(rw) @server-hosts(rw)