LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-15-2015, 05:27 PM   #1
LittleMaster
Member
 
Registered: Jun 2012
Posts: 100
Blog Entries: 1

Rep: Reputation: Disabled
Need help running fsck on mounted Logical Volume


Hi ALL,
One of filesystem went readonly.Need help how to run filesystem check on mounted logical volume to make the filesystem read write

[root@porsche ~]# cd /opt/apps
[root@porscheapps]# touch 1
touch: cannot touch `1': Read-only file system
[root@porsche apps]#



[root@porsche ]# df -h /opt/apps
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/apps-vg
798G 687G 71G 91% /opt/apps
[root@porsche ]#
 
Old 02-15-2015, 08:55 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,838

Rep: Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822
Don't. See the warning(s) in (for example) fsck.ext4.
Might depend on f/s type, but a reboot should recognise it needs a fsck and run it automagically.
 
Old 02-15-2015, 09:43 PM   #3
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,604

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
You can't run fsck on a mounted filesystem - ever.

The problem is that the mounted filesystem has data blocks in various buffers directory caches, free lists ...

fsck goes directly to the device interface (in this case, the logical volume) and modifies data blocks directly - and thus does not modify any that are held in memory.

By itself, this isn't a problem for a read-only filesystem... But you can't remount it (the buffers are not dropped - just the read only flag gets cleared). You also can't dismount it - as THEN the blocks would get written back to the filesystem, overwriting the corrections that fsck created.

You first have to dismount the filesystem... Then you can run fsck on it. After which the mount will load fresh data from the volume.

The only time fsck on a read-only volume works, is if you do a hard reboot after doing the fsck. This normally is only done to the root filesystem - as the fsck utility is usually on the root filesystem...

But it is a hard reboot that is required - as in pressing a reset switch or powering off the system. Laptops are a bit tricky as usually the reset/power is actually just an event requesting a graceful reboot... and thus would NOT be appropriate with using fsck.
 
Old 02-16-2015, 11:42 AM   #4
LittleMaster
Member
 
Registered: Jun 2012
Posts: 100
Blog Entries: 1

Original Poster
Rep: Reputation: Disabled
Hi ,
Whether i can run fsck on runlevel 3 by umounted the filesystem .Whether can i run below step on run level 3

umount /opt/apps
e2fsck -y /dev/mapper/apps-vg
mount /opt/apps

runnning e2fsck on runlevel 3 by umounting filesystem creates any issue
 
Old 02-16-2015, 04:19 PM   #5
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,604

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
I think your answer is "yes"... Your last sentence may be incomplete.

As long as the filesystem is dismounted, there is no problem running fsck.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LVM Mount Physical Volume/Logical Volume without a working Volume Group mpivintis Linux - Newbie 10 01-11-2014 08:02 AM
How to edit a logical volume size that is mounted to / linux-who? Linux - Enterprise 5 07-30-2009 01:13 PM
Extending logical volume LogVol01 Insufficient allocatable logical exte swap space umeshsharma Linux - Newbie 4 06-22-2009 01:26 PM
How to resize a logical volume mounted as /var (FC9) prabhatsoni Linux - Hardware 10 01-04-2009 04:40 PM
In fc3 Can I umount a Logical Volume which is mounted auto in fstab? TomF Linux - Newbie 2 12-16-2004 02:40 AM


All times are GMT -5. The time now is 02:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration