Openvz - vzrepair- как примонтировать спасательную систему для контрейнера

Материал из Wiki - Iphoster - the best ever hosting and support. 2005 - 2024
Перейти к:навигация, поиск


Openvz - vzrepair- как примонтировать спасательную систему для контрейнера

Запустить восстановительную систему для контейнера:

# vzrepair --ctid 8121 --start
Thu Sep 21 20:25:35 2017 [info] 8121 status - CTID 8121 exist unmounted down
Thu Sep 21 20:25:35 2017 [info] Start repair for CTID 8121
Thu Sep 21 20:25:35 2017 [info] 1000008121 status - stat(/vz/root/1000008121): No such file or directory CTID 1000008121 deleted unmounted down
Thu Sep 21 20:25:35 2017 [info] Start create repair container whith ctid 1000008121
Thu Sep 21 20:25:35 2017 [info] Container have ostemplate "ubuntu-14.04-x86_64-minimal" and we use it
Thu Sep 21 20:25:35 2017 [info] Create repair container config file /etc/vz/conf/1000008121.conf
Thu Sep 21 20:25:35 2017 [info] Run create container 1000008121
Thu Sep 21 20:27:10 2017 [info] Repair container whith CTID 1000008121 created successfull
Thu Sep 21 20:27:10 2017 [info] Disabled container 8121
Thu Sep 21 20:27:10 2017 [info] Start repair container
Thu Sep 21 20:27:17 2017 [info] Start 1000008121 - OK
Thu Sep 21 20:27:17 2017 [info] Create /repair/ on 1000008121
Thu Sep 21 20:27:17 2017 [info] Mount 8121 disk to /repair/
Thu Sep 21 20:27:18 2017 [info] Add chroot-prepare script - ok
Thu Sep 21 20:27:18 2017 [info] Add custom motd - ok
Thu Sep 21 20:27:18 2017 [warning] We cannot get old password - use random password "ecntvduecuhmifjv"
Thu Sep 21 20:27:19 2017 [info] Password to 1000008121 set correctly
Thu Sep 21 20:27:19 2017 [info] Start repair whith ctid 1000008121 finished correctly. Do not forget stop repair, when it not need!

Данные для доступа будут:

root / ecntvduecuhmifjv
Все файлы будут в директории /repair

отключить восстановительную систему:

# vzrepair --ctid 8121 --stop



links:


Install
wget  --no-check-certificate https://raw.githubusercontent.com/FastVPSEestiOu/vzrepair/master/vzrepair.pl -O /usr/local/sbin/vzrepair
chmod +x /usr/local/sbin/vzrepair
wget --no-check-certificate https://raw.githubusercontent.com/FastVPSEestiOu/vzrepair/master/open_vestat_bash_completion -O /etc/bash_completion.d/vzrepair_bash_completion
Usage
vzrepair.pl [ --help ] < --ctid CTID > [ --start | --stop | --status ] 
Options
--help Print help message
--ctid Container CTID
--start Start repair - stop container if it running, create and start repair container, mount root.hdd from main container to /repair/
--password Used only whith --start . Set password to repair container. By default(without param) - use password from main container. If set "rand" - set random pass.
--template Used only whith --start . Set maunal template for repair container. Use $set_only_local_templates variable, for use it only with local templates or not
--stop Stop repair - stop and delete repair container
--status Show status - we have repair container for this CTID or not
--silent Not show debug output(json output be print)
--json Print json message, use it with --silent, to have only json output


Description
We use 1000000000+ number for repair CTIDs.
Repair CTID = CTID + 1000000000.
Hostname changed to "repair.HOSTNAME" on repair container.
In fact it create new container and mount ploop from needed container to /repair/ directory.
And it add to new container chroot-prepair script for more simple chroot in /repair/.
Please see check_and_change_ostemplate sub - it have rules for mutate ostemplate(used if you not set template via --template key)