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

 SSD VPS Hosting - Vpsie.com
 Mo.nitor.me
 Ivorde forum
 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

Posted on: 16 Nov 2007
Author: mandrei
Section: Server Operating Systems | Administration Guides
Views: 1043
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
» Go to previous working directory - Unix - Linux - BSD
» Substitute strings in files with perl, sed or vi(m)
» List established connections on Unix servers
» How to empty/delete file content in Linux/BSD/Unix




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.
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 - 10:41
For this command to work smoothly there must be no errors on any filesystems.

   Latest topics on the forum:
 
   Most viewed articles:
How to copy a mysql database using mysqldump - 10087 views
How to change a user's password in AIX with the output from ECHO command - 9286 views
FreeBSD: Add/remove an additional IP alias - 6453 views
Qmail relay to smarthost: How to route all mail to a smarthost - 4364 views
Change user shell on FreeBSD Linux and AIX - 3118 views

   Latest 10 articles:
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
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
How to rename files/directories to uppercase/lowercase character names - 17 Jun 2008
How to convert lower case to upper case letters in a shell script/command - 17 Jun 2008
Unix,Linux,FreeBSD - How to rename a list of files, replacing spaces inside their names - 12 Jun 2008
How to change a user's password in AIX with the output from ECHO command - 21 May 2008


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



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