From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Sat, 12 Mar 2016 01:54:10 +0300 From: Michael Shigorin To: smoke-room@lists.altlinux.org Message-ID: <20160311225410.GF1119@imap.altlinux.org> Mail-Followup-To: smoke-room@lists.altlinux.org References: <56D69837.9070601@rambler.ru> <20160304165201.GZ1119@imap.altlinux.org> <56E1A99F.2010105@altlinux.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="1LKvkjL3sHcu1TtY" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23.88.hg577987ca2d02 (2014-03-12) Subject: Re: [room] =?koi8-r?b?0NLPINLB2s3F0iDLz9LO0SDXICByZWd1bGFyL3N0YXJ0?= =?koi8-r?b?ZXJraXRz?= X-BeenThere: smoke-room@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: =?koi8-r?b?69XM2NTV0s7ZyiDPxtTP0MnL?= List-Id: =?koi8-r?b?69XM2NTV0s7ZyiDPxtTP0MnL?= List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Mar 2016 22:54:10 -0000 Archived-At: List-Archive: --1LKvkjL3sHcu1TtY Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: 8bit On Fri, Mar 11, 2016 at 12:47:41PM +0600, Denis G. Samsonenko wrote: > >> Системы приходят и уходят, а хомяк остаётся. +1 > > Зависит от использования, в моём случае системы приходят > > только на другое железо. А хомяк перетаскивается rsync'ом по > > мере необходимости. > Ну, я пару раз убивал систему, что приходилось по новой > ставить. Ну и переход на x86-64 тоже как то раз пришлось > делать. На железо тоже новое переходил, а винчестер с хомяком > давно не менял. Стоит бэкапить. PS: всем спасибо за обсуждение, см. новый скриптик, кто не боится. --  ---- WBR, Michael Shigorin / http://altlinux.org   ------ http://opennet.ru / http://anna-news.info --1LKvkjL3sHcu1TtY Content-Type: application/x-sh Content-Disposition: attachment; filename="10-vm-profile.sh" Content-Transfer-Encoding: quoted-printable #!/bin/sh=0A=0A# swap size multiplicator (static for now)=0ASWAP_MUL=3D1=0A= =0A# root size multiplicators against the actual one for a LiveCD (if any)= =0AROOT_MUL_MIN=3D3/2=0AROOT_MUL_MAX=3D40=0A=0A# values below in gigabytes,= might be natural fractions=0ASWAP_MAX=3D8=0AROOT_MIN=3D1 # this is integer= (or improve the comparison below)=0AROOT_SIZE=3D5=0AHOME_SIZE=3D1/2 # this= will be marked to fill up free space=0A=0A# recalculate in kilobytes=0ASWA= P_MAX=3D$[1048576*$SWAP_MAX]=0AROOT_MIN=3D$[1048576*$ROOT_MIN]=0AROOT_SIZE= =3D$[1048576*$ROOT_SIZE]=0AHOME_SIZE=3D$[1048576*$HOME_SIZE]=0A=0A# swap = =3D=3D RAM (but not more than $SWAP_MAX Gb)=0Aswap_size=3D"$[`grep MemTotal= /proc/meminfo | sed 's/[^0-9]//g'`*$SWAP_MUL]"=0A[ "$swap_size" -gt "$SWAP= _MAX" ] && swap_size=3D"$SWAP_MAX"=0A=0A# don't do RAID in a VM, reduce swa= p to a minimum, root to reasonable=0Aif grep -qE "(101300b8)|(80eebeef)|(14= ad0405)" /proc/bus/pci/devices; then=0A methods=3D"plain"=0A swap_size=3D13= 1072 # 128M=0A ROOT_MUL_MAX=3D10=0Aelse=0A methods=3D"raid plain"=0Afi=0A= =0A# are we running off a LiveCD as a part of livecd-install?=0Aif [ -d /.r= o ]; then=0A root_size=3D"`df -Pk /.ro | tail -1 | { read d t u rest; echo = "$u"; }`"=0A [ "$root_size" -lt "$ROOT_MIN" ] && root_size=3D"$ROOT_MIN"=0A= root_min=3D"$[$root_size*$ROOT_MUL_MIN]"=0A root_max=3D"$[$root_size*$ROOT= _MUL_MAX]"=0Aelse=0A root_min=3D"$[1048576*$ROOT_SIZE]"=0A root_max=3D"$[$r= oot_min*$ROOT_MUL_MAX]"=0Afi=0A=0A# recalculate in 512-byte blocks for EVMS= =0Aswap_size=3D"$[$swap_size*2]"=0Ahome_size=3D"$[$HOME_SIZE*2]"=0Aroot_min= =3D"$[$root_min*2]"=0Aroot_max=3D"$[$root_max*2]"=0A=0Amax_disk=3D"$(sort -= rn /sys/block/[hs]d*/size | head -1)" # in 512-byte sectors=0Aif [ -n "$max= _disk" ]; then=0A root_cap=3D"$[$max_disk-4*$home_size-$swap_size]"=0A [ "$= root_max" -gt "$root_cap" ] && root_max=3D"$root_cap"=0Afi=0A=0Aif [ "$root= _min" -gt "$root_max" ]; then=0A root_max=3D"$root_min"=0A swap_size=3D32 #= 16M=0Afi=0A=0Acat > /var/cache/alterator/vm-profile.scm << _EOF_=0A((works= tation=0A (title . "Setup for workstation")=0A (action . trivial)=0A (ac= tiondata=0A ("swap" (size 0 . $swap_size) (fsim . "SWAPFS") (methods pla= in))=0A ("/" (size $root_min . $root_max ) (fsim . "Ext2/3") (methods= plain))=0A ("/home" (size $home_size . #t) (fsim . "Ext2/3") (methods $m= ethods)))))=0A_EOF_=0A --1LKvkjL3sHcu1TtY--