Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] contribution: using a ramdisk as rootfs



Hello,

I wonder if anybody is interested in my little
runlevel script to use a ramdisk as the root fs.
In runlevel S it creates a ramdisk, copies all
needed files into it and does a chroot then.

What can it be good for?

As EPG data is updated regulary, and should be
stored persistent, it will not be valuable for
the most of you (because you still need a running 
HD now and then, even if not recording or replaying).

For me it is valuable in the following configuration:
- Noisy IDE HD
- Silent USB HD (because cool but noise reduced located)
- booting from USB or using rootfs from USB needs major
  changes in the used distribution (additional modules...),
  but I want to use any distribution without much adaption work

Other interesting configuration:
- Noisy IDE HD
- have a net mount available, but want to ensure VDR can
  start (at least watching live TV) even if the net volume
  is down. 
- Accepting to lose EPG data after reboot for the benefit 
  of working without running HD, if network is down.

Solution:
Booting from the IDE HD, and then changing to a ramfs in 
runlevel S:

=========================================================

# fitted to debian installations, ecpecially ct20/03

if mount | grep ramfs >/dev/null ; then
   echo 'A ramfs is already mounted - exiting.'
   exit
fi

# some one-time preparations
if [ -d /var/log/ksymoops ] ; then
   rm -rf /var/log/ksymoops
   ln -s /dev/null /var/log/ksymoops 
fi
if [ -d /etc/mtab ] ; then
   rm /etc/mtab
   ln -s /proc/mounts /etc/mtab
fi

# create ramfs
[ -d /ramfs ]    || mkdir /ramfs
[ -d /old_root ]  || mkdir /old_root  
mount -t ramfs /ramfs /ramfs
find / -mount -depth | grep -v '^/ramfs'     \
              | grep -v '^/proc/'     \
              | grep -v '^/video/'    \
              | grep -v '^/video_'    \
              | grep -v '^/data/'     \
              | grep -v '^/lost+found'                       \
              | grep -v '^/boot'                             \
              | grep -v '^/var/lib/apt'                      \
              | grep -v '^/var/lib/dpkg'                     \
              | grep -v '^/var/cache/apt'                    \
              | grep -v '^/var/cache/man'                    \
              | grep -v '^/var/spool/mail'                   \
              | grep -v '^/var/spool/postfix'                \
              | grep -v '^/usr/share/doc'                    \
              | grep -v '^/usr/share/common-licenses'        \
              | grep -v '^/usr/share/dict'                   \
              | grep -v '^/usr/share/info'                   \
              | grep -v '^/usr/share/man'                    \
              | grep -v '^/usr/share/perl/5.6.1/unicode'     \
              | grep -v '^/usr/share/keymaps'                \
              | cpio -pdm /ramfs

# cp /video_backup/* /ramfs/video   # do not copy directories
# rem: vdr config is now under /etc/vdr

echo "Ramdisk '/ramfs' with complete root file system created."

hdparm -S 100 /dev/hda

cd /ramfs
pivot_root . old_root
exec chroot . sh -c 'mount /proc; exit' < dev/console >dev/console

#----


-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index