Linux
OpenVZ
Ram sizes
cid=1000
vzctl set ${cid} --vmguarpages 64M --save
vzctl set ${cid} --oomguarpages 64M --save
vzctl set ${cid} --privvmpages 64M:128M --save
256MB Guaranteed, 512MB Burstable
cid=1000
vzctl set ${cid} --vmguarpages 256M --save
vzctl set ${cid} --oomguarpages 256M --save
vzctl set ${cid} --privvmpages 256M:512M --save
512MB Guaranteed, 1024MB Burstable
cid=1000
vzctl set ${cid} --vmguarpages 512M --save
vzctl set ${cid} --oomguarpages 512M --save
vzctl set ${cid} --privvmpages 512M:1024M --save
1024MB Guaranteed, 2048MB Burstable
cid=1000
vzctl set ${cid} --vmguarpages 1024M --save
vzctl set ${cid} --oomguarpages 1024M --save
vzctl set ${cid} --privvmpages 1024M:2048M --save
Grub Notes
To re-install grub manually (mostly for raid systems, if you want more than one drive to be bootable)
grub grub> device (hd0) /dev/sda grub> root (hd0,0) grub> setup (hd0) grub> setup (hd0) Checking if "/boot/grub/stage1" exists... yes Checking if "/boot/grub/stage2" exists... yes Checking if "/boot/grub/e2fs_stage1_5" exists... yes Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 15 sectors are embedded. succeeded Running "install /boot/grub/stage1 (hd0) (hd0)1+15 p (hd0,0)/boot/grub/stage2 /boot/grub/menu.lst"... succeeded Done. grub> quit
Repeat above for each drive. Note the (hd0,0) refers to the boot partion.
mdadm
Example: To replace a drive
Fail the drive you want to replace in the array, i.e.
mdadm --manage /dev/mdx --fail /dev/hdxy
shutdown the system, replace the drive.
If the drive is not already blank, you may need to remove any previous raid usage:
boot from cd, rescue mode.
For most commands to work you need an /etc/mdadm.conf.
This can be setup using "mdadm -E --scan >/etc/mdadm.conf"
To get the /etc/mdadm.conf file from the drives in the system.
madam --zero-superblock /dev/hdxy for each partionion.
remove the partitions, recreate from an existing drive
sfdisk -d /dev/hdx | sfdiisk /dev/hdy
start the array used by the root filesystem
madam -A /dev/md1 --force --run
add the new drive/partion to the root md device
madam --manage /dev/md1 --add /dev/hdxy
wait for rebuild
do the same for the /boot patron
finally any data partions you have, these can be done either from a rescue setup or after a reboot.
Growing encrypted disks
This example show a domU client, since the disk is allocated in the Dom0 using lvm, you need to grow that first!
[root@skype ~]# mkdir /data
[root@skype ~]# mount /dev/mapper/data /data
[root@skype ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/xvda 2064208 1499312 460040 77% /
tmpfs 98396 0 98396 0% /dev/shm
/dev/mapper/data 77403712 184220 73287612 1% /data
fdisk -l (to find the correct partion layout/names etc)
Disk /dev/xvdb: 268 MB, 268435456 bytes
255 heads, 63 sectors/track, 32 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/xvdb1 1 32 257008+ 82 Linux swap / Solaris
Disk /dev/xvdc: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/xvdc1 1 9790 78638143+ 83 Linux
Use fdisk to remove and re add a partition to grow the disk into
[root@skype ~]# fdisk /dev/xvdc
The number of cylinders for this disk is set to 13054.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p
Disk /dev/xvdc: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/xvdc1 1 9790 78638143+ 83 Linux
Delete and re add partition
Command (m for help): d Selected partition 1 Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-13054, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-13054, default 13054): Using default value 13054 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
Re Open the Luks Device
[root@skype ~]# cryptsetup luksOpen /dev/xvdc1 data Enter LUKS passphrase for /dev/xvdc1: padlock: VIA PadLock not detected. key slot 0 unlocked. Command successful.
Make sure crypto is aware of the new size
[root@skype ~]# cryptsetup resize data
Then resize it
[root@skype ~]# fsck.ext3 -f /dev/mapper/data e2fsck 1.39 (29-May-2006) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /data: 30743/9830400 files (0.1% non-contiguous), 546498/19659406 blocks [root@skype ~]# resize2fs /dev/mapper/data resize2fs 1.39 (29-May-2006) Resizing the filesystem on /dev/mapper/data to 26213926 (4k) blocks. The filesystem on /dev/mapper/data is now 26213926 blocks long.
And re-mount it ready for use
[root@skype ~]# mount /dev/mapper/data /data [root@skype ~]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/xvda 2064208 1499392 459960 77% / tmpfs 98396 0 98396 0% /dev/shm /dev/mapper/data 103210424 960112 97007532 1% /data