Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
You obviously can't unmount a partition that's in use. What do you want to do to that partition? You could just get a live CD and do whatever it is on the unmounted partition.
karthick,
You get that error because u are executing that command from within root partition. You cannot do that. Why would you want to unmount '/' (root) partition?! If you want to edit/troubleshoot something on your linux partition, use livecd.
(When I started typing it was a zero-reply thread. By the time I hit enter, I'm the 5th. :-P )
fsck is done automatically after certain mounts during boot. But if you want to force fsck you can try (as root user),
Code:
shutdown -rF now
. This should reboot your system and when it boots it will first run fsck.
first close all the running programs, and then execute umount /dev/sda1. Make sure you have a backup of data and also that you selected the correct partition.
All our servers are in Sweeden.And am in India.I can't use Live Cd or shutdown -rF now.Its all production servers.If it goes down,then i will get trashed.
Without live cd tell me how to check the filesystem.
Your only option is the mentioned reboot command.
Also, if it is a production server I would recommend not to change the filesystem, unless there is a real good reason for that.
On boot you could :
put in an exit into /etc/rc.d/rc.sysinit to drop out into a shell ro mount -o remount,ro / for a fsck -n /dev/sda1
boot with the kernel parameters " S init=bin/bash "
On a running system :
Create a or several ramdisks with
Code:
mkfs.ext2 /dev/ram[0-9]
and copy needed files from /bin /sbin /lib /etc into it and
use something like
Code:
mkdir /mnt/ram0
mount /dev/ram0 /mnt/ram0
mkdir /mnt/ram0/old_root
mkdir -p /mnt/ram0 /mnt/ram0/bin /mnt/ram0/sbin /mnt/ram0/lib /mnt/ram0/proc /mnt/ram0/etc
cp -a /bin /mnt/ram0
cp -a /sbin /mnt/ram0
cp -a /lib/lib*.so* /mnt/ram0/lib
cp -ar /etc /mnt/ram0
mount -o move /proc /mnt/ram0/proc
chdir /mnt/ram0
pivot_root . old_root
cd /
umount -l old_root
fsck /dev/sda1
mount /dev/sda1 old_root
cd old_root
pivot_root . /mnt/ram0
umount -l /mnt/ram0
This would work best with a statically compiled busybox includig ash which has got fsck.ext[2-3] and of course statically compiled fsck's for /lib/lib*.so* could become too large .
For a first better understanding try dl puppylinux 5series , which comes with a /sbin/init shellscript that contains this code .
AFAIK fsck needs the partition to be mounted read-only, not unmounted. But I don't know how the network connection is affected from this. (I have only done this localy in runlevel 1).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.