📚 LinuxDocs
Topics:
All Pages8021X HOWTOACP ModemACPI HOWTOADSL Bandwidth Man..ATA RAID HOWTOATM Linux HOWTOAX25 HOWTOAccessibility Dev ..Accessibility HOWTOAdv Bash Scr HOWTOAdv Routing HOWTOAntares RAID sparc..Apache Compile HOWTOApache WebDAV LDAP..Assembly HOWTOAstronomy HOWTOAthlon Powersaving..Authentication Gat..Autodir HOWTOAviation HOWTOAvr Microcontrolle..BRIDGE STP HOWTOBTTVBackspaceDeleteBandwidth Limiting..Bangla HOWTOBash Prompt HOWTOBattery PoweredBelarusian HOWTOBelgian HOWTOBeowulf HOWTOBocaBogoMipsBootdisk HOWTOBridgeC++ dlopenC C++Beautifier HO..C editing with VIM..CDROM HOWTOCDServer HOWTOCable ModemCaudium HOWTOClone HOWTOCompaq Remote Insi..Compaq T1500 HOWTOConexant+Rockwell ..Cryptoloop HOWTODB2 HOWTODHCPDSL HOWTODVD Playback HOWTODebian Binary Pack..Debian JigdoDebian and Windows..Disk Encryption HO..Disk on Chip HOWTODocBook Demystific..DocBook InstallDocBook OpenJade S..Ecology HOWTOEmacspeak HOWTOEncourage Women Li..Encrypted Root Fil..Euro Char SupportEvent HOWTOFedora Multimedia ..Finnish HOWTOFirewall PiercingFlash Memory HOWTOFont HOWTOFramebuffer HOWTOGCC HOWTOGIS GRASSGlibc Install HOWTOHOWTO HOWTOHOWTO INDEXHP HOWTOHandspring VisorHard Disk UpgradeHardware HOWTOHighQuality Apps H..Home Electrical Co..IBM7248 HOWTOIO Perf HOWTOIP AliasIP Masquerade HOWTOIRCImplement Sys Call..Indic Fonts HOWTOInfrared HOWTOIngresII HOWTOInstall StrategiesInstallation HOWTOInstallfest HOWTOIntkeybItalian HOWTOJabber Server Farm..JavaStation HOWTOKerberos Infrastru..Kernel HOWTOKerneldKodak Digitalcam H..LDAP HOWTOLDP Reviewer HOWTOLILO crash rescue ..LVM HOWTOLeased LineLegoLinksys Blue Box R..Linux+Win95Linux+Win9x+Grub H..Linux+Windows HOWTOLinux Complete Bac..Linux Crash HOWTOLinux Gamers HOWTOLinux Modem SharingLinux Promise RAID..Linux i386 Boot Co..LinuxGL QuakeWorld..Lotus DominoR5MILO HOWTOMMBase Inst HOWTOMP3 CD BurningMail User HOWTOMajordomo MajorCoo..Man PageMasquerading Simpl..Medicine HOWTOMindTerm SSH HOWTOMobile IPv6 HOWTOMock MainframeModule HOWTOModulesMotorola Surfboard..Mozilla OptimizationMulti Distro DevNCURSES Programmin..NFS HOWTONFS Root Client mi..NIS HOWTONetMeeting HOWTONetwork boot HOWTONvidia OpenGL Conf..OLSR IPv6 HOWTOOnline Troubleshoo..Oracle 9i Fedora 3..PA RISC Linux Boot..PCTel MicroModem C..PHP Nuke HOWTOPPP HOWTOPagerPalmOS HOWTOPartitionPartition Mass Sto..Partition Mass Sto..Partition RescuePine ExchangePortSlavePost Installation ..Postfix Cyrus Web ..Pre Installation C..Print2WinPrinting HOWTOProcess AccountingProgram Library HO..Proxy ARP SubnetQmail ClamAV HOWTOQmail VMailMgr Cou..Querying libiptc H..RPM HOWTOReading List HOWTORedHat CD HOWTOReliance HOWTORemote BridgingRemote Serial Cons..SCSI 2.4 HOWTOSCSI Generic HOWTOSLIP PPP EmulatorSRM HOWTOSSL Certificates H..Scanner HOWTOScientific Computi..Scripting GUI TclTkSecure CVS PserverSecure Programs HO..Security HOWTOSecurity Quickstar..Security Quickstar..Serial Laplink HOWTOSerial Programming..Slovak HOWTOSmall MemorySmart Card HOWTOSoftware Proj Mgmt..Software Release P..Sound HOWTOSpam Filtering for..Speech Recognition..SquashFS HOWTOSybase ASA HOWTOSybase ASE HOWTOSybase PHP ApacheTCP Keepalive HOWTOTamil Linux HOWTOTimePrecision HOWTOTimeSys Linux Inst..Token RingTraffic Control HO..Traffic Control tc..UPS HOWTOUnix Hardware Buye..Unix and Internet ..UpgradeUsenet News HOWTOUser Authenticatio..VB6 to TclVMS to Linux HOWTOVPN HOWTOValgrind HOWTOVideoLAN HOWTOVim HOWTOVirtual WebWebcam HOWTOWikiText HOWTOWindows Newsreader..Wireless Link sys ..Wireless Sync HOWTOXDM XtermXDMCP HOWTOXFree Local multi ..XFree86 HOWTOXFree86 R200XFree86 Second MouseXFree86 Video Timi..XML RPC HOWTOXWindow Overview H..XWindow User HOWTOXinerama HOWTOXterminalsHtml singleI810 HOWTOLibdc1394 HOWTOOpenMosix HOWTOPhhttpd HOWTOPpp sshText
Next Previous Contents

11. The msinfo.sh script

This shell script analyses the boot sector of the given partition and displays some information along with the "Total Special Sectors" in a message box. It assumes that the filesystem on the given partition is a FAT16. If not, it will print an error message and exit. Invoke it as .:: telegra.ph ::. [StackOverflow: HTML5] [Google Scholar: User Datagram Protocol] .:: writeablog.net ::. .:: rikvipme1.moe-cosplay.com ::. .:: podcasts.apple.com ::. .:: www.hogwartsishere.com ::. .:: www.zazzle.com ::. .:: www.vhs80.com ::. .:: www.aleviforum.com ::. .:: podcasts.apple.com ::. .:: creativemarket.com ::. .:: biashara.co.ke ::. .:: podcasts.apple.com ::. .:: podcasts.apple.com ::. .:: www.squadskates.com ::. .:: alumni.idgu.edu.ua ::. .:: www.wgt.com ::. .:: telegra.ph ::. .:: hedgedoc.dezentrale.space ::. .:: telegra.ph ::. .:: opensocialfactory.com ::. .:: ml007.k12.sd.us ::. .:: iplogger.org ::. .:: jobs.nefeshinternational.org ::. .:: www3.uwsp.edu ::.

 
# msinfo <partition name> 
 

To run this script, you will need the "dialog" program that displays dialog boxes. You can get it from .:: participa.gijon.es ::. .:: telegra.ph ::. .:: telegra.ph ::. .:: id.pinterest.com ::. .:: groups.google.com ::. .:: batocomic.net ::. .:: cz.pinterest.com ::. .:: www.just.edu.jo ::. .:: writeablog.net ::. .:: app.daily.dev ::. .:: www.redsea.gov.eg ::. .:: pad.darmstadt.social ::. .:: nous.malakoff.fr ::. .:: edabit.com ::. .:: telegra.ph ::. .:: md.darmstadt.ccc.de ::. .:: caramel.la ::. .:: ad-links.org ::. here.

#!/bin/sh 
# 
# msinfo.sh           This shell script displays the boot sector of the 
#                     given partition.
# 
# Author:             Rahul U. Joshi 
# 
# Modifications       Removed the use of expr and replaced it by the let 
#                     command. 
# 
# ------------------------------------------------------------------------
# This program is a free software, you can redistribute it and/or modify
# it under the eterms of the GNU General Public Liscence as published by
# the Free Software Foundation; either version 2 or (at your option) any
# later version.
#
# This program is being distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY without even the implied warranty of
# MERCHANTIBILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public Liscence for more details.
# -------------------------------------------------------------------------
 
 
# check for command line arguments 
if [ $# -ne 1 ]; then 
   echo "Usage: msinfo <partition name>" 
   exit 1 
fi 
 
# check whether the input name is a block device 
if [ ! -b $1 ]; then 
   echo "msinfo: $1 is not a block device" 
   exit 1 
fi 
 
# create two temporary files for use 
TMPFILE=`mktemp -q /tmp/$0.XXXXXX` 
if [ $? -ne 0 ]; then 
    echo "msinfo: Can't create temp file, exiting..." 
    exit 1 
fi 
 
TXTFILE=`mktemp -q /tmp/$0.XXXXXX` 
if [ $? -ne 0 ]; then 
   echo "msinfo: Can't create temp file, exiting..." 
   rm -f $TMPFILE 
   exit 1 
fi 
 
backtitle="`printf "%78s" "msinfo, Information about FAT16 filesystem -- Rahul Joshi"`" 
 
dialog --title "Boot sector of $1" --backtitle "$back_title" \ 
       --infobox "\nAnalysing boot sector for $1\nPlease wait..."  14 60 
 
# truncate TXTFILE to zero length 
echo > $TXTFILE 
 
# get Formatting DOS version 
dd 2>/dev/null if=$1  bs=1 count=8 skip=3 | dd 2>/dev/null of=$TMPFILE 
printf >>$TXTFILE "%30s : %s\n" "Formatting DOS version" "`cat $TMPFILE`" 
 
 
# get file system 
dd 2>/dev/null if=$1  bs=1 count=8 skip=54 | dd 2>/dev/null of=$TMPFILE 
printf >>$TXTFILE "%30s : %s\n" "Filesystem" "`cat $TMPFILE`" 
 
# check if filesystem in a FAT16 
if [ "`cat $TMPFILE`" != "FAT16   " ]; then 
  dialog --title "Boot sector of $1" --backtitle "$back_title" \
         --infobox  "\nCan't find a FAT16 filesystem on $1"  14 60 
  exit 2 
fi 
 
# get volume label in boot sector 
dd 2>/dev/null if=$1  bs=1 count=11 skip=43 | dd 2>/dev/null of=$TMPFILE 
printf >>$TXTFILE "%30s : %s\n" "Volume label in boot sector" "`cat $TMPFILE`" 
  
 
# get Sector size 
dd 2>/dev/null if=$1  bs=1 count=2 skip=11| od -An -tdS | dd 2>/dev/null of=$TMPFILE 
printf >>$TXTFILE "%30s : %d\n" "Sector size" `cat $TMPFILE` 
sector_size=`cat $TMPFILE` 
 
 
# get Reserved sectors 
dd 2>/dev/null if=$1  bs=1 count=2 skip=14| od -An -tdS | dd 2>/dev/null of=$TMPFILE 
printf >>$TXTFILE "%30s : %d\n" " Reserved sectors" `cat $TMPFILE` 
reserved_sectors=`cat $TMPFILE` 
 
 
# get FAT sectors 
dd 2>/dev/null if=$1  bs=1 count=1 skip=16| od -An -tdS | dd 2>/dev/null of=$TMPFILE 
fat_count=`cat $TMPFILE` 
 
dd 2>/dev/null if=$1  bs=1 count=2 skip=22| od -An -tdS | dd 2>/dev/null of=$TMPFILE 
sectors_per_fat=`cat $TMPFILE` 
 
# calculate the no of sectors allocated for FAT's 
let fat_sectors=fat_count*sectors_per_fat 
 
printf >>$TXTFILE "%30s : %u (%u x %u) \n" "FAT sectors" "$fat_sectors" \
        "$fat_count" "$sectors_per_fat" 
 
 
# get root directory sectors 
dd 2>/dev/null if=$1  bs=1 count=2 skip=17| od -An -tdS | dd 2>/dev/null of=$TMPFILE 
root_sectors=`cat $TMPFILE` 
 
# calculate the no of sectors allocated for root directory 
let root_sectors=root_sectors*32/sector_size 
 
printf >>$TXTFILE "%30s : %u\n" "Root directory sectors" "$root_sectors" 
 
 
# get Total special sectors 
let total=reserved_sectors+fat_sectors+root_sectors 
printf >>$TXTFILE "%30s : %u\n" "Total special sectors" "$total" 
 
 
# display the information
dialog --title "Boot sector of $1"  --backtitle "$back_title"  --msgbox "`cat $TXTFILE`" 14 60 
  
# delete temporary files 
rm -f $TMPFILE 
rm -f $TXTFILE 
 
# end of msinfo.sh 

Next Previous Contents

Share or Research:

Share on FB Post to X LinkedIn 🤖 Ask AI about this