This post describes how to mount a remote filesystem through SSH using the shfs kernel module on a Debian Etch server. By doing this I can access the remote filesystem as if it was a local filesystem and also use my local tools and software.
This is a short description of how I made a remote filesystem accessible on my private server.
Download the needed software
# apt-get install shfs-source shfs-utils module-assistant
This step might not be needed on your system, but I didn’t have the needed software to build the kernel module
# module-assistant prepare
Use the module assistant to build the kernel module to match your local system (I use a 2.6 kernel but this whould work on a 2.4 kernel also)
module-assistant build shfs
Now you can install it
# module-assistant install shfs Selecting previously deselected package shfs-module-2.6.18-5-686. (Reading database ... 78212 files and directories currently installed.) Unpacking shfs-module-2.6.18-5-686 (from .../shfs-module-2.6.18-5-686_0.35-6.2+2.6.18.dfsg.1-17_i386.deb) ... Setting up shfs-module-2.6.18-5-686 (0.35-6.2+2.6.18.dfsg.1-17) ...
You might see some error messages but those are mostly harmless :) and can be ignored.
Now we can try to mount the remote filesystem
# mkdir /export/remotefs # shfsmount user@remotesystem.com /export/remotefs Password:
The remote filesystem should now be available after typing your password.
# cd /export/remotefs # ls
You will now see all your files in the remote filesystem as if they were on your local machine.
To unmount your filesystem
# cd / # umount /export/remotefs
This post could have been extended to use passwordless
Tags: Debian, Etch, mount, ssh
Posted by Hans-Henry Jakobsen
apt-show-versions is a Debian tool that lists available package versions with distributions. This is really useful if you have a mixed stable/testing environment and want to list all packages which are from testing and can be upgraded in testing.
This package is not installed automatically so you have to install it your self
apt-get install apt-show-versions
An example output from this command
groff-base/etch uptodate 1.18.1.1-12 notification-daemon/etch uptodate 0.3.5-1+b1 libavahi-common3/etch uptodate 0.6.16-3etch1 esound-common/etch uptodate 0.2.36-3 libgnome2-0/etch uptodate 2.16.0-2 m4/etch uptodate 1.4.8-2 libkpathsea4/etch uptodate 3.0-30 ...
The -u option displays a list of upgradeable packages
# apt-show-versions -u
# apt-show-versions -u
linux-image-2.6.18-6-686/etch upgradeable from 2.6.18.dfsg.1-17etch1 to 2.6.18.dfsg.1-18etch1
Tags: apt-show-versions, Debian, Etch
Posted by Hans-Henry Jakobsen
To upgrade a Debian Etch (stable) installation to testing Debian Lenny (unstable), you can do the following steps
sudo vi /etc/apt/sources.list
change all occurences of the word etch for lenny, or stable for testing
sudo apt-get update && apt-get dist-upgrade
That is all that is needed to upgrade Debian Etch to Debian Lenny which is expected to be released fall 2008. The process can be reversed if you would like to revert from Lenny to Etch, just change back your changes in sources.list
Tags: Debian, dist-upgrade, Etch, Lenny
Posted by Hans-Henry Jakobsen
To automatically start some software during startup, Debian has a system tool called update-rc
Example on how to start the postfix daemon in all default runlevels
update-rc.d postfix defaults
Posted by Hans-Henry Jakobsen
Today I’ve setup a cold backup routine to backup my Zimba installation running on my Debian (Etch) 4.0 server that is in full production now for my private domains. This is a slightly modified backup script for the Open Source Edition of Zimbra from the Zimbra Wiki. Please note that the script does a full backup every time it’s being run!
#!/bin/bash # Zimbra Backup Script # Requires sftp to run # This script is intended to run from the crontab as root # Free to use and free of any warranty! Daniel W. Martin, 9 Sept 2007 # Live sync before stopping Zimbra to minimize sync time with the services down # Comment out the following line if you want to try single cold-sync only rsync -avHK --delete /opt/zimbra/ /backup/zimbra # which is the same as: /opt/zimbra /backup # Including --delete option gets rid of files in the dest folder that don't exist at the src # this prevents logfile/extraneous bloat from building up overtime. # Stop Zimbra Services sudo -u zimbra /opt/zimbra/bin/zmcontrol stop sleep 40 # Sync to backup directory rsync -avHK --delete /opt/zimbra/ /backup/zimbra # Restart Zimbra Services sudo -u zimbra /opt/zimbra/bin/zmcontrol start # Create a txt file in the backup directory that'll contain the current Zimbra # server version. Handy for knowing what version of Zimbra a backup can be restored to. sudo -u zimbra zmcontrol -v > /backup/zimbra/conf/zimbra_version.txt # or examine your /opt/zimbra/.install_history # Create archive of backed-up directory for offsite transfer # cd /backup/zimbra ZimbraVersion=zimbraBackup-zcs-5.0.1_GA_1902.DEBIAN4.0.20080109200914 tar -zcf /backup/$ZimbraVersion-$(date +"%Y-%m-%d").tgz -C /backup/zimbra . # Transfer file to backup server using passwordless sftp scp zimbraBackup-zcs-5.0.1_GA_1902.DEBIAN4.0.20080109200914-$(date +"%Y-%m-%d").tgz username@example.com:/path/to/backupfolder/
I’ve described passwordless ssh/sftp session in a earlier post so I won’t describe the last line of the backup script.
Tags: backup, bash, Debian, sftp, tar., Zimbra
Posted by Hans-Henry Jakobsen