About
In Virtuozzo 6 and 7 the Memory Deduplication is provided by File Cache which includes the pfcached
daemon and a ploop image mounted to a directory on the server. The file cache ploop contains copies of eligible files located inside containers. To be eligible for caching, files in containers must meet certain configurable requirements, e.g., be read in a certain number of containers, be of certain size, be stored in certain directories in containers.
Symptoms
Sometimes it could be useful to move pfcache ploop image to another place, for example if it resides on a slow disk drive or requires more diskspace than available on the currently underlying disk.
Resolution
This example demonstrates how to move pfcache from /vz to /$new_location partition.
Important: Before you start make sure the filesystem containing /$new_location has "lazytime" mount option.
# findmnt --target /$new_location
Output example:
# findmnt --target /$PATH/disk1
TARGET SOURCE FSTYPE OPTIONS
/$PATH/disk1 /dev/sde1 ext4 rw,noatime,lazytime,barrier=1,data=ordered
If you do not see "lazytime" mount option, add it:
- remount the filesystem with "lazytime" mount option on the fly:
# mount -o remount,lazytime /$new_location
- update appropriate /etc/fstab entry to make the changes permanent
Part 1: Disabling existing pfcache
1. Stop pfcache service
- for the Virtuozzo 6:
~# service pfcached stop
- for the Virtuozzo 7:
~# systemctl stop pfcached.service
2. Remount all ploop devices without pfcache option:
~# grep pfcache= /proc/mounts /dev/ploop57184p1 /vz/root/103 ext4 rw,relatime,barrier=1,data=ordered,balloon_ino=12,pfcache_csum,pfcache=/vz/pfcache 0 0 /dev/ploop24447p1 /vz/root/104 ext4 rw,relatime,barrier=1,data=ordered,balloon_ino=12,pfcache_csum,pfcache=/vz/pfcache 0 0
~# awk '/pfcache=/{print $1" "$2}' /proc/mounts | while read ploop mpoint ; do mount -n -t ext4 -o remount,nopfcache $ploop $mpoint ; done
~# grep pfcache= /proc/mounts ...there should be no output here...
3. Unmount pfcache ploop:
~# ploop umount /vz/pfcache.hdd/DiskDescriptor.xml
At this point you will get the pfcache stopped.
Part 2: Moving the pfcache to another partition and starting it
1. Move the pfcache.hdd to /$new_location partition*:
~# mv /vz/pfcache.hdd /$new_location
*replace /$new_location in the command above with the real path
2. Correct global configuration file to reflect this change:
- on Virtuozzo 6, correct lines in /etc/sysconfig/vz:
PFCACHE_IMAGE="/$new_location/pfcache.hdd" PFCACHE="/$new_location/pfcache"
- on Virtuozzo 7, correct lines in /etc/vz/pfcache.conf:
PFCACHE_IMAGE="/$new_location/pfcache.hdd" PFCACHE="/$new_location/pfcache"
3. Mount pfcache from the new location:
~# ploop mount -m /vz/pfcache /$new_location/pfcache.hdd/DiskDescriptor.xml
4. Remount all ploop devices with pfcache:
~# grep ploop /proc/mounts | grep -v ' /vz/pfcache ' /dev/ploop57184p1 /vz/root/103 ext4 rw,relatime,barrier=1,data=ordered,balloon_ino=12,pfcache_csum 0 0 /dev/ploop24447p1 /vz/root/104 ext4 rw,relatime,barrier=1,data=ordered,balloon_ino=12,pfcache_csum 0 0
~# awk '/^\/dev\/ploop/&&!/ \/vz\/pfcache /{print $1" "$2}' /proc/mounts | while read ploop mpoint ; do mount -t ext4 -o remount,pfcache=/vz/pfcache $ploop $mpoint ; done
~# grep pfcache= /proc/mounts /dev/ploop57184p1 /vz/root/103 ext4 rw,relatime,barrier=1,data=ordered,balloon_ino=12,pfcache_csum,pfcache=/vz/pfcache 0 0 /dev/ploop24447p1 /vz/root/104 ext4 rw,relatime,barrier=1,data=ordered,balloon_ino=12,pfcache_csum,pfcache=/vz/pfcache 0 0
Note: if the mount point for pfcache was changed from the default value /vz/pfcache
, use the appropriate value in the commands in the steps 6 and 7.
5. Start pfcache service
- for Virtuozzo 6:
~# service pfcached start
- For Virtuozzo 7:
~# systemctl start pfcached.service