FreeBSD - Tutorials, Security
Home   Archives   Sitemap   About   Contact

How to remount UNIX filesystems with one command

Home NEW! Unix Forum News 100 Tips and Tricks Website Development Server Operating Systems Databases
 Ivorde.ROarrow Server Operating Systems arrowAdministration GuidesarrowHow to remount UNIX filesystems with one command 

Article Sections

    Hello, Guest !
User name:
Password:
 
Google

 SATELLITE INTERNET
 FreeBSD Tutorials
 Linux LVM Commands
 Free Shell Accounts
 FreeBSD Project
 FreeBSD Handbook
 Advanced Bash-Scripting Guide
 The OpenBSD Project
 Distrowatch
 FreeBSD Handbook


Apache Webserver Home Page

Blog, intrebari si raspunsuri despre Leasing

Posted on: 16 Nov 2007
Author: mandrei
Section: Server Operating Systems | Administration Guides
Views: 389
Comments: 1 (Add)

How to remount UNIX filesystems with one command

Unix Filesystems missing after reboot ?

After reboot filesystems could not be mounted from various reasons (auto mount = off, errors in superblock, problems with volume groups, etc). Working with with filesystems that reside on Storate Are Networks or with Network Attached Storage or with large ammounts of filesystems / mountpoints can be difficult some times.

After rebooting a server filesystems could not be mounted from various reasons (auto mount = off, errors in superblock, problems with volume groups, etc). Working with filesystems on Storate Are Networks or with Network Attached Storage or with large ammounts of filesystems/mountpoints can be difficult some times, especially when you have ~50-60 filesystem mounted and 2-3 missing :)

Today, while working on an AIX server I found my self in the situation in which, after reboot, there were very few filesystems mounted, around 15-16 compared to ~ 42 that were mounted before I had rebooted the server (the cause is irrelevant).

root@server:/home/root/before #df -k
Filesystem 1024-blocks Free %Used Iused %Iused Mounted on
/dev/hd4 131072 69180 48% 3409 18% /
/dev/hd2 3538944 1422408 60% 39009 11% /usr
/dev/hd9var 524288 273736 48% 2558 4% /var
/dev/hd3 884736 790332 11% 1061 1% /tmp
/dev/hd1 163840 57520 65% 607 5% /home
/proc - - - - - /proc
/dev/hd10opt 131072 19200 86% 2386 34% /opt
/dev/lvtsm 32768 27672 16% 35 1% /var/tsm
/dev/lvesm 262144 121320 54% 156 1% /usr/esm
/dev/lvtivoli 294912 135180 55% 983 4% /opt/Tivoli
/dev/lvexploit 294912 6216 98% 220 13% /exploit
/dev/lvaudit 65536 65060 1% 8 1% /audit
/dev/lvmqmclient 131072 130672 1% 25 1% /var/mqm
/dev/lvcd 10518528 1071256 90% 3110 2% /SAPCD
/dev/lvoracle 1048576 734400 30% 657 1% /oracle

Luckily for me, before reboot I do the "before" commands, as I like to call them:

root@server:/home/root/# mkdir ~/before
root@server:/home/root/# ps -ef | tee before/psef && netstat -rn | tee before/netstat -an && df -k | tee before/df-k && mount | tee before/mount && prtconf|tee before/prtconf && errpt | tee before/errpt && bootlist -m normal -o | tee before/bootlist && ifconfig -a | tee before/ifconfig-a && lsvg -o | tee before/lsvg-o && lssrc -a |tee before/lssrc-a && instfix -i | egrep -i "ML|csp" |tee before/instfix-i && lsvg -o |tee before/instfix-i && lsof |tee before/lsof

 

So I go into ~/before directory and issue the following command that will automatically remount all filesystems from before reboot :

root@server:/home/root/# for i in $(cat df-k | tail +2 | awk '{print $NF}'); do df -k | grep -w "$i" >/dev/null; if [[ $? != "0" ]]; then echo "Mounting $i ............."; mount $i; echo "Done"; fi; done
Mounting /oracle/DB1 .............
Done

Of course, from this command you can also create a script to remount all filesystems that were mounted before the reboot.

This command is applicable on FreeBSD, Linux and AIX and other Unix operating systems.

 

Bookmarks: Echo "How to remount UNIX filesystems with one command" around:
del.icio.usdiggFurlYahooMyWebGoogleBookmarksFaceBookTechnocratti
-------------------advertising-----------------

Other articles in Server Operating Systems / Administration Guides
» How to prevent accidental file overwrites from output redirection
» Linux / UNIX Frequently Asked Questions - nixCraft
» Reloading /etc/profile - how to reload Unix /etc/profile
» Go to previous working directory - Unix - Linux - BSD
» Substitute strings in files with perl, sed or vi(m)




Contact webmaster regarding this article
Register or Login to post your article
Hello, Guest ! You can Login or Register to www.ivorde.ro!

 Post comment:

Name:
Title:
Comment:
Please type the word you see in the image (anti-spam verification). Refresh the page if you don't understand the word.
Verification code
Allowed HTML Tags for comments:<p><strong><em><u><h1><h2><h3><h4><h5><h6><img><li>
<ol><ul><span><div><br><ins><del>

1 comment(s) to How to remount UNIX filesystems with one command:

1. Re: How to remount UNIX filesystems with one command
No errors on filesystems required by mandrei at November 21st, 2007 - 17:41
For this command to work smoothly there must be no errors on any filesystems.

   Latest topics on the forum:
Nginx + php-fpm setting php upload_max_filesize and other php values per vhost
Mysql> how to store select Zulu / UTC timestamp in database
Quagga ospf neighbour stuck in ExStart/DROther state
How to disable anonymous access in samba 3
"checking for libnet_build_ip in -lnet... no"+"ERROR! Libnet library not found"
CentOS Install Nemesis packet crafting tool + Libnet
Using curl to get the HTTP response from an HTTP server
Mdadm - Linux software RAID
Linux - Unable to login (and authentication succeeds) - File size limit exceeded
Linux/FreeBSD how to check ntp time synchronization
 
   Most viewed articles:
How to remove first/last character from a string using SED - 6792 views
How to clear/reset DNS cache on Windows XP / Linux - 4459 views
Reloading /etc/profile - how to reload Unix /etc/profile - 4421 views
How to calculate difference in days between two dates in MySQL - 4381 views
Set up HTTP PROXY via command line in Linux/FreeBSD - 3663 views

   Latest 10 articles:
FreeBSD - Collect installed hard disk drive information - 19 Mar 2009
Set up FTP PROXY via command line in Linux/FreeBSD - 19 Mar 2009
Set up HTTP PROXY via command line in Linux/FreeBSD - 19 Mar 2009
Qmail relay to smarthost: How to route all mail to a smarthost - 03 Feb 2009
EXIM 4 relay to smarthost: How to route all mail except local domain - 03 Feb 2009
Windows XP: print LISTEN ports and network connections using netstat - 30 Jan 2009
qmail qmail-scanner/clamav qmail-inject: fatal: qq temporary problem / clamdscan: corrupt or unknown clamd scanner error or memory/resource/perms problem - exit status 512/2 - 05 Dec 2008
How to cut out first last n characters from each file name, from a filelist - 04 Nov 2008
Mozilla Firefox3 is now released - 18 Jun 2008
How to switch lower case to upper case and upper case to lower case in a string - 17 Jun 2008


Archives
» 2007  |  June  |  October  |  November  |  December
» 2008  |  January  |  February  |  March  |  April  |  May  |  June  |  November  |  December
» 2009  |  January  |  February  |  March



Home | Archives | Sitemap | About | Contact

Designed and developed by Andrei Manescu. Optimized for Mozilla Firefox.  
Copyright 2007 Andrei Manescu
All trademarks and copyrights on this page are owned by their respective owners. Comments are owned by those who posted them.
Valid W3 Document Valid XHTML 1.0 Transitional Valid CSS! The FreeBSD Project Viewable With Any Browser