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 :
Glade 3.5.5
User interface builder for GTK+ and Gnome
Evolution 2.25.4
GNOME mailer, calendar, contact manager and communications tool
GEdit 2.25.4
Small but powerful text editor
Mutt 1.5.19
Small but very powerful text-based mail client.
Galculator 1.3.2
GTK 2 based scientific calculator
BlueFish 1.3.1
GTK HTML editor
Samba 3.3.0rc2
Provides file and print services to SMB/CIFS clients
Anjuta 2.25.4
Integrated Development Environment
FreeBSD 7.1
Advanced BSD UNIX operating system
Enlightenment 0.16.8.15
Nice-looking Window manager for X
Free IT Magazines, White Papers, eBooks, and more !
Dr. Dobb's Journal

Dr. Dobb's Journal enables programmers to write the most efficient and sophisticated programs and help in daily programming quandaries.

The 7 Things that IT Security Professionals MUST KNOW!

Gain key insight into security problem and find the safest means to protect your technological assets.

Database Trends and Applications

Provides timely coverage of the technology, intelligence and insight needed to plan, implement and manage information-rich projects.

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