Flashybrid: Porovnání verzí

Z Wiki UnArt Slavičín
Skočit na navigaciSkočit na vyhledávání
Bez shrnutí editace
Bez shrnutí editace
 
(Není zobrazeno 12 mezilehlých verzí od stejného uživatele.)
Řádek 1: Řádek 1:
Nainstalujte:
Nepoužívat verzi z repositáře (obsahuje [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=784890;msg=59 bug]), raději tu z http://hacks.slashdirt.org/sw/flashybrid/


apt-get install flashybrid
Nainstalujeme rsync:


Upravte soubor /etc/init.d/flashybrid (zdroj https://dl.dropboxusercontent.com/u/1490505/HP-T5730/etc/init.d/flashybrid):
apt-get update
apt-get install rsync


  #!/bin/sh
Stáhneme flashybrid, nainstalujeme ho:
 
a) Debian Jessie:
 
  wget http://hacks.slashdirt.org/sw/flashybrid/flashybrid_0.21_all.deb
dpkg -i flashybrid_0.21_all.deb
 
b) Debian Stretch:
 
wget http://hacks.slashdirt.org/sw/flashybrid/flashybrid_0.22_all.deb
dpkg -i flashybrid_0.22_all.deb
 
c) Debian Buster:
wget http://hacks.slashdirt.org/sw/flashybrid/flashybrid_0.23_all.deb
dpkg -i flashybrid_0.23_all.deb
 
Vytvoříme mu přípojný bod:
 
mkdir /ram
 
 
Upravíme konfigurační soubory na následující obsah:
 
'''/etc/default/flashybrid: '''
 
# This file controls the flashybrid init script.
   
   
  # Set up/shutdown the flashybrid system, including the ramdisk and partial
  # Whether to start flashybrid on boot, and shut it down on shutdown.
  # directory bind mounts. This needs to run at the part of system bootup that
  # This has the potential to break your system if it is turned on, so
  # mounts all the disks. It should also run at shutdown right before
  # make sure you understand flashybrid, and have configured it for your
  # filesystems are unmounted.
  # system, before turning this on.
ENABLED=yes
   
   
  # Licensed under the terms of GPL v2
  # Whether to display a message before a directory is synchronized or not.
  #  Diego Iastrubni <diego.iastrubni@xorcom.com> 2006
  VERBOSE=yes
#  Joey Hess <joeyh@debian.org> 2002-2006
 
  # Thibaut VARENE <varenet@debian.org> 2014
'''/etc/flashybrid/config:'''
 
  # This is the main configuration file for the flashybrid system.
   
   
  # Modified by Darkwing to try get it working under Debian 8 with systemd
  # The space-separated mountpoint(s) of your flash memory.
  # -> All mounts now have an extra option "--make-private"
# Support for multiple mountpoints is experimental. Because mountpoints
  # -> Date: 14.05.2015
  # are space-separated, they must not have a space in their full path.
# example: FLASHMOUNT="/ /srv"
  FLASHMOUNT="/"
   
   
  ### BEGIN INIT INFO
  # You probably want a ramdisk to be set up with directories that the system
# Provides:          flashybrid
  # needs to write data to frequently, so that your flash disk can be mounted
# Required-Start:    $local_fs
  # read-only. Flash memory can only be written to several thousand times over
# Required-Stop:    $local_fs
  # its lifetime, so setting up a ramdisk will extend the lifetime of your
# Should-Start:     
  # flash a lot. This is the location to mount the ramdisk. Comment out the
# Should-Stop:     
  # line to not set up a ram disk.
# Default-Start:    S
  RAMMOUNT=/ram
# Default-Stop:      0 1 6
# X-Start-Before:    $network
# X-Stop-Before:    $network
# Short-Description: automates use of a flash disk as the root filesystem
  # Description:      Flashybrid is a system to help in setting up and managing hybrid
#                    flash/disk/ram based Debian systems which can run most of the time
  #                   using only a small flash disk for their root filesystem and do a useful,
  #                   but limited task (such as being a router, or a PDA, or a rescue system
  #                   on a USB keydrive). The flash can be as small as 32 mb, though 64 to 256
  #                   mb is more comfortable.
  ### END INIT INFO
   
   
  . /lib/lsb/init-functions
  # This controls the maximum ammount of memory you want to allocate 
# to the tmpfs RAM drive
# This parameter is optional, and if you do not supply if, tmpfs will
# occupy up to 50% of your available memory (ram+swap)
# FLASH_MAX=92m
   
   
  CONFDIR=/etc/flashybrid
  # You may also want to edit the other files in this directory:
  if [ -e $CONFDIR/config ]; then
# ramtmp, ramstore
. $CONFDIR/config
 
  fi
'''/etc/flashybrid/ramstore:'''
 
# This is a list of directories that are used to store variable data
# that is written to during normal operation of the system, and that should
# be preserved across reboots.
#
# On boot, the listed directories on your flash disk will be copied to the
  # ram disk, and then bind mounts will be used to make the directories on
# the ram disk replace them.
#
# On shutdown, the contents of those directories on the ramdisk will be
# rsynced back to the flash disk.
#
# Directories listed here that are not present will be silently ignored.  
  # Do not put the trailing slash on directories!
   
   
  ENABLED=no
  # Should always be in ram disk.
  if [ -e /etc/default/flashybrid ]; then
/etc
. /etc/default/flashybrid
/var/lib/alsa
  fi
/var/lib/asterisk
/var/lib/discover
/var/lib/dbus
  /var/lib/exim4
/var/lib/op-panel
/var/lib/logrotate
/var/lib/mysql
/var/log
  /root
   
   
  if [ -z "$RAMMOUNT" ]; then
  # If you don't use devfs/udev, you will want /dev in ram, since many things
exit 0
# need to modify it when the system is running. Not needed on systems
  fi
# running udev.
  #/dev
   
   
  is_mounted () {
  # Necessary if the system is to be able to send mail while in embedded
grep -q " $1 " /proc/mounts
# mode.
  }
/var/spool
  /var/mail
   
   
  case "$1" in
  # Some daemons might require write access to subfolders of /var/cache,
  start)
  # it might be a good idea to add these subfolders here or make the whole
if [ "$ENABLED" != yes ]; then
# of /var/cache mirrored in tmpfs. Note that this is likely to be wasteful
log_warning_msg "Not setting up flashybrid system: disabled."
# (large amount of data to be held in tmpfs)
exit
  #/var/cache
fi
 
'''/etc/flashybrid/ramtmp:'''
if [ ! -d "$RAMMOUNT" ] ; then
 
log_failure_msg "Error, RAMMOUNT directory is not found ($RAMMOUNT)"
  # This is a list of directories that should be set up as temporary
exit 1
# directories in the ramdisk. On boot, the directories listed will be
fi
# created on the ramdisk, mode 1777. Their contents will not be saved
# across reboots. The equivilent directories on your flash will be
log_daemon_msg "Setting up flashybrid system for"
# removed and replaced with symlinks to these directories.
EXTRA_PARAMS=""
if [ "xx$FLASH_MAX" != "xx" ]; then
    EXTRA_PARAMS=" -o size=$FLASH_MAX "
fi
# Set up ram disk to hold variable data.
if ! is_mounted $RAMMOUNT; then
#mount tmpfs -t tmpfs $RAMMOUNT $EXTRA_PARAMS
mount --make-private tmpfs -t tmpfs $RAMMOUNT $EXTRA_PARAMS
fi
   
# Temporary directories on ram disk.
cp $CONFDIR/ramtmp $RAMMOUNT/.fh-config-ramtmp
for dir in $(grep -v '^#' $CONFDIR/ramtmp); do
if [ -d $dir ]; then
        mkdir -p -m 1777 $RAMMOUNT/$dir
if is_mounted $dir; then
umount $dir
fi
#mount --bind $RAMMOUNT/$dir $dir
mount --bind --make-private $RAMMOUNT/$dir $dir
fi
done
   
# when syncing we will use this configuration for restoring,
# as the user may modify the configuration on the disk, and completely
# mess up the system, eventually making his machine unusable
cp $CONFDIR/ramstore $RAMMOUNT/.fh-config-ramstore
# Copy data from flash to ram disk for these directories
for dir in $(grep -v '^#' $CONFDIR/ramstore); do
# Skip dirs that are not present.
if [ -d $dir ]; then
if [ "$VERBOSE" = yes ]; then
    log_progress_msg "$dir"
fi
ramdir=$RAMMOUNT$dir
if is_mounted $dir; then
umount $dir
fi
if is_mounted $ramdir.flash; then
umount $ramdir.flash
fi
if [ ! -d $ramdir ]; then
mkdir -p ${ramdir%/*} # dirname
        cp -a $dir $ramdir
fi
mkdir -p $ramdir.flash
#mount --bind $dir $ramdir.flash
#mount --bind $ramdir $dir
mount --bind --make-private $dir $ramdir.flash
mount --bind --make-private $ramdir $dir
fi
done
log_end_msg 0
mountro
;;
   
   
  stop)
  # Do not put the trailing slash on directories!
if [ "$ENABLED" != yes ]; then
log_warning_msg "Not shutting down flashybrid system: disabled."
exit
fi
fh-sync
mountrw
;;
   
   
reload)
echo "This target is available only for compatibility."
echo "Gracefully exiting"
;;
   
   
  restart)
  /tmp
echo "This target is available only for compatibility, and usually will fail to work"
/var/lock
echo "If you really want to restart this service please try 'force-reload'."
/var/lib/alsa
echo
/var/lib/dhcp
echo "Gracefully exiting"
/var/lib/dhcp3
;;
/var/lib/php4
/var/lib/php5
/var/lib/misc
/var/lib/ntp
/var/lib/urandom
/var/lib/apache
/var/lib/shorewall
   
   
  force-reload)
  # This could go in ramstore if you prefer for its contents to persist
$0 stop
  # across reboots.
$0 start
  /var/tmp
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload}"
exit 1
;;
  esac
 
Odstraňte špatné soubory z /etc/rc.d*:
 
  rm /etc/rc{0,1,2,3,4,5,6,S}.d/*flashybrid
 
Obnovte je z naší nové hlavičky:
 
insserv -v flashybrid

Aktuální verze z 16. 10. 2020, 13:17

Nepoužívat verzi z repositáře (obsahuje bug), raději tu z http://hacks.slashdirt.org/sw/flashybrid/

Nainstalujeme rsync:

apt-get update
apt-get install rsync

Stáhneme flashybrid, nainstalujeme ho:

a) Debian Jessie:

wget http://hacks.slashdirt.org/sw/flashybrid/flashybrid_0.21_all.deb
dpkg -i flashybrid_0.21_all.deb

b) Debian Stretch:

wget http://hacks.slashdirt.org/sw/flashybrid/flashybrid_0.22_all.deb
dpkg -i flashybrid_0.22_all.deb

c) Debian Buster:

wget http://hacks.slashdirt.org/sw/flashybrid/flashybrid_0.23_all.deb
dpkg -i flashybrid_0.23_all.deb

Vytvoříme mu přípojný bod:

mkdir /ram


Upravíme konfigurační soubory na následující obsah:

/etc/default/flashybrid:

# This file controls the flashybrid init script.

# Whether to start flashybrid on boot, and shut it down on shutdown.
# This has the potential to break your system if it is turned on, so
# make sure you understand flashybrid, and have configured it for your
# system, before turning this on.
ENABLED=yes

# Whether to display a message before a directory is synchronized or not.
VERBOSE=yes

/etc/flashybrid/config:

# This is the main configuration file for the flashybrid system.

# The space-separated mountpoint(s) of your flash memory.
# Support for multiple mountpoints is experimental. Because mountpoints
# are space-separated, they must not have a space in their full path.
# example: FLASHMOUNT="/ /srv"
FLASHMOUNT="/"

# You probably want a ramdisk to be set up with directories that the system
# needs to write data to frequently, so that your flash disk can be mounted
# read-only. Flash memory can only be written to several thousand times over
# its lifetime, so setting up a ramdisk will extend the lifetime of your
# flash a lot. This is the location to mount the ramdisk. Comment out the
# line to not set up a ram disk.
RAMMOUNT=/ram

# This controls the maximum ammount of memory you want to allocate  
# to the tmpfs RAM drive
# This parameter is optional, and if you do not supply if, tmpfs will
# occupy up to 50% of your available memory (ram+swap)
# FLASH_MAX=92m

# You may also want to edit the other files in this directory:
# ramtmp, ramstore

/etc/flashybrid/ramstore:

# This is a list of directories that are used to store variable data
# that is written to during normal operation of the system, and that should
# be preserved across reboots.
#
# On boot, the listed directories on your flash disk will be copied to the
# ram disk, and then bind mounts will be used to make the directories on
# the ram disk replace them.
#
# On shutdown, the contents of those directories on the ramdisk will be
# rsynced back to the flash disk.
#
# Directories listed here that are not present will be silently ignored. 
# Do not put the trailing slash on directories!

# Should always be in ram disk.
/etc
/var/lib/alsa
/var/lib/asterisk
/var/lib/discover
/var/lib/dbus
/var/lib/exim4
/var/lib/op-panel
/var/lib/logrotate
/var/lib/mysql
/var/log
/root

# If you don't use devfs/udev, you will want /dev in ram, since many things
# need to modify it when the system is running. Not needed on systems
# running udev.
#/dev

# Necessary if the system is to be able to send mail while in embedded
# mode.
/var/spool
/var/mail

# Some daemons might require write access to subfolders of /var/cache,
# it might be a good idea to add these subfolders here or make the whole
# of /var/cache mirrored in tmpfs. Note that this is likely to be wasteful
# (large amount of data to be held in tmpfs)
#/var/cache

/etc/flashybrid/ramtmp:

# This is a list of directories that should be set up as temporary
# directories in the ramdisk. On boot, the directories listed will be
# created on the ramdisk, mode 1777. Their contents will not be saved
# across reboots. The equivilent directories on your flash will be
# removed and replaced with symlinks to these directories.

# Do not put the trailing slash on directories!


/tmp
/var/lock
/var/lib/alsa
/var/lib/dhcp
/var/lib/dhcp3
/var/lib/php4
/var/lib/php5
/var/lib/misc
/var/lib/ntp
/var/lib/urandom
/var/lib/apache
/var/lib/shorewall

# This could go in ramstore if you prefer for its contents to persist
# across reboots.
/var/tmp