Changeset 562 in MondoRescue for branches/stable/mondo-doc
- Timestamp:
- May 20, 2006, 10:31:41 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo-doc/mondorescue-howto.sgml
r543 r562 40 40 <affiliation> 41 41 <orgname>MondoRescue Project</orgname> 42 <address><email>bcornec@users.berlios.de</email></address> 42 <address><email>bruno@mondorescue.org</email></address> 43 </affiliation> 44 </author> 45 <author> 46 <firstname>Conor</firstname> 47 <surname>Daly</surname> 48 <affiliation> 49 <orgname>MondoRescue Project</orgname> 50 <address><email>conor.daly_at_met.ie</email></address> 43 51 </affiliation> 44 52 </author> … … 54 62 <copyright> 55 63 <year>2000-2006</year> 56 <holder role="mailto:b cornec@users.berlios.de">Bruno Cornec</holder>64 <holder role="mailto:bruno@mondorescue.org">Bruno Cornec</holder> 57 65 </copyright> 58 66 … … 77 85 78 86 <revhistory> 87 <revision> 88 <revnumber>2.0.7</revnumber> 89 <date>2006-05-16</date> 90 <authorinitials>Bruno Cornec</authorinitials> 91 <revdescription> 92 <para> 93 Integration of a chapter on HOWTO run mondo interactively using cron written by Conor Daly 94 </para> 95 </revdescription> 96 </revision> 79 97 <revision> 80 98 <revnumber>2.06</revnumber> … … 466 484 467 485 bash# mindi 486 </entry> 487 </row> 488 <row> 489 <entry> 468 490 bash# cd /root/images/mindi 469 491 … … 547 569 548 570 bash# mkdir -p /mnt/nfs 571 </entry> 572 </row> 573 <row> 574 <entry> 549 575 bash# mount 192.168.1.28:/home/nfs /mnt/nfs 550 bash# mondoarchive -OVn 192.168.1.28:/home/nfs -gF[...] 551 bash# umount /mnt/nfs 552 bash# cdrecord dev=0,0,0 speed=4 -eject -v /root/images/mindi/mindi.iso 576 </entry> 577 </row> 578 <row> 579 <entry> 580 bash# mondoarchive -OVn 192.168.1.28:/home/nfs -gF[...] 581 </entry> 582 </row> 583 <row> 584 <entry> 585 bash# umount /mnt/nfs 586 </entry> 587 </row> 588 <row> 589 <entry> 590 bash# cdrecord dev=0,0,0 speed=4 -eject -v /root/images/mindi/mindi.iso 553 591 554 592 </entry> … … 939 977 940 978 bash# cd /tmp 979 </entry> 980 </row> 981 <row> 982 <entry> 941 983 bash# tar -zxvf mindi-1.x.tgz 942 bash# cd mindi-1.x 984 </entry> 985 </row> 986 <row> 987 <entry> 988 bash# cd mindi-1.x 989 </entry> 990 </row> 991 <row> 992 <entry> 943 993 bash# ./install.sh 944 994 … … 957 1007 958 1008 bash# rpm -Uvh /tmp/mindi-1.x-x.i386.rpm 1009 </entry> 1010 </row> 1011 <row> 1012 <entry> 959 1013 960 1014 or 1015 </entry> 1016 </row> 1017 <row> 1018 <entry> 961 1019 962 1020 bash# dpkg -i /tmp/mindi-1.x-x.deb … … 981 1039 982 1040 bash# cd /tmp 1041 </entry> 1042 </row> 1043 <row> 1044 <entry> 983 1045 bash# tar -zxvf mondo-2.xx.tgz 984 bash# cd mondo-2.xx 985 bash# make && make install 1046 </entry> 1047 </row> 1048 <row> 1049 <entry> 1050 bash# cd mondo-2.xx 1051 </entry> 1052 </row> 1053 <row> 1054 <entry> 1055 bash# make && make install 986 1056 987 1057 </entry> … … 1000 1070 1001 1071 bash# rpm -Uvh /tmp/mondo-2.x-x.i386.rpm 1072 </entry> 1073 </row> 1074 <row> 1075 <entry> 1002 1076 1003 1077 or 1078 </entry> 1079 </row> 1080 <row> 1081 <entry> 1004 1082 1005 1083 bash# dpkg -i /tmp/mondo-2.x-x.deb … … 1053 1131 create boot disks, and to create a bootable CD image:</para> 1054 1132 <para></para> 1055 <informaltable><tgroup cols="1"><tbody> 1056 <row> 1057 <entry> 1133 <screen> 1058 1134 1059 1135 # mindi … … 1122 1198 # 1123 1199 1124 </entry> 1125 </row> 1126 </tbody></tgroup></informaltable> 1200 </screen> 1127 1201 1128 1202 <para>If your kernel is too large (more than about 900KB) then you … … 1139 1213 1140 1214 bash# cd /root/images/mindi 1215 </entry> 1216 </row> 1217 <row> 1218 <entry> 1141 1219 bash# cdrecord -scanbus 1142 1220 … … 1238 1316 <para>Find the speed/compression 1239 1317 compromise that best suits your needs. Here maximum (-9) compression level is used.</para> 1240 <para>If you are using cron then please use -F to make sure that 1241 Mondo does not prompt you to create bootable floppy disks. Cron 1242 does not handle user interaction well because it pipes stdin and 1243 stdout specially. Please consult cron's manual for more 1244 information. Jesse Keating has written a script for cron/Mondo 1245 users. It is available on the 1246 <ulink url="http://www.mondorescue.org/docs/docs.html">Documentation</ulink> 1247 page.</para> 1318 <para>If you are using cron then please consult the chapter that Conor Daly has dedicated to that <link linkend="backup-cron">topic</link> 1319 </para> 1248 1320 </sect1> 1249 1321 … … 1358 1430 1359 1431 bash# mount 192.168.1.3:/home/nfs -t nfs /mnt/nfs 1432 </entry> 1433 </row> 1434 <row> 1435 <entry> 1360 1436 bash# mondoarchive -OVn 192.168.1.3:/home/nfs -g -s 200m 1437 </entry> 1438 </row> 1439 <row> 1440 <entry> 1361 1441 bash# umount /mnt/nfs 1362 1442 … … 1374 1454 your mindi package. 1375 1455 </para> 1456 </sect2> 1457 </sect1> 1458 </chapter> 1459 1460 <chapter id="backup-cron"> 1461 <title>HOWTO run mondo interactively using cron</title> 1462 1463 <sect1 id="backup-cron-overview"> 1464 <title>Overview</title> 1465 1466 <para> 1467 Mondoarchive is designed to run interactively (at least where 1468 media changes are necessary). Cron does not allow user interaction 1469 with a job. This section addresses the problem by using screen as a 1470 wrapper for mondo. 1471 </para> 1472 <para> 1473 This section is Copyright 2003 Conor Daly. 1474 </para> 1475 </sect1> 1476 <sect1 id="backup-cron-intro"> 1477 <title>Introduction</title> 1478 1479 <para> 1480 Mondoarchive is designed to run interactively. That's not strictly 1481 true, if you run mondoarchive without the '-g' switch, it will just 1482 run. However, there is a problem where media changes are necessary. 1483 The user must change the media and tell mondoarchive that the change 1484 has been done. The problem lies in the fact that cron does not allow 1485 user interaction with a job. If you schedule a mondoarchive job via 1486 cron, you better be sure it needs only one media. in practical terms, 1487 this means using tapes or ISOs (if CD-R(W) is your backup medium). 1488 However, for tape users, there's always the possibility that the 1489 backup will overflow the tape while for CD-R(W) users, there is the 1490 added hassle of burning the ISOs in the morning. If your CD_R(W) 1491 backup routinely occupies more than one media, this is not for you 1492 (use the ISO option and burn the CDs in the morning). This HOWTO 1493 addresses the problem by using screen as a wrapper for mondo. 1494 </para> 1495 </sect1> 1496 <sect1 id="backup-cron-who"> 1497 <title>Who should read this?</title> 1498 <sect2><title>Insurance</title> 1499 <para> 1500 Mondo users who wish to automate the backup and whose backups 1501 routinely occupy close to one media are the best audience. If you 1502 backup to tape, the occasion will arise when the backup will overflow 1503 your tape. In this instance, mondoarchive will ask for another tape. 1504 If you're using cron to start the backup, you won't be able to tell 1505 mondo that the new tape is mounted and the backup will fail. If you 1506 backup to CD-R(W), the same situation will arise but sooner. 1507 </para> 1508 </sect2> 1509 <sect2><title>Efficiency</title> 1510 <para> 1511 If your backup already occupies two media, this method will allow 1512 as much of the backup as possible to proceed during quiet periods. 1513 Time the backup to start wich enough time to complete the first media 1514 shortly before the operator arrives for work. The next media can 1515 be mounted and the backup completed asap and minimises the time for 1516 which users are inconvenienced by the backup (eg. database locked...). 1517 </para> 1518 </sect2> 1519 </sect1> 1520 <sect1 id="backup-cron-problem"> 1521 <title>The Problem</title> 1522 <sect2><title>Cron's environment</title> 1523 <para> 1524 When a user submits a job with cron, their environment is not 1525 preserved. This is reasonable since cron jobs are typically ongoing 1526 and may be adversely affected if the user's environment changes subsequent 1527 to the cron submission. Thus, a cron job should call a script that 1528 set's up the correct environment before starting the user's desired 1529 program. The 'at' command does this nicely. 1530 </para> 1531 </sect2> 1532 <sect2><title>Interactivity</title> 1533 <para> 1534 When a job is started with cron, it runs as a background process. 1535 No interaction with the program is possible (unless it is capable 1536 of interacting via a FIFO or some such) except termination via its 1537 pid. The only program that I know of that allows such interaction 1538 and serves as a wrapper for other prrocesses is 'screen' 1539 </para> 1540 </sect2> 1541 <sect2><title>Screen</title> 1542 <para> 1543 There's one little problem with screen though. It expects to 1544 attach to a terminal when it first starts. This won't happen under 1545 cron so screen will fail. Fortunately, screen comes with a "start 1546 detached" option. 1547 </para> 1548 </sect2> 1549 </sect1> 1550 <sect1 id="backup-cron-solution"> 1551 <title>The Solution</title> 1552 <sect2><title>Briefly</title> 1553 <para> 1554 <itemizedlist> 1555 <listitem> 1556 <para>Use 'at' to run your usual mondoarchive command</para> 1557 </listitem> 1558 <listitem> 1559 <para>Grab the script generated by 'at' and make a copy of it</para> 1560 </listitem> 1561 <listitem> 1562 <para>Edit that script to use 'screen -m -d <your mondoarchive command>'</para> 1563 </listitem> 1564 <listitem> 1565 <para>Run that script from your crontab</para> 1566 </listitem> 1567 <listitem> 1568 <para>Use 'screen -r' to attach to the mondo screen to change CDs</para> 1569 </listitem> 1570 <listitem> 1571 <para>Use '<CTRL>-a d' to detach the screen again</para> 1572 </listitem> 1573 </itemizedlist> 1574 </para> 1575 </sect2> 1576 <sect2><title>In Detail</title> 1577 <sect3><title>at</title> 1578 <para> 1579 Use the 'at' command to submit your usual mondoarchive command. 1580 My mondoarchive command is: 1581 </para> 1582 <informaltable><tgroup cols="1"><tbody> 1583 <row> 1584 <entry> 1585 1586 # mondoarchive -D -Ow 10 -S /home/mondo/ -T /home/mondo/ -g \ 1587 -E "\"/home/cdaly/GIS/W2K /home/mondo/\"" -9 1588 1589 </entry> 1590 </row> 1591 </tbody></tgroup></informaltable> 1592 <para> 1593 To submit the mondoarchive command with 'at' do: 1594 </para> 1595 <informaltable><tgroup cols="1"><tbody> 1596 <row> 1597 <entry> 1598 1599 # at now + 5 min 1600 mondoarchive -D -Ow 10 -S /home/mondo/ -T /home/mondo/ -g \ 1601 -E "\"/home/cdaly/GIS/W2K /home/mondo/\"" -9 1602 <CTRL>-d 1603 </entry> 1604 </row> 1605 </tbody></tgroup></informaltable> 1606 <para> 1607 1608 This generates a script in /var/spool/at/ which sets up your 1609 environment and runs your command. Grab this script to become your 1610 cron job. 1611 </para> 1612 </sect3> 1613 <sect3><title>Grab the 'at' script</title> 1614 <para> 1615 Make a copy of the script generated by the 'at' command to use 1616 as the basis for your cron job. 1617 </para> 1618 <informaltable><tgroup cols="1"><tbody> 1619 <row> 1620 <entry> 1621 1622 grep mondo /var/spool/at/* 1623 </entry> 1624 </row> 1625 <row> 1626 <entry> 1627 cp /var/spool/at/<file-from-grep> /root/mondo-cronscript 1628 </entry> 1629 </row> 1630 </tbody></tgroup></informaltable> 1631 <para> 1632 1633 You'll need to edit this. 1634 </para> 1635 </sect3> 1636 <sect3><title>Edit mondo-cronscript</title> 1637 <para> 1638 To use screen, you'll need to edit the cronscript and add the 1639 screen command. My mondo-cronscript looks like: 1640 </para> 1641 <screen> 1642 1643 #!/bin/sh 1644 # atrun uid=0 gid=0 1645 # mail cdaly 0 umask 22 1646 PWD=/root; export PWD 1647 XAUTHORITY=/root/.xauthyOrD4f; export XAUTHORITY 1648 HOSTNAME=bofh.irmet.ie; export HOSTNAME 1649 PVM_RSH=/usr/bin/rsh; export PVM_RSH 1650 QTDIR=/usr/lib/qt-2.3.1; export QTDIR 1651 LESSOPEN=\|/usr/bin/lesspipe.sh\ %s; export LESSOPEN 1652 XPVM_ROOT=/usr/share/pvm3/xpvm; export XPVM_ROOT 1653 KDEDIR=/usr; export KDEDIR 1654 USER=root; export USER 1655 LS_COLORS=no=00:fi=00:di=01\;34:ln=01\;36:pi=40\;33:so=01\;35:bd=40\;33\;01:cd=40\;33\;01:or=01\;05\;37\;41:mi=01\;05\;37\;41:ex=01\;32:\*.cmd=01\;32:\*.exe=01\;32:\*.com=01\;32:\*.btm=01\;32:\*.bat=01\;32:\*.sh=01\;32:\*.csh=01\;32:\*.tar=01\;31:\*.tgz=01\;31:\*.arj=01\;31:\*.taz=01\;31:\*.lzh=01\;31:\*.zip=01\;31:\*.z=01\;31:\*.Z=01\;31:\*.gz=01\;31:\*.bz2=01\;31:\*.bz=01\;31:\*.tz=01\;31:\*.rpm=01\;31:\*.cpio=01\;31:\*.jpg=01\;35:\*.gif=01\;35:\*.bmp=01\;35:\*.xbm=01\;35:\*.xpm=01\;35:\*.png=01\;35:\*.tif=01\;35:; export LS_COLORS 1656 MACHTYPE=i386-redhat-linux-gnu; export MACHTYPE 1657 MAIL=/var/spool/mail/root; export MAIL 1658 INPUTRC=/etc/inputrc; export INPUTRC 1659 BASH_ENV=/root/.bashrc; export BASH_ENV 1660 LANG=en_US; export LANG 1661 LOGNAME=root; export LOGNAME 1662 SHLVL=1; export SHLVL 1663 II_SYSTEM=/usr/local/ingres; export II_SYSTEM 1664 USERNAME=root; export USERNAME 1665 HOSTTYPE=i386; export HOSTTYPE 1666 OSTYPE=linux-gnu; export OSTYPE 1667 HISTSIZE=1000; export HISTSIZE 1668 LAMHELPFILE=/etc/lam/lam-helpfile; export LAMHELPFILE 1669 PVM_ROOT=/usr/share/pvm3; export PVM_ROOT 1670 HOME=/root; export HOME 1671 SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass; 1672 export SSH_ASKPASS 1673 PATH=/usr/local/ingres/ingres/bin:/usr/local/ingres/ingres/utility:/usr/kerberos/sbin:/usr/kerberos/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin/X11:/usr/X11R6/bin:/root/bin; export PATH 1674 cd /root || { 1675 echo 'Execution directory inaccessible' >&2 1676 exit 1 1677 } 1678 screen -m -d mondoarchive -D -Ow 10 -S /home/mondo/ -T \ 1679 /home/mondo/ -g -E "\"/home/cdaly/GIS/W2K /home/mondo/\"" -9 1680 #done 1681 1682 </screen> 1683 <para> 1684 The crucial line is this one: 1685 </para> 1686 <informaltable><tgroup cols="1"><tbody> 1687 <row> 1688 <entry> 1689 screen -m -d mondoarchive -D -Ow 10 -S /home/mondo/ -T \ 1690 /home/mondo/ -g -E "\"/home/cdaly/GIS/W2K /home/mondo/\"" -9 1691 </entry> 1692 </row> 1693 </tbody></tgroup></informaltable> 1694 <para> 1695 This uses 'screen -m -d' to <quote>-m -d Start screen in "detached" mode. This creates a new session 1696 but doesn't attach to it. This is useful for system startup scripts. 1697 (From 'man screen') 1698 </quote> 1699 </para> 1700 <para> 1701 When screen starts, it will be in the background and "detached". 1702 </para> 1703 </sect3> 1704 <sect3><title>Run the thing with cron</title> 1705 <para> 1706 To get the whole thing running, do: 1707 </para> 1708 <informaltable><tgroup cols="1"><tbody> 1709 <row> 1710 <entry> 1711 crontab -e 1712 </entry> 1713 </row> 1714 </tbody></tgroup></informaltable> 1715 <para> 1716 and add the following lines: 1717 </para> 1718 <informaltable><tgroup cols="1"><tbody> 1719 <row> 1720 <entry> 1721 # run mondoarchive at 23:59 weekdays 1722 </entry> 1723 </row> 1724 <row> 1725 <entry> 1726 59 23 * * 1-5 /root/mondo-cronscript 1727 </entry> 1728 </row> 1729 </tbody></tgroup></informaltable> 1730 <para> 1731 Your mondoarchive job will run at 23:59 monday-friday. 1732 </para> 1733 <para> 1734 DON'T FORGET TO CHANGE TAPES! 1735 </para> 1736 </sect3> 1737 <sect3><title>Getting at it...</title> 1738 <para> 1739 Once your cron job is running regularly, you'll want to get to 1740 it to change tapes and check status etc. 1741 </para> 1742 <informaltable><tgroup cols="1"><tbody> 1743 <row> 1744 <entry> 1745 screen -r 1746 </entry> 1747 </row> 1748 </tbody></tgroup></informaltable> 1749 <para> 1750 attaches to the running screen where you can change CDs etc 1751 </para> 1752 <informaltable><tgroup cols="1"><tbody> 1753 <row> 1754 <entry> 1755 <CTRL>-a d 1756 </entry> 1757 </row> 1758 </tbody></tgroup></informaltable> 1759 <para> 1760 detaches the running screen again. 1761 </para> 1762 </sect3> 1763 <sect3><title>Caveat</title> 1764 <para> 1765 The script generated by 'at' is unique to the user/machine combination. 1766 You MUST regenerate it on each machine where it will be used. Using 1767 the one above will NOT work for you. MAKE YOUR OWN! 1768 </para> 1769 </sect3> 1376 1770 </sect2> 1377 1771 </sect1> … … 1503 1897 <row> 1504 1898 <entry> 1505 1506 1899 bash# mount-me 1900 </entry> 1901 </row> 1902 <row> 1903 <entry> 1507 1904 bash# chroot /mnt/RESTORING 1508 bash# lilo OR grub-install '(hd0)' 1509 bash# exit 1905 </entry> 1906 </row> 1907 <row> 1908 <entry> 1909 </entry> 1910 </row> 1911 <row> 1912 <entry> 1913 bash# lilo OR grub-install '(hd0)' 1914 </entry> 1915 </row> 1916 <row> 1917 <entry> 1918 bash# exit 1919 </entry> 1920 </row> 1921 <row> 1922 <entry> 1510 1923 bash# unmount-me 1511 1924 … … 1616 2029 1617 2030 Do you want to partition your devices? no 1618 Do you want to format them? no 1619 Do you want to restore everything? no 1620 Do you want to restore something? yes 1621 Which path do you want to restore? /mydata [e.g.] 1622 Do you want to run LILO to setup your boot sectors? Yes 2031 </entry> 2032 </row> 2033 <row> 2034 <entry> 2035 Do you want to format them? no 2036 </entry> 2037 </row> 2038 <row> 2039 <entry> 2040 Do you want to restore everything? no 2041 </entry> 2042 </row> 2043 <row> 2044 <entry> 2045 Do you want to restore something? yes 2046 </entry> 2047 </row> 2048 <row> 2049 <entry> 2050 Which path do you want to restore? /mydata [e.g.] 2051 </entry> 2052 </row> 2053 <row> 2054 <entry> 2055 Do you want to run LILO to setup your boot sectors? Yes 1623 2056 1624 2057 </entry> … … 1723 2156 1724 2157 /dev/hda1 /mnt/windows vfat 4096000 2158 </entry> 2159 </row> 2160 <row> 2161 <entry> 1725 2162 /dev/hda5 / reiserfs 6023000 2163 </entry> 2164 </row> 2165 <row> 2166 <entry> 1726 2167 /dev/hda6 /tmp xfs 955000 2168 </entry> 2169 </row> 2170 <row> 2171 <entry> 1727 2172 /dev/hda7 /usr ext3 4096000 1728 2173 … … 1753 2198 1754 2199 /dev/hda1 /mnt/windows vfat 6096000 2200 </entry> 2201 </row> 2202 <row> 2203 <entry> 1755 2204 /dev/hda5 / reiserfs 9123000 2205 </entry> 2206 </row> 2207 <row> 2208 <entry> 1756 2209 /dev/hda6 /tmp xfs 955000 2210 </entry> 2211 </row> 2212 <row> 2213 <entry> 1757 2214 /dev/hdb1 /usr ext3 8192000 2215 </entry> 2216 </row> 2217 <row> 2218 <entry> 1758 2219 /dev/hdb2 /home xfs 8192000 1759 2220 … … 1773 2234 1774 2235 /dev/hda1 /mnt/windows vfat 6096000 2236 </entry> 2237 </row> 2238 <row> 2239 <entry> 1775 2240 /dev/md0 / reiserfs 9123000 2241 </entry> 2242 </row> 2243 <row> 2244 <entry> 1776 2245 /dev/md1 /tmp xfs 955000 2246 </entry> 2247 </row> 2248 <row> 2249 <entry> 1777 2250 /dev/md2 /usr ext3 8192000 2251 </entry> 2252 </row> 2253 <row> 2254 <entry> 1778 2255 /dev/md3 /home xfs 8192000 1779 2256 … … 2289 2766 <entry> 2290 2767 Put an empty Boot floppy 2768 </entry> 2769 </row> 2770 <row> 2771 <entry> 2291 2772 bash# fdformat /dev/fd0u1722 2773 </entry> 2774 </row> 2775 <row> 2776 <entry> 2292 2777 bash# dd if=/root/images/mindi/mindi-boot.1722.img of=/dev/fd0u1722 2778 </entry> 2779 </row> 2780 <row> 2781 <entry> 2293 2782 Put an empty Data floppy 2783 </entry> 2784 </row> 2785 <row> 2786 <entry> 2294 2787 bash# fdformat /dev/fd0 2788 </entry> 2789 </row> 2790 <row> 2791 <entry> 2295 2792 bash# dd if=/root/images/mindi/mindi-data-N.img of=/dev/fd0 2793 </entry> 2794 </row> 2795 <row> 2796 <entry> 2296 2797 Replace N with 1, 2, etc. 2297 2798 … … 2414 2915 2415 2916 bash# cd /mnt/cdrom/images 2917 </entry> 2918 </row> 2919 <row> 2920 <entry> 2416 2921 bash# dd if=mindi-boot.1722.img of=/dev/fd0u1722 2417 2922
Note:
See TracChangeset
for help on using the changeset viewer.