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.
I've noticed in my error logs that that I've been getting some bad sectors. This error seems to be spamming my log almost 30 times a day so it had been really catching my attention. Ive tried googling the error message but I really don't understand the solutions. I believe there might even be a previous post on this site about it. Either way, this is the message im getting.
I've read the man pages on both fsck and mkfs (using the -c argument, but that seems to only apply when creating a new file system) and am scared to fry my system experimenting with them.
Now what im curious is two things. Can I use a safe utility without unmounting devices to either fix or at least isolate those sectors so that the system can stop displaying that message?
Or should I just accept that message as a warning that my system is slowly on its way to hard drive heaven?
I figured, I was doing some research on the e2fsck command and (from what I understand) it is supposed to detect and possibly fix back blocks.
as root i tried running "e2fsck -pv /dev/hda" and it gives me:
"e2fsck: Device or resource busy while trying to open /dev/hda
Filesystem mounted or opened exclusively by another program?"
now reading the man page i noticed that if the command runs and i get an exit code of 2... that means the file system errors were corrected, should be restarted if the file system was mounted...doesnt that mean i can run this command on a mounted file system?
Either way, would this command help me band aid my situation until i can get myself a new hard drive?
Any 'fsck' maintenance should be performed on a unmounted filesystem as a 'single user' too prevent someone else from accessing the filesystem. You could use your install cd/dvd to boot or a LiveCD that will allow you to perform the filesystem maintenance. Don't mount the filesystem in question. From the cli;
Code:
~#fsck -y /dev/your_dev_File_partition #filesystem too repair
Code:
excerpt from 'man fsck';
NAME
fsck - check and repair a Linux file system
SYNOPSIS
fsck [ -sAVRTMNP ] [ -C [ fd ] ] [ -t fstype ] [filesys ... ] [--] [
fs-specific-options ]
DESCRIPTION
fsck is used to check and optionally repair one or more Linux file sys-
tems. filesys can be a device name (e.g. /dev/hdc1, /dev/sdb2), a
mount point (e.g. /, /usr, /home), or an ext2 label or UUID specifier
(e.g. UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd or LABEL=root). Nor-
mally, the fsck program will try to handle filesystems on different
physical disk drives in parallel to reduce the total amount of time
needed to check all of the filesystems.
If no filesystems are specified on the command line, and the -A option
is not specified, fsck will default to checking filesystems in
/etc/fstab serially. This is equivalent to the -As options.
Code:
excerpt from 'man e2fsck';
NAME
e2fsck - check a Linux ext2/ext3 file system
SYNOPSIS
e2fsck [ -pacnyrdfkvstDFSV ] [ -b superblock ] [ -B blocksize ] [ -l|-L
bad_blocks_file ] [ -C fd ] [ -j external-journal ] [ -E
extended_options ] device
DESCRIPTION
e2fsck is used to check a Linux second extended file system (ext2fs).
E2fsck also supports ext2 filesystems containing a journal, which are
also sometimes known as ext3 filesystems, by first applying the journal
to the filesystem before continuing with normal e2fsck processing.
After the journal has been applied, a filesystem will normally be
marked as clean. Hence, for ext3 filesystems, e2fsck will normally run
the journal and exit, unless its superblock indicates that further
checking is required.
device is the device file where the filesystem is stored (e.g.
/dev/hdc1).
Read the 'man fsck' and 'man e2fsck' to understand the commands.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.