Discussion:
How to unmount partition?
Greg Wallace
2007-01-18 02:15:17 UTC
Permalink
I want to try running a manual fsck on my main partition. I booted into
runlevel 3 and tried "umount /dev/hda2" but got "device is busy". I'm
thinking that I should be trying to unmount the filesystem itself, not the
device, but don't know how to figure out what that is (and I can't remember
a command that would show the filesystem name associated with the device).
Then again, maybe I'm way off base here. Anyway, I just need to be able to
unmount the filesystem so I can run fsck on it. Can someone tell me what to
enter to do the unmount?

Thanks,
Greg Wallace
Sunny
2007-01-18 02:27:25 UTC
Permalink
Post by Greg Wallace
I want to try running a manual fsck on my main partition. I booted into
runlevel 3 and tried "umount /dev/hda2" but got "device is busy". I'm
thinking that I should be trying to unmount the filesystem itself, not the
device, but don't know how to figure out what that is (and I can't remember
a command that would show the filesystem name associated with the device).
Then again, maybe I'm way off base here. Anyway, I just need to be able to
unmount the filesystem so I can run fsck on it. Can someone tell me what to
enter to do the unmount?
Thanks,
Greg Wallace
IO did not see dat you started a new thread, so I answered in the
other one. So, the solution is to boot either from the install media
(cd/dvd) and select maintenance mode, or boot from knoppix, damn small
linux, etc.
--
Svetoslav Milenov (Sunny)

Even the most advanced equipment in the hands of the ignorant is just
a pile of scrap.
Randall R Schulz
2007-01-18 02:33:06 UTC
Permalink
Greg,
Post by Greg Wallace
I want to try running a manual fsck on my main partition. I booted
into runlevel 3 and tried "umount /dev/hda2" but got "device is
busy".
That means either a process has a file on the mounted file system open
or there is a process with a directory on that file system as its
current working directory (this is the one that's easy to overlook).
Post by Greg Wallace
I'm thinking that I should be trying to unmount the
filesystem itself, not the device,
There's no real difference when it comes to using the "umount" command.
It will look up a mount-point directory in /etc/mtab and translate it
to the name of the device mounted there for you, so you can use either
to accomplish an unmount operation.
Post by Greg Wallace
but don't know how to figure out
what that is (and I can't remember a command that would show the
filesystem name associated with the device).
The "mount" command shows which device is mounted on which mount point
(a directory).
Post by Greg Wallace
Then again, maybe I'm
way off base here. Anyway, I just need to be able to unmount the
filesystem so I can run fsck on it. Can someone tell me what to
enter to do the unmount?
% umount /dev/sd...

% umount /dev/hd...

% umount /media/...

etc.
Post by Greg Wallace
Thanks,
Greg Wallace
Randall Schulz
Jay C Vollmer
2007-01-18 02:33:56 UTC
Permalink
Post by Greg Wallace
I want to try running a manual fsck on my main partition. I booted into
runlevel 3 and tried "umount /dev/hda2" but got "device is busy". I'm
thinking that I should be trying to unmount the filesystem itself, not the
device, but don't know how to figure out what that is (and I can't
remember
Post by Greg Wallace
a command that would show the filesystem name associated with the device).
Then again, maybe I'm way off base here. Anyway, I just need to be able
to
Post by Greg Wallace
unmount the filesystem so I can run fsck on it. Can someone tell me what
to
Post by Greg Wallace
enter to do the unmount?
To list the mounted filesystems and the device entries associated with each
of these, use the 'df' command.

To unmount one of these filesystems, first make sure that nothing is
accessing the filesystem in question. Once this is the case, issue the
following as root:

umount -v filesystem_name

If you get the message that a filesystem cannot be unmounted because it is
busy, use the 'lsof' command to see which processes are still using that
filesystem. Term any processes holding the filesystem hostage and then try
umount again.
--
JAY VOLLMER ***@VISI.COM
TEXT REFS DOUBLEPLUSUNGOOD SELFTHINK
VERGING CRIMETHINK - IGNORE FULLWISE
Greg Wallace
2007-01-18 02:35:36 UTC
Permalink
Post by Sunny
Post by Greg Wallace
I want to try running a manual fsck on my main partition. I booted into
runlevel 3 and tried "umount /dev/hda2" but got "device is busy". I'm
thinking that I should be trying to unmount the filesystem itself, not
the
Post by Sunny
Post by Greg Wallace
device, but don't know how to figure out what that is (and I can't
remember
Post by Sunny
Post by Greg Wallace
a command that would show the filesystem name associated with the
device).
Post by Sunny
Post by Greg Wallace
Then again, maybe I'm way off base here. Anyway, I just need to be able
to
Post by Sunny
Post by Greg Wallace
unmount the filesystem so I can run fsck on it. Can someone tell me what
to
Post by Sunny
Post by Greg Wallace
enter to do the unmount?
Thanks,
Greg Wallace
IO did not see dat you started a new thread, so I answered in the
other one. So, the solution is to boot either from the install media
(cd/dvd) and select maintenance mode, or boot from knoppix, damn small
linux, etc.
--
Svetoslav Milenov (Sunny)
Thanks. I'll try maintenance mode from the installation DVD.

Greg W.
Greg Wallace
2007-01-18 02:44:33 UTC
Permalink
Post by Randall R Schulz
Greg,
Post by Greg Wallace
I want to try running a manual fsck on my main partition. I booted
into runlevel 3 and tried "umount /dev/hda2" but got "device is
busy".
That means either a process has a file on the mounted file system open
or there is a process with a directory on that file system as its
current working directory (this is the one that's easy to overlook).
Interesting. I booted up in runlevel 3 thinking that would prevent anything
from from interfering with the umount. Based on a note from Sunny, sounds
like I need to boot from the installation DVD in order to be able to unmount
the file system.
Post by Randall R Schulz
Post by Greg Wallace
I'm thinking that I should be trying to unmount the
filesystem itself, not the device,
There's no real difference when it comes to using the "umount" command.
It will look up a mount-point directory in /etc/mtab and translate it
to the name of the device mounted there for you, so you can use either
to accomplish an unmount operation.
So I guess there was nothing wrong with umount /dev/hda2, it was simply
unmountable, so to speak, for other reasons.
Post by Randall R Schulz
Post by Greg Wallace
but don't know how to figure out
what that is (and I can't remember a command that would show the
filesystem name associated with the device).
The "mount" command shows which device is mounted on which mount point
(a directory).
Thanks. I'll make note of that.
Post by Randall R Schulz
Post by Greg Wallace
Then again, maybe I'm
way off base here. Anyway, I just need to be able to unmount the
filesystem so I can run fsck on it. Can someone tell me what to
enter to do the unmount?
% umount /dev/sd...
% umount /dev/hd...
% umount /media/...
etc.
Ok, so there was nothing wrong with what I entered, it's just that the
filesystem was unmountable.
Post by Randall R Schulz
Post by Greg Wallace
Thanks,
Greg Wallace
Randall Schulz
Thanks,
Greg Wallace
Greg Wallace
2007-01-18 02:49:36 UTC
Permalink
Post by Jay C Vollmer
Post by Greg Wallace
I want to try running a manual fsck on my main partition. I booted into
runlevel 3 and tried "umount /dev/hda2" but got "device is busy". I'm
thinking that I should be trying to unmount the filesystem itself, not
the
Post by Jay C Vollmer
Post by Greg Wallace
device, but don't know how to figure out what that is (and I can't
remember
Post by Jay C Vollmer
Post by Greg Wallace
a command that would show the filesystem name associated with the
device).
Post by Jay C Vollmer
Post by Greg Wallace
Then again, maybe I'm way off base here. Anyway, I just need to be able
to
Post by Jay C Vollmer
Post by Greg Wallace
unmount the filesystem so I can run fsck on it. Can someone tell me what
to
Post by Jay C Vollmer
Post by Greg Wallace
enter to do the unmount?
To list the mounted filesystems and the device entries associated with each
of these, use the 'df' command.
To unmount one of these filesystems, first make sure that nothing is
accessing the filesystem in question. Once this is the case, issue the
umount -v filesystem_name
If you get the message that a filesystem cannot be unmounted because it is
busy, use the 'lsof' command to see which processes are still using that
filesystem. Term any processes holding the filesystem hostage and then try
umount again.
--
TEXT REFS DOUBLEPLUSUNGOOD SELFTHINK
VERGING CRIMETHINK - IGNORE FULLWISE
Well, I entered lsof and about 6 or 7 screens of data rolled by. Looks like
booting from the installation DVD is the only (reasonable) way to get there.

Greg W.
Randall R Schulz
2007-01-18 02:55:05 UTC
Permalink
Greg,
Post by Greg Wallace
...
So I guess there was nothing wrong with umount /dev/hda2, it was
simply unmountable, so to speak, for other reasons.
The only file system that can never by unmounted is the root file
system.
Post by Greg Wallace
...
Post by Randall R Schulz
The "mount" command shows which device is mounted on which mount
point (a directory).
Thanks. I'll make note of that.
...
Ok, so there was nothing wrong with what I entered, it's just that
the filesystem was unmountable.
Unmountable _AT THE MOMENT!_ There are no file systems (other than the
root) that cannot be unmounted.

There are rare conditions when file operations hang (identifiable by
a 'D' value in the "STAT" column of the "ps -l" output), but truly this
is a rare (and, by definition, erroneous) circumstance.
Post by Greg Wallace
...
Thanks,
Greg Wallace
Randall Schulz
Randall R Schulz
2007-01-18 02:57:27 UTC
Permalink
Post by Greg Wallace
...
Well, I entered lsof and about 6 or 7 screens of data rolled by.
Looks like booting from the installation DVD is the only (reasonable)
way to get there.
Noooooooooooo!

Learn how to filter the lsof output. It is very diagnostically valuable!

Just use grep to filter out names (e.g.) that you're interested in.

Experiment. Learn. Just giving up and rebooting teaches you nothing and
does nothing to repair any possible damage to your file system, e.g.
Post by Greg Wallace
Greg W.
RRS
Marc Wilson
2007-01-18 03:12:10 UTC
Permalink
Post by Randall R Schulz
Unmountable _AT THE MOMENT!_ There are no file systems (other than the
root) that cannot be unmounted.
While that may be true in theory, in practice it's really not a good idea
to tell cluebies that.

Or have you never gotten to watch what happens when you un-mount /usr from
under someone? Things don't work very well after that.
--
Marc Wilson | Veni, Vidi, Visa.
***@cox.net |
Marc Wilson
2007-01-18 03:21:00 UTC
Permalink
Post by Greg Wallace
I want to try running a manual fsck on my main partition. I booted into
runlevel 3 and tried "umount /dev/hda2" but got "device is busy".
The runlevel certainly doesn't have anything to do with it... don't know
who would have told you it did.
Post by Greg Wallace
I'm thinking that I should be trying to unmount the filesystem itself,
not the device,
You don't mount devices, only filesystems. Filesystems often, but not
nearly always, live on devices.
Post by Greg Wallace
but don't know how to figure out what that is (and I can't remember a
command that would show the filesystem name associated with the device).
Then again, maybe I'm way off base here.
man mount(1)
Post by Greg Wallace
Anyway, I just need to be able to unmount the filesystem so I can run
fsck on it.
No, you need to unmount it (or mount it read-only) in order to *repair* it
with fsck. You can *check* it all you want.

Or touch /forcefsck, and then reboot the box, since you already indicated
that wasn't a problem.
Post by Greg Wallace
Can someone tell me what to enter to do the unmount?
You don't want to do that... if you unmount the filesystem, exactly where
do you expect your running software to be coming from after you do so?

Amazing to me that in the entire thread to date, no one pointed out how
fsck actually works, or why you really don't want to un-mount the
filesystem.
--
Marc Wilson | Don't take life so serious, son, it ain't nohow
***@cox.net | permanent. -- Walt Kelly
Randall R Schulz
2007-01-18 03:49:47 UTC
Permalink
Post by Marc Wilson
Post by Randall R Schulz
Unmountable _AT THE MOMENT!_ There are no file systems (other than
the root) that cannot be unmounted.
While that may be true in theory, in practice it's really not a good
idea to tell cluebies that.
Eh?

You'd rather have them pull the plug and risk file system corruption?
Post by Marc Wilson
Or have you never gotten to watch what happens when you un-mount /usr
from under someone? Things don't work very well after that.
All I'm saying is that once you disoncontinue all active uses of a
mounted file system (including working directories), it can be
unmounted safely. That's true and useful information.
Post by Marc Wilson
--
Marc Wilson
RRS
Marc Wilson
2007-01-18 04:20:27 UTC
Permalink
Post by Randall R Schulz
You'd rather have them pull the plug and risk file system corruption?
You want a *honest* answer? I don't care what cluebies do to themselves.
That's their own problem.

That doesn't mean I'm not going to provide information, but it's not my
responsibility to *stop* anyone but myself from doing anything.
Post by Randall R Schulz
All I'm saying is that once you disoncontinue all active uses of a
mounted file system (including working directories), it can be
unmounted safely. That's true and useful information.
You have a different definition of "uses" than most people. Sure you can
unmount it, but that doesn't mean you can do anything with the box
afterwards.
--
Marc Wilson | You are only young once, but you can stay immature
***@cox.net | indefinitely.
Randall R Schulz
2007-01-18 04:31:52 UTC
Permalink
Post by Marc Wilson
...
You have a different definition of "uses" than most people. Sure you
can unmount it, but that doesn't mean you can do anything with the
box afterwards.
Oy.

Use: Noun: The act of using something.


This is everyday English, yes?


Unless you force an unmount, you must discontinue all uses of any
file-system entity on the file system you want to unmount. That's
either an open file (which includes memory-mapped uses of things like
shared object files) or a current working directory.

If you reduce the number of _uses_ (plurals of the noun defined above),
then the umount command, sans -f / force option, will succeed.

Naturally, after this, the file system that was unmounted will be
inaccessible. That's the point of unmounting it.


By the way, what is a "cluebie?"
Post by Marc Wilson
--
Marc Wilson
Randall Schulz
Randall R Schulz
2007-01-18 04:49:04 UTC
Permalink
Post by Randall R Schulz
...
If you reduce the number of _uses_ (plurals of the noun defined
above), then the umount command, sans -f / force option, will
succeed.
Sorry. Something got messed up. I mean to say:

"If you reduce the number of uses of file-system entities on the file
system in question to zero, then the umount command [...] will
succeed."
Post by Randall R Schulz
...
Randall Schulz
Darryl Gregorash
2007-01-18 05:43:43 UTC
Permalink
Post by Randall R Schulz
Post by Randall R Schulz
...
If you reduce the number of _uses_ (plurals of the noun defined
above), then the umount command, sans -f / force option, will
succeed.
"If you reduce the number of uses of file-system entities on the file
system in question to zero, then the umount command [...] will
succeed."
Randall,

I have to agree with Marc on this. He gave the example of /usr. In
addition to that, I run with separate partitions for /var and /tmp.
Would you suggest that I turn off all logging so I can umount /var? That
will require stopping quite a few services that probably should be left
running. I bet Yast will complain, rather loudly, if I run it without a
mounted /var. How does one turn off all activity on /tmp?

Whether or not something is possible in principle is not the point here.
The question is, can the advice be followed without potential for making
a serious mess of things? In the hands of the less-than-experienced, the
answer here is certainly "no", and so the advice should not be given.
--
The best way to accelerate a computer running Windows is at 9.81 m/s²
Randall R Schulz
2007-01-18 06:24:40 UTC
Permalink
Post by Darryl Gregorash
...
Post by Randall R Schulz
"If you reduce the number of uses of file-system entities on the
file system in question to zero, then the umount command [...] will
succeed."
Randall,
I have to agree with Marc on this. ...
The person asked about unmounting when the "device is busy" diagnostic
results. He wanted to run fsck. He was in run level 3. His goal is
reasonable and my response was valid.

That's really all there is to it.
Post by Darryl Gregorash
Whether or not something is possible in principle is not the point
here.
Whether or not it conforms to your or my idea of advisable is also not
the point.
Post by Darryl Gregorash
The question is, can the advice be followed without potential
for making a serious mess of things?
There is never any damage caused by non-forcibly unmounting a file
system.
Post by Darryl Gregorash
In the hands of the
less-than-experienced, the answer here is certainly "no", and so the
advice should not be given.
Right. Withhold facts to protect the naive.

Sorry, I don't agree with that philosophy.


Randall Schulz
Carlos E. R.
2007-01-18 11:07:20 UTC
Permalink
Post by Randall R Schulz
The person asked about unmounting when the "device is busy" diagnostic
results. He wanted to run fsck. He was in run level 3. His goal is
reasonable and my response was valid.
He should be in runlevel 1, not 3, to do those things.

- --
Cheers,
Carlos E. R.
Kenneth Schneider
2007-01-18 13:56:28 UTC
Permalink
Post by Greg Wallace
I want to try running a manual fsck on my main partition.
Are you talking about /, the root partition? If so it cannot be checked
while the system is running, you need to boot the DVD and use rescue
system.
--
Ken Schneider
UNIX since 1989, linux since 1994, SuSE since 1998
Kenneth Schneider
2007-01-18 13:58:10 UTC
Permalink
Post by Randall R Schulz
Post by Marc Wilson
Post by Randall R Schulz
Unmountable _AT THE MOMENT!_ There are no file systems (other than
the root) that cannot be unmounted.
While that may be true in theory, in practice it's really not a good
idea to tell cluebies that.
Eh?
You'd rather have them pull the plug and risk file system corruption?
Post by Marc Wilson
Or have you never gotten to watch what happens when you un-mount /usr
from under someone? Things don't work very well after that.
All I'm saying is that once you disoncontinue all active uses of a
mounted file system (including working directories), it can be
unmounted safely. That's true and useful information.
Except for / (root) which is always busy with open log files.
--
Ken Schneider
UNIX since 1989, linux since 1994, SuSE since 1998
Kenneth Schneider
2007-01-18 14:00:49 UTC
Permalink
Post by Randall R Schulz
Post by Darryl Gregorash
...
Post by Randall R Schulz
"If you reduce the number of uses of file-system entities on the
file system in question to zero, then the umount command [...] will
succeed."
Randall,
I have to agree with Marc on this. ...
The person asked about unmounting when the "device is busy"
No, he asked about umounting his "main" partition which I interpret as
being / (root). Quite a difference.
--
Ken Schneider
UNIX since 1989, linux since 1994, SuSE since 1998
Randall R Schulz
2007-01-18 14:56:23 UTC
Permalink
Post by Kenneth Schneider
...
Post by Randall R Schulz
The person asked about unmounting when the "device is busy"
No, he asked about umounting his "main" partition which I interpret
as being / (root). Quite a difference.
That escaped my notice, but I did state that one can never unmount the
root file system.
Post by Kenneth Schneider
Ken Schneider
Randall Schulz
Greg Wallace
2007-01-18 19:33:36 UTC
Permalink
Post by Kenneth Schneider
Post by Greg Wallace
I want to try running a manual fsck on my main partition.
Are you talking about /, the root partition? If so it cannot be checked
while the system is running, you need to boot the DVD and use rescue
system.
Yeah, that's what other people told me and that's what I did.
Interestingly, Carlos Robinson just sent out a note that made it sound like
you could also do it if you booted to runlevel 1, but maybe I misinterpreted
what he was saying.
Post by Kenneth Schneider
--
Ken Schneider
UNIX since 1989, linux since 1994, SuSE since 1998
Greg W
Marc Wilson
2007-01-19 03:53:58 UTC
Permalink
Post by Kenneth Schneider
Except for / (root) which is always busy with open log files.
If you're keeping log files in the root, you have far larger problems than
whether or not you can unmount a filesystem. Log files belong in /var,
which may or may not be a separate filesystem (it is if you're smart).
--
Marc Wilson | Computer Science is merely the post-Turing decline
***@cox.net | in formal systems theory.
Marc Wilson
2007-01-19 03:56:58 UTC
Permalink
Post by Kenneth Schneider
Are you talking about /, the root partition? If so it cannot be checked
while the system is running, you need to boot the DVD and use rescue
system.
Except that it can be, of course. It can *always* be checked.

Whether or not it can be *repaired*, or not, is another issue. If you can
remount it read/only, you can repair it, then re-mount it read/write again.

All this spouting off about runlevels is utter nonsense.
--
Marc Wilson | Reality is for those who can't face Science Fiction.
***@cox.net |
Kenneth Schneider
2007-01-19 04:20:10 UTC
Permalink
Post by Marc Wilson
Post by Kenneth Schneider
Are you talking about /, the root partition? If so it cannot be checked
while the system is running, you need to boot the DVD and use rescue
system.
Except that it can be, of course. It can *always* be checked.
Excuse me, repaired.
--
Ken Schneider
UNIX since 1989, linux since 1994, SuSE since 1998
Kenneth Schneider
2007-01-19 04:19:14 UTC
Permalink
Post by Marc Wilson
Post by Kenneth Schneider
Except for / (root) which is always busy with open log files.
If you're keeping log files in the root, you have far larger problems than
whether or not you can unmount a filesystem. Log files belong in /var,
which may or may not be a separate filesystem (it is if you're smart).
Which in a standard install is _not_ a separate filesystem. This does
_not_ create "far larger problems" as you state.
--
Ken Schneider
UNIX since 1989, linux since 1994, SuSE since 1998
Marc Wilson
2007-01-19 07:16:38 UTC
Permalink
Post by Kenneth Schneider
Which in a standard install is _not_ a separate filesystem. This does
_not_ create "far larger problems" as you state.
And /var is not /root, no matter how you want to dance around it.
--
Marc Wilson | Garbage In -- Gospel Out.
***@cox.net |
Carlos E. R.
2007-01-19 11:18:48 UTC
Permalink
Post by Greg Wallace
Post by Kenneth Schneider
Are you talking about /, the root partition? If so it cannot be checked
while the system is running, you need to boot the DVD and use rescue
system.
Yeah, that's what other people told me and that's what I did.
Interestingly, Carlos Robinson just sent out a note that made it sound like
you could also do it if you booted to runlevel 1, but maybe I misinterpreted
what he was saying.
Yes, but not all partitions.

Switching to runlevel 1 stops many daemons and all users except root. This
allows to umount partitions such as /opt, /home, perhaps /usr, etc. But
the "/" can not be umounted, nor /lib, /var, /etc, etcetera.

So, yes, if you are going to do some maintenance jobs it is better to jump
to runlevel 1, but sometimes it is not enough.


On the other hand, it is also possible (I think) to remount a partition RO
to check it. After all, that is what the boot scripts do to check the "/"
during booting. The exception is "reiserfs": you really need to umount it
to repair. That's why now and then appear people with weird problems in
them (like unerasable unreachable files) and we tell them to fsck from the
rescue system.

HTH :-)


- --
Cheers,
Carlos E. R.
Patrick Shanahan
2007-01-19 12:30:12 UTC
Permalink
* Marc Wilson <***@cox.net> [01-19-07 02:24]:
[...]
Post by Marc Wilson
And /var is not /root, no matter how you want to dance around it.
no, but remember: "root" does not mean "/root"
and: "/root" /= "/"

"/var" may be part of "/" (root) or may be a separate partition.
--
Patrick Shanahan Registered Linux User #207535
http://wahoo.no-ip.org @ http://counter.li.org
HOG # US1244711 Photo Album: http://wahoo.no-ip.org/gallery2
OpenSUSE Linux http://en.opensuse.org/
Kenneth Schneider
2007-01-19 12:47:13 UTC
Permalink
Post by Marc Wilson
Post by Kenneth Schneider
Which in a standard install is _not_ a separate filesystem. This does
_not_ create "far larger problems" as you state.
And /var is not /root, no matter how you want to dance around it.
And I never said it was, look again, I said "/ (root)" which is not the
same as /root. / is referred to as the "root" directory/filesystem. And
in a standard install /var is in the root filesystem.
--
Ken Schneider
UNIX since 1989, linux since 1994, SuSE since 1998
Loading...