IceWalkers.com - Linux Software downloads and news
Name : Password :
Linux SoftwareLinux RPMLinux HowtosLink UsAboutAdvertise

Linux Swap Space Mini-HOWTO

Search Howtos :Match :
Next Previous Contents

9. The swapinit.sh script

This shell script initializes the swap space on the partition. The code for signature detection has been repeated 6 times because many a times the signature is properly detected only on the second or the third try.

(Adapted from the original Swap-Space-HOWTO by H. Peter Anvin)

 
#!/bin/sh 
# 
# swapinit.sh - activate the swap partition 
# 
# written by Rahul U. Joshi 
# Verify and initialize swap space 
# 
 
echo -n 'Verifying swap space... ' 
 
loopcount=0 
 
# flag to indicate whether the partition has been activated or not 
activated=0 
 
# check for signatures 6 times before giving up 
while [ $loopcount -lt 6 ] 
  do 
 
  if [ "`/bin/dd 2>/dev/null if=/dev/winswap bs=1 count=10  skip=4086`" = 'SWAP-SPACE' ]; then 
    echo "Linux signature found, iteration $loopcount" 
    echo "Activating swap partitions"  
    swapon /dev/winswap 
    activated=1 
    break 
 
  elif [ "`/bin/dd 2>/dev/null if=/dev/winswap bs=1 count=11 skip=43`" = 'SWAP SPACE ' ]; then    
    echo "DOS signature found, iteration $loopcount" 
    echo "Making swap partition"   
    mkswap /dev/winswap YYYYY 
    echo "Activating swap partitions"  
    swapon /dev/winswap 
    activated=1 
    break 
 
  else    
   let loopcount=loopcount+1 
  fi   
 
  done 
 
 
if [ $activated -ne 1 ] ; then 
  echo "Swap signature not found after $loopcount tries" 
  echo "No swapping partitions activated" 
  exit 1 
fi 

Next Previous Contents
Search Howtos :Match :
VLC media player 0.9.7
Cross-platform media player and streaming server
Ruby 1.9.1 p2
Interpreted scripting language
NASM 2.06rc1
NASM is an 80x86 assembler designed for portability
Veejay 1.4.3
A Visual 'music' instrument and video tracking tool.
Evolution 2.25.2
GNOME mailer, calendar, contact manager and communications tool
Sylpheed 2.6.0rc
Mail User Agent based on GTK+
Nautilus 2.25.1
The Nautilus Environment -- Delivering a Richer User Experience
GtkHTML 3.25.2
HTML rendering/editing library
Pybliographer 1.2.12
Tool for managing bibliographic databases
GFTP 2.0.19
Free multithreaded ftp client
Free IT Magazines, White Papers, eBooks, and more !
Oracle Magazine

Contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more.

eWeek

The essential technology information source for builders of e-business.

BusinessWeek (Digital Edition)

Provides readers a deeper understanding of the trends that drive growth, and what best practices keep them ahead of the competition.

Linux Software Map
Find Linux RPM
Best Rated Linux Software
Most Rated Linux Software
Linux Distributions
Linux Howtos
Quick Survey

Please take our survey and help us improve our website to serve you better.

Thank you.
Linux Software
Linux / IT Resources
Site Resources
Google
Privacy Policy
Contact Us
Submit Software
Advertising info