NoPaste

initrd

von Anonymous

SNIPPET_TEXT:
  1. \#!/bin/bash
  2. \#
  3. \# lvm2create_initrd
  4. \#
  5. \# Miguel Cabeca
  6. \# cabeca (at) ist (dot) utl (dot) pt
  7. \#
  8. \# Inspiration to write this script came from various sources
  9. \#
  10. \# Original LVM lvmcreate_initrd: ftp://ftp.sistina.com/pub/LVM/1.0/
  11. \# Kernel initrd.txt: http://www.kernel.org/
  12. \# EVMS INSTALL.initrd & linuxrc: http://evms.sourceforge.net/
  13. \# Jeffrey Layton's lvm2create_initrd: http://poochiereds.net/svn/lvm2create_initrd/
  14. \# Christophe Saout's initrd & linuxrc: http://www.saout.de/misc/
  15. \# cryptsetup-luks (cryptsetup in debian sid: packages.debian.org/unstable/admin/cryptsetup
  16. \#
  17. \# This script was only tested with kernel 2.6 with everything required to boot
  18. \# the root filesystem built-in (not as modules). Ex: SCSI or IDE, RAID, device mapper
  19. \# It does not support devfs as it is deprecated in the 2.6 kernel series
  20. \#
  21. \# 2006-03-09 This script was also tested with Kernel 2.6.15, without modules and raid-support
  22. \# with Debian Sarge and cryptsetup-luks backport.
  23. \# Das Skript öffnet eine mit cryptsetup-luks verschlüsselte Partition und benutzt diese als pv
  24. \# für LVM2. Gegenüber dem Originalscript wurde die INIT verändert, sowie das erzeugen der
  25. \# /etc/lvm/lvm.conf. Es wurden notwendige Tools zum öffnen der verschlüsselten Partitionen
  26. \# hinzugefügt.
  27. \#
  28. \#
  29. \############################### !!!! ACHTUNG WICHTIG  !!!! ######################################
  30. \#                                                                                              #
  31. \# In der erzeugten Initrd oder hier unten muß die Variable für die verschlüsselte Partition         #
  32. \# geändert werden! Oder es wird /dev/hda4 als Container für cryptsetup benutzt. Das ist sicher       #
  33. \# schöner über einen Bootparameter zu lösen, aber die Zeit hatte ich nicht.                         #
  34. \# Das darfst Du lösen :-) Such hier nach den Variablen:                                               #
  35. \#                                                                                              #
  36. \# CRYPT="/dev/sda3"                                                                            #      
  37. \# CRYPTMOUNTPOINT="anonymous"                                                                  #
  38. \#                                                                                              #
  39. \#################################################################################################
  40. \#
  41. \#
  42. \# It needs lvm2 tools, busybox, pivot_root, cryptsetup(-luks), MAKEDEV
  43. \#
  44. \# It has been tested on Debian sid (unstable) only
  45. \# It has also worked on Debian sarge with cryptsetup backport from sid
  46. \#
  47. \# Changelog
  48. \# 26/02/2004   Initial release -- Miguel Cabeca
  49. \# 27/02/2004   Removed the BUSYBOXSYMLINKS var. The links are now determined at runtime.
  50. \#              some changes in init script to call a shell if something goes wrong. -- Miguel Cabeca
  51. \# 19/04/2004    Several small changes. Pass args to init so single user mode works. Add some
  52. \#               PATH entries to /sbin/init shell script so chroot works without /usr mounted. Remove
  53. \#               mkdir /initrd so we don't cause problems if root filesystem is corrupted. -- Jeff Layton
  54. \# 15/05/2004   initial support for modules, create lvm.conf from lvm dumpconfig, other cleanups -- Jeff Layton
  55. \# 09/03/2006   some changes to add cryptsetup-LUKS Support. Initial --Xtops.DE -- Lutz Willek
  56.  
  57. \# Copyright Miguel Cabeca, Jeffrey Layton, 2004
  58. \#
  59. \#    This program is free software; you can redistribute it and/or modify
  60. \#    it under the terms of the GNU General Public License as published by
  61. \#    the Free Software Foundation; either version 2 of the License, or
  62. \#    (at your option) any later version.
  63. \#
  64. \#    This program is distributed in the hope that it will be useful,
  65. \#    but WITHOUT ANY WARRANTY; without even the implied warranty of
  66. \#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  67. \#    GNU General Public License for more details.
  68. \#
  69. \#    You should have received a copy of the GNU General Public License
  70. \#    along with this program; if not, write to the Free Software
  71. \#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  72. \#
  73. \# $Id$
  74.  
  75. TMPMNT=/tmp/mnt.$$
  76. DEVRAM=/tmp/initrd.$$
  77.  
  78. \# set defaults
  79. BINFILES=${BINFILES:-"/lib/lvm-200/lvm  /sbin/lvmiopversion /bin/bash /bin/busybox /usr/sbin/cryptsetup /sbin/pivot_root"}
  80. BASICDEVICES=${BASICDEVICES:-"std consoleonly fd"}
  81. BLOCKDEVICES=${BLOCKDEVICES:-"md hda"}
  82. MAKEDEV=${MAKEDEV:-"debian"}
  83.  
  84. \# Uncomment this if you want to disable automatic size detection
  85. \#INITRDSIZE=4096
  86. INITRDSIZE=8096
  87.  
  88. PATH=/bin:/sbin:/usr/bin:/usr/sbin:$PATH
  89.  
  90. usage () {
  91.         echo "Create an initial ramdisk image for LVM2 root filesystem"
  92.         echo "$cmd: [-h] [-v] [-c lvm.conf] [-m modulelist] [-e extrafiles] -r [raiddevs] [-R mdadm.conf] [-M style] [kernel version]"
  93.         echo "      -h|--help      print this usage message"
  94.         echo "      -v|--verbose   verbose progress messages"
  95.         echo "      -c|--lvmconf   path to lvm.conf (/etc/lvm/lvm.conf)"
  96.         echo "      -m|--modules   modules to copy to initrd image"
  97.         echo "      -e|--extra     extra files to add to initrd"
  98.         echo "      -r|--raid      raid devices to start in initrd"
  99.         echo "      -R|--raidconf  location of mdadm.conf file to include"
  100.         echo "      -M|--makedev   set MAKEDEV type (debian or redhat)"
  101. }
  102.  
  103. verbose () {
  104.    [ "$VERBOSE" ] && echo "`echo $cmd | tr '[a-z0-9/_]' ' '` -- $1" || true
  105. }
  106.  
  107. cleanup () {
  108.   [ "`mount | grep $DEVRAM`" ] && verbose "unmounting $DEVRAM" && umount $DEVRAM
  109.   [ -f $DEVRAM ] && verbose "removing $DEVRAM" && rm $DEVRAM
  110.   [ -d $TMPMNT ] && verbose "removing $TMPMNT" && rmdir $TMPMNT
  111.   verbose "exit with code $1"
  112.   exit $1
  113. }
  114.  
  115. trap "
  116.   verbose 'Caught interrupt'
  117.   echo 'Bye bye...'
  118.   cleanup 1
  119. " 1 2 3 15
  120.  
  121. create_init () {
  122.    cat << 'INIT' > $TMPMNT/sbin/init
  123. \#!/bin/bash
  124.  
  125. \# include in the path some dirs from the real root filesystem
  126. \# for chroot, blockdev
  127. PATH="/sbin:/bin:/usr/sbin:/usr/bin:/lib/lvm-200:/initrd/bin:/initrd/sbin"
  128. PRE="initrd:"
  129. \#
  130. \# DONT FORGET TO MODIFY THIS TO YOUR NEEDS:
  131. \#
  132. CRYPT="/dev/sda3"
  133. CRYPTMOUNTPOINT="anonymous"
  134. \#
  135.  
  136. do_shell(){
  137.     /bin/echo
  138.     /bin/echo "*** Entering LVM2 rescue shell. Exit shell to continue booting. ***"
  139.     /bin/echo
  140.     /bin/bash
  141. }
  142.  
  143. create_lvm_device()
  144. {
  145.     mknod --mode=600 /dev/lvm c 109 0 >/dev/null 2>&1 || true
  146. }
  147.  
  148. create_dm_device()
  149. {
  150.     dm_dir="/dev/mapper"
  151.     dm_file="$dm_dir/control"
  152.  
  153.     if [ ! -f /dev/.devfsd ] && [ `/sbin/lvmiopversion` -ge 200 ]
  154.     then
  155.         major=$(grep "[0-9] misc$" /proc/devices | sed 's/[ ]\+misc//')
  156.         minor=$(grep "[0-9] device-mapper$" /proc/misc | sed 's/[ ]\+device-mapper//')
  157.         test -d $dm_dir || mkdir --mode=755 $dm_dir >/dev/null 2>&1
  158.         test -c $dm_file -o -z "$major" -o -z "$minor" || mknod --mode=600 $dm_file c $major $minor >/dev/null 2>&1
  159.      fi
  160. }
  161.  
  162. echo "$PRE Remounting / read/write"
  163.         mount -t ext2 -o remount,rw /dev/ram0 /
  164.  
  165. \# We need /proc for device mapper
  166. echo "$PRE Mounting /proc"
  167.         mount -t proc none /proc
  168.  
  169. \# Mounting crypto fs
  170. echo "$PRE Decrypt Filesystem..."
  171.         cryptsetup -y luksOpen $CRYPT $CRYPTMOUNTPOINT
  172.         while test $? -ne 0; do
  173.            cryptsetup -y luksOpen $CRYPT $CRYPTMOUNTPOINT;
  174.         done && echo "done."
  175.  
  176. echo "$PRE Creating device-mapper devices..."
  177.         create_dm_device && echo "done."
  178.  
  179. echo "$PRE Setting up LVM Volume Groups..."
  180.         create_dm_device 2>/dev/null&& echo "done."
  181.  
  182. echo "$PRE Scanning LVM Volume Groups..."        
  183.         IGNORELOCKINGFAILURES="--ignorelockingfailure"
  184.         MKNODES="--mknodes"
  185.         lvm vgscan $IGNORELOCKINGFAILURES $MKNODES 2>/dev/null|| true
  186.         lvm vgchange -a y $IGNORELOCKINGFAILURES 2>/dev/null
  187.  
  188. echo "$PRE Set permissions..." # from /etc/default/lvm-common
  189.         for MODEVAR in ${!MODE_*}; do
  190.           eval MODE=\$$MODEVAR
  191.           DEV=${MODEVAR//_/\/}
  192.           DEV="/dev/${DEV#MODE\/}"
  193.           MOD=${MODE#* }
  194.           OWN=${MODE% *}
  195.           chmod $MOD $DEV
  196.           chown $OWN $DEV
  197.         done && echo "done."
  198.  
  199. \# Device-Mapper dynamically allocates all device numbers. This means it is possible
  200. \# that the root volume specified to LILO or Grub may have a different number when the
  201. \# initrd runs than when the system was last running. In order to make sure the
  202. \# correct volume is mounted as root, the init script must determine what the
  203. \# desired root volume name is by getting the LVM2 root volume name from the kernel command line. In order for
  204. \# this to work correctly, "lvm2root=/dev/Volume_Group_Name/Root_Volume_Name" needs to be passed
  205. \# to the kernel command line (where Root_Volume_Name is replaced by your actual
  206. \# root volume's name.
  207. for arg in `cat /proc/cmdline`; do
  208.         echo $arg | grep '^lvm2root=' > /dev/null
  209.         if [ $? -eq 0 ]; then
  210.                 rootvol=${arg#lvm2root=}
  211.                 break
  212.         fi
  213. done
  214.  
  215. echo "$PRE Activating LVM2 volumes"
  216.  
  217. \# run a shell if we're passed lvm2rescue on commandline
  218. grep lvm2rescue /proc/cmdline 1>/dev/null 2>&1
  219. if [ $? -eq 0 ]; then
  220.     lvm vgchange --ignorelockingfailure -P -a y
  221.     do_shell
  222. else
  223.     lvm vgchange --ignorelockingfailure -a y
  224. fi
  225.  
  226. echo "$PRE Mounting root filesystem $rootvol ro"
  227. mkdir /rootvol
  228. if ! mount -t auto -o ro $rootvol /rootvol; then
  229.         echo "\t*FAILED*";
  230.         do_shell
  231. fi
  232.  
  233. echo "$PRE Umounting /proc"
  234. umount /proc
  235.  
  236. echo "$PRE Changing roots"
  237. cd /rootvol
  238. if ! pivot_root . initrd ; then
  239.         echo "\t*FAILED*"
  240.         do_shell
  241. fi
  242.  
  243. echo "$PRE Proceeding with boot..."
  244.  
  245. exec chroot . /bin/sh -c "umount /initrd; blockdev --flushbufs /dev/ram0 ; exec /sbin/init $*" < dev/console > dev/console 2>&1
  246.  
  247. INIT
  248.    chmod 555 $TMPMNT/sbin/init
  249. }
  250.  
  251. \# create lvm.conf file from dumpconfig. Just use filter options
  252. \# dm added--> cryptsetup 2006-09-03
  253. create_lvmconf () {
  254.     echo 'devices {' > $TMPMNT/etc/lvm/lvm.conf
  255.     lvm dumpconfig | grep 'filter=' >> $TMPMNT/etc/lvm/lvm.conf
  256.     echo '# Device-Mapper (crypto-support) Xtops.DE-Lutz Willek' >> $TMPMNT/etc/lvm/lvm.conf
  257.     echo 'types = [ "device-mapper", 16 ]' >> $TMPMNT/etc/lvm/lvm.conf
  258.     echo '}' >> $TMPMNT/etc/lvm/lvm.conf
  259.  
  260. }
  261.  
  262. \#
  263. \# Main
  264. \#
  265.  
  266. cmd=`basename $0`
  267.  
  268. VERSION=`uname -r`
  269.  
  270. while [ $# -gt 0 ]; do
  271.    case $1 in
  272.    -h|--help) usage; exit 0;;
  273.    -v|--verbose)  VERBOSE="y";;
  274.    -c|--lvmconf)  LVMCONF=$2; shift;;
  275.    -m|--modules)  MODULES=$2; shift;;
  276.    -e|--extra)    EXTRAFILES=$2; shift;;
  277.    -r|--raid)     RAID=$2; shift;;
  278.    -R|--raidconf) RAIDCONF=$2; shift;;
  279.    -M|--makedev)  MAKEDEV=$2; shift;;
  280.    [2-9].[0-9]*.[0-9]*) VERSION=$1;;
  281.    *) echo "$cmd -- invalid option '$1'"; usage; exit 0;;
  282.    esac
  283.    shift
  284. done
  285.  
  286. INITRD=${INITRD:-"/boot/initrd-lvm2-$VERSION.gz"}
  287.  
  288. echo "$cmd -- make LVM initial ram disk $INITRD"
  289. echo ""
  290.  
  291. if [ -n "$RAID" ]; then
  292.     BINFILES="$BINFILES /sbin/mdadm"
  293.     RAIDCONF=${RAIDCONF:-"/etc/mdadm/mdadm.conf"}
  294.     if [ -r $RAIDCONF ]; then
  295.         EXTRAFILES="$EXTRAFILES $RAIDCONF"
  296.     else
  297.         echo "$cmd -- WARNING: No $RAIDCONF! Your RAID device minor numbers must match their superblock values!"
  298.     fi
  299. fi
  300.  
  301. \# add modprobe if we declared any modules
  302. if [ -n "$MODULES" ]; then
  303.     BINFILES="$BINFILES /sbin/modprobe /sbin/insmod /sbin/rmmod"
  304. fi
  305.  
  306. for a in $BINFILES $EXTRAFILES; do
  307.     if [ ! -r "$a" ] ; then
  308.         echo "$cmd -- ERROR: you need $a"
  309.         exit 1;
  310.     fi;
  311. done
  312.  
  313. \# Figure out which shared libraries we actually need in our initrd
  314. echo "$cmd -- finding required shared libraries"
  315. verbose "BINFILES: `echo $BINFILES`"
  316. LIBFILES=`ldd $BINFILES 2>/dev/null | awk '{if (/=>/) { print $3 }}' | sort -u`
  317. if [ $? -ne 0 ]; then
  318.    echo "$cmd -- ERROR figuring out needed shared libraries"
  319.    exit 1
  320. fi
  321.  
  322. verbose "Shared libraries needed: `echo $LIBFILES`"
  323.  
  324. INITRDFILES="$BINFILES $LIBFILES $MODULES $EXTRAFILES"
  325.  
  326. \# tack on stuff for modules if we declared any and the files exist
  327. if [ -n "$MODULES" ]; then
  328.     if [ -f "/etc/modprobe.conf" ]; then
  329.         INITRDFILES="$INITRDFILES /etc/modprobe.conf"
  330.     fi
  331.     if [ -f "/lib/modules/modprobe.conf" ]; then
  332.         INITRDFILES="$INITRDFILES /lib/modules/modprobe.conf"
  333.     fi
  334. fi
  335.  
  336. \# Calculate the the size of the ramdisk image.
  337. \# Don't forget that inodes take up space too, as does the filesystem metadata.
  338. echo "$cmd -- calculating initrd filesystem parameters"
  339. if [ -z "$INITRDSIZE" ]; then
  340.    echo "$cmd -- calculating loopback file size"
  341.    verbose "finding size"
  342.    INITRDSIZE="`du -Lck $INITRDFILES | tail -1 | cut -f 1`"
  343.    verbose "minimum: $INITRDSIZE kB for files + inodes + filesystem metadata"
  344.    INITRDSIZE=`expr $INITRDSIZE + 512`  # enough for ext2 fs + a bit
  345. fi
  346.  
  347. echo "$cmd -- making loopback file ($INITRDSIZE kB)"
  348. verbose "using $DEVRAM as a temporary loopback file"
  349. dd if=/dev/zero of=$DEVRAM count=$INITRDSIZE bs=1024 > /dev/null 2>&1
  350. if [ $? -ne 0 ]; then
  351.    echo "$cmd -- ERROR creating loopback file"
  352.    cleanup 1
  353. fi
  354.  
  355. echo "$cmd -- making ram disk filesystem"
  356. verbose "mke2fs -F -m0 -L LVM-$VERSION $DEVRAM $INITRDSIZE"
  357. [ "$VERBOSE" ] && OPT_Q="" || OPT_Q="-q"
  358. mke2fs $OPT_Q -F -m0 -L LVM-$VERSION $DEVRAM $INITRDSIZE
  359. if [ $? -ne 0 ]; then
  360.    echo "$cmd -- ERROR making ram disk filesystem"
  361.    echo "$cmd -- ERROR you need to use mke2fs >= 1.14 or increase INITRDSIZE"
  362.    cleanup 1
  363. fi
  364.  
  365. verbose "creating mountpoint $TMPMNT"
  366. mkdir $TMPMNT
  367. if [ $? -ne 0 ]; then
  368.    echo "$cmd -- ERROR making $TMPMNT"
  369.    cleanup 1
  370. fi
  371.  
  372. echo "$cmd -- mounting ram disk filesystem"
  373. verbose "mount -o loop $DEVRAM $TMPMNT"
  374. mount -oloop $DEVRAM $TMPMNT
  375. if [ $? -ne 0 ]; then
  376.    echo "$cmd -- ERROR mounting $DEVRAM on $TMPMNT"
  377.    cleanup 1
  378. fi
  379.  
  380. verbose "creating basic set of directories in $TMPMNT"
  381. (cd $TMPMNT; mkdir bin dev etc lib proc sbin var)
  382. if [ $? -ne 0 ]; then
  383.    echo "$cmd -- ERROR creating directories in $TMPMNT"
  384.    cleanup 1
  385. fi
  386.  
  387. \# Add some /dev files. We have to handle different types of MAKEDEV invocations
  388. \# here, so this is rather messy.
  389. RETCODE=0
  390. echo "$cmd -- adding required /dev files"
  391. verbose "BASICDEVICES: `echo $BASICDEVICES`"
  392. verbose "BLOCKDEVICES: `echo $BLOCKDEVICES`"
  393. [ "$VERBOSE" ] && OPT_Q="-v" || OPT_Q=""
  394. case "$MAKEDEV" in
  395. debian)
  396.     (cd $TMPMNT/dev; /dev/MAKEDEV $OPT_Q $BASICDEVICES $BLOCKDEVICES)
  397.     RETCODE=$?
  398.     ;;
  399. redhat)
  400.     (cd $TMPMNT/dev; /dev/MAKEDEV $OPT_Q -d $TMPMNT/dev -m 2)
  401.     RETCODE=$?
  402.     ;;
  403. *)
  404.     echo "$cmd -- ERROR: $MAKEDEV is not a known MAKEDEV style."
  405.     RETCODE=1
  406.     ;;
  407. esac
  408.  
  409. if [ $RETCODE -ne 0 ]; then
  410.    echo "$cmd -- ERROR adding /dev files"
  411.    cleanup 1
  412. fi
  413.  
  414. \# copy necessary files to ram disk
  415. echo "$cmd -- copying initrd files to ram disk"
  416. [ "$VERBOSE" ] && OPT_Q="-v" || OPT_Q="--quiet"
  417. verbose "find \$INITRDFILES | cpio -pdmL $OPT_Q $TMPMNT"
  418. find $INITRDFILES | cpio -pdmL $OPT_Q $TMPMNT
  419. if [ $? -ne 0 ]; then
  420.    echo "$cmd -- ERROR cpio to ram disk"
  421.    cleanup 1
  422. fi
  423.  
  424. echo "$cmd -- creating symlinks to busybox"
  425. shopt -s extglob
  426. [ "$VERBOSE" ] && OPT_Q="-v" || OPT_Q=""
  427. BUSYBOXSYMLINKS=`busybox 2>&1| awk '/^Currently defined functions:$/ {i++;next} i'|tr ',\t\n' ' '`
  428. for link in ${BUSYBOXSYMLINKS//@(linuxrc|init|busybox)}; do
  429.         ln -s $OPT_Q busybox $TMPMNT/bin/$link;
  430. done
  431. shopt -u extglob
  432.  
  433. echo "$cmd -- creating new $TMPMNT/sbin/init"
  434. create_init
  435. if [ $? -ne 0 ]; then
  436.    echo "$cmd -- ERROR creating init"
  437.    cleanup
  438.    exit 1
  439. fi
  440.  
  441. \# copy LVMCONF into place or create a stripped down one from lvm dumpconfig
  442. mkdir -p $TMPMNT/etc/lvm
  443. if [ -n "$LVMCONF" ]; then
  444.     echo "$cmd -- copying $LVMCONF to $TMPMNT/etc/lvm/lvm.conf"
  445.     if [ -f "$LVMCONF" ]; then
  446.         cp $LVMCONF $TMPMNT/etc/lvm/lvm.conf
  447.     else
  448.         echo "$cmd -- ERROR: $LVMCONF does not exist!"
  449.         cleanup
  450.         exit 1
  451.     fi
  452. else
  453.     echo "$cmd -- creating new $TMPMNT/etc/lvm/lvm.conf"
  454.     create_lvmconf
  455. fi
  456.  
  457. if [ -n "$RAID" ]; then
  458.     RAIDLIST="$TMPMNT/etc/raid_autostart"
  459.     echo "$cmd -- creating $RAIDLIST file."
  460.     for device in $RAID; do
  461.         echo $device >> $RAIDLIST
  462.     done
  463. fi
  464.  
  465. \# create modules.dep and /etc/modules files if needed
  466. if [ -n "$MODULES" ]; then
  467.     echo "$cmd -- creating $MODDIR/modules.dep file and $TMPMNT/etc/modules"
  468.     depmod -b $TMPMNT $VERSION
  469.     for module in $MODULES; do
  470.         basename $module | sed 's/\.k\{0,1\}o$//' >> $TMPMNT/etc/modules
  471.     done
  472. fi
  473.  
  474. verbose "removing $TMPMNT/lost+found"
  475. rmdir $TMPMNT/lost+found
  476.  
  477. echo "$cmd -- ummounting ram disk"
  478. umount $DEVRAM
  479. if [ $? -ne 0 ]; then
  480.    echo "$cmd -- ERROR umounting $DEVRAM"
  481.    cleanup 1
  482. fi
  483.  
  484. echo "$cmd -- creating compressed initrd $INITRD"
  485. verbose "dd if=$DEVRAM bs=1k count=$INITRDSIZE | gzip -9"
  486. dd if=$DEVRAM bs=1k count=$INITRDSIZE 2>/dev/null | gzip -9 > $INITRD
  487. if [ $? -ne 0 ]; then
  488.    echo "$cmd -- ERROR creating $INITRD"
  489.    cleanup 1
  490. fi
  491.  
  492. cat << FINALTXT
  493. --------------------------------------------------------
  494. Your initrd is ready in $INITRD
  495.  
  496. Don't forget to set the crypto-device variables. By default:
  497.         CRYPT="/dev/sda3"
  498.         CRYPTMOUNTPOINT="anonymous"
  499.  
  500. Don't forget to set root=/dev/ram0 in kernel parameters
  501. Don't forget to set lvm2root=/dev/VG/LV in kernel parameters, where LV is your root volume
  502. If you use lilo try adding/modifying an entry similar to this one in lilo.conf:
  503.  
  504. image=/boot/vmlinuz-lvm2-$VERSION
  505.         label="ramdisk_LVM"
  506.         initrd=/boot/initrd-lvm2-$VERSION.gz
  507.         append="root=/dev/ram0 lvm2root=/dev/system/root <other parameters>"
  508.  
  509. If using grub try adding/modifying an entry similar to this one in menu.lst
  510.  
  511. title ramdisk LVM
  512.         kernel /boot/vmlinuz-lvm2-$VERSION root=/dev/ram0 lvm2root=/dev/system/root <other parameters>
  513.         initrd /boot/initrd-lvm2-$VERSION.gz
  514.  
  515. You can also pass lvm2rescue to the kernel to get a shell
  516. --------------------------------------------------------
  517. FINALTXT
  518.  
  519. cleanup 0

Quellcode

Hier kannst du den Code kopieren und ihn in deinen bevorzugten Editor einfügen. PASTEBIN_DOWNLOAD_SNIPPET_EXPLAIN