10eed run fsck on root file system - The FreeBSD Forums
The FreeBSD Forums  

Go Back   The FreeBSD Forums > Base System > General

General General questions about the FreeBSD operating system. Ask here if your question does not fit elsewhere.

Reply
 
Thread Tools Display Modes
  #1  
Old March 16th, 2010, 09:46
sniper007's Avatar
sniper007 sniper007 is offline
Member
 
Join Date: Nov 2008
Location: Slovenia
Posts: 110
Thanks: 8
Thanked 2 Times in 2 Posts
Default run fsck on root file system

If i run fsck on one filesystem and fsck need to repair some things then this partition must be unmounted

correct ?

So running fsck on root file system isn't possible within same OS ? correct ?


What is the best way to do that, live cd ?


BR,

Jurif
__________________
If anything can go wrong, it will. If it can't, it will anyway
Reply With Quote
  #2  
Old March 16th, 2010, 10:09
graudeejs's Avatar
graudeejs graudeejs is online now
Style(9) Addict
 
Join Date: Nov 2008
Location: Riga, Latvia
Posts: 4,523
Thanks: 422
Thanked 607 Times in 475 Posts
Default

boot into single user mode, root will be mounted read only, then run fsck , and you will be able to fix everything
Reply With Quote
  #3  
Old March 16th, 2010, 10:21
sniper007's Avatar
sniper007 sniper007 is offline
Member
 
Join Date: Nov 2008
Location: Slovenia
Posts: 110
Thanks: 8
Thanked 2 Times in 2 Posts
Default

Is it possible to fix filesystem which is mounted read only ?
__________________
If anything can go wrong, it will. If it can't, it will anyway
Reply With Quote
  #4  
Old March 16th, 2010, 10:26
mky mky is offline
Junior Member
 
Join Date: Nov 2008
Location: Warsaw, Poland
Posts: 32
Thanks: 6
Thanked 4 Times in 2 Posts
Default

If you don't want reboot your system (for any reasons) you can also remount file system as read-only. For example:
Code:
mount -fr /
and run fsck. After finish you can remount file system as read-write:
Code:
mount -fw /
This method may be unsafe if you have only one partition for system (without separate /var /usr /tmp etc.). Some processes may crash if they can't write on the file system.

If you have physical access to your machine, the safe method will be boot to single mode, then run fsck.
Reply With Quote
  #5  
Old March 16th, 2010, 11:18
graudeejs's Avatar
graudeejs graudeejs is online now
Style(9) Addict
 
Join Date: Nov 2008
Location: Riga, Latvia
Posts: 4,523
Thanks: 422
Thanked 607 Times in 475 Posts
Default

Quote:
Originally Posted by sniper007 View Post
Is it possible to fix filesystem which is mounted read only ?
that's the way root should be fsck'ed
Reply With Quote
  #6  
Old March 16th, 2010, 11:44
SirDice's Avatar
SirDice SirDice is offline
Moderator
 
Join Date: Nov 2008
Location: Rotterdam, Netherlands
Posts: 13,725
Thanks: 47
Thanked 2,023 Times in 1,862 Posts
Default

You cannot "fix" a read-only mounted filesystem:
Quote:
If the operator does not have write permission on the file system fsck_ffs will default to a -n action.
See fsck_ffs(8)
__________________
Senior UNIX Engineer at Unix Support Nederland
Experience is something you don't get until just after you need it.
Reply With Quote
The Following User Says Thank You to SirDice For This Useful Post:
graudeejs (March 16th, 2010)
  #7  
Old March 16th, 2010, 11:55
graudeejs's Avatar
graudeejs graudeejs is online now
Style(9) Addict
 
Join Date: Nov 2008
Location: Riga, Latvia
Posts: 4,523
Thanks: 422
Thanked 607 Times in 475 Posts
Default

ah sorry, haven't been using UFS for long time....
# mount -uo rw /
solves this


Thanks SirDice for fixing me
Reply With Quote
  #8  
Old March 16th, 2010, 12:26
sniper007's Avatar
sniper007 sniper007 is offline
Member
 
Join Date: Nov 2008
Location: Slovenia
Posts: 110
Thanks: 8
Thanked 2 Times in 2 Posts
Default

Is it possible to fix filesystem which is mounted anyway ?
__________________
If anything can go wrong, it will. If it can't, it will anyway
Reply With Quote
  #9  
Old March 16th, 2010, 13:36
SirDice's Avatar
SirDice SirDice is offline
Moderator
 
Join Date: Nov 2008
Location: Rotterdam, Netherlands
Posts: 13,725
Thanks: 47
Thanked 2,023 Times in 1,862 Posts
Default

Quote:
Originally Posted by sniper007 View Post
Is it possible to fix filesystem which is mounted anyway ?
If I'm not mistaken only the errors that are fixable in "preen" mode.
__________________
Senior UNIX Engineer at Unix Support Nederland
Experience is something you don't get until just after you need it.
Reply With Quote
Reply

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
HOWTO: GELI+ZFS for whole system inc. root with boot from USB stick donnex Howtos & FAQs (Moderated) 21 October 14th, 2011 21:58
[Solved] How to run system without video adapter? Bat System Hardware 9 March 1st, 2010 11:03
cannot change any /system/administrator options, even logged in as root triplesquarednine GNOME 7 August 17th, 2009 11:03
What is the defalt file system for the root disk on FreeBSD? corone General 2 July 19th, 2009 20:31
root delete file when other user open it guixingyi General 16 December 11th, 2008 10:38


All times are GMT +1. The time now is 09:43.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
The mark FreeBSD is a registered trademark of The FreeBSD Foundation and is used by The FreeBSD Project with the permission of The FreeBSD Foundation.
Web protection and acceleration provided by CloudFlare
0