{"id":318,"date":"2019-10-21T19:45:23","date_gmt":"2019-10-21T17:45:23","guid":{"rendered":"http:\/\/linuxboxen2.dk\/?p=318"},"modified":"2019-10-21T19:45:23","modified_gmt":"2019-10-21T17:45:23","slug":"org_fsck","status":"publish","type":"post","link":"https:\/\/www.linuxboxen.dk\/?p=318","title":{"rendered":"FSCK"},"content":{"rendered":"<p>FSCK(8)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 System Administration\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 FSCK(8)<\/p>\n<p>NAME<\/p>\n<p>fsck &#8211; check and repair a Linux filesystem<\/p>\n<p>SYNOPSIS<\/p>\n<p>fsck [-lrsAVRTMNP] [-C [fd]] [-t fstype] [filesystem&#8230;] [&#8211;] [fs-<br \/>\nspecific-options]<\/p>\n<p>DESCRIPTION<\/p>\n<p>fsck is used to check and optionally repair one or more Linux<br \/>\nfilesystems.\u00a0 filesys can be a device name (e.g.\u00a0 \/dev\/hdc1,<br \/>\n\/dev\/sdb2), a mount point (e.g.\u00a0 \/, \/usr, \/home), or an ext2 label or<br \/>\nUUID specifier (e.g.\u00a0 UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd or<br \/>\nLABEL=root).\u00a0 Normally, the fsck program will try to handle<br \/>\nfilesystems on different physical disk drives in parallel to reduce<br \/>\nthe total amount of time needed to check all of them.<\/p>\n<p>If no filesystems are specified on the command line, and the -A<br \/>\noption is not specified, fsck will default to checking filesystems in<br \/>\n\/etc\/fstab serially.\u00a0 This is equivalent to the -As options.<\/p>\n<p>The exit code returned by fsck is the sum of the following<br \/>\nconditions:<\/p>\n<p>0\u00a0\u00a0\u00a0\u00a0\u00a0 No errors<br \/>\n1\u00a0\u00a0\u00a0\u00a0\u00a0 Filesystem errors corrected<br \/>\n2\u00a0\u00a0\u00a0\u00a0\u00a0 System should be rebooted<br \/>\n4\u00a0\u00a0\u00a0\u00a0\u00a0 Filesystem errors left uncorrected<br \/>\n8\u00a0\u00a0\u00a0\u00a0\u00a0 Operational error<br \/>\n16\u00a0\u00a0\u00a0\u00a0 Usage or syntax error<br \/>\n32\u00a0\u00a0\u00a0\u00a0 Checking canceled by user request<br \/>\n128\u00a0\u00a0\u00a0 Shared-library error<\/p>\n<p>The exit code returned when multiple filesystems are checked is the<br \/>\nbit-wise OR of the exit codes for each filesystem that is checked.<\/p>\n<p>In actuality, fsck is simply a front-end for the various filesystem<br \/>\ncheckers (fsck.fstype) available under Linux.\u00a0 The filesystem-<br \/>\nspecific checker is searched for in \/sbin first, then in \/etc\/fs and<br \/>\n\/etc, and finally in the directories listed in the PATH environment<br \/>\nvariable.\u00a0 Please see the filesystem-specific checker manual pages<br \/>\nfor further details.<\/p>\n<p>OPTIONS<\/p>\n<p>-l\u00a0\u00a0\u00a0\u00a0 Create an exclusive flock(2) lock file<br \/>\n(\/run\/fsck\/&lt;diskname&gt;.lock) for whole-disk device.\u00a0 This<br \/>\noption can be used with one device only (this means that -A<br \/>\nand -l are mutually exclusive).\u00a0 This option is recommended<br \/>\nwhen more fsck(8) instances are executed in the same time.<br \/>\nThe option is ignored when used for multiple devices or for<br \/>\nnon-rotating disks.\u00a0 fsck does not lock underlying devices<br \/>\nwhen executed to check stacked devices (e.g. MD or DM) \u2013 this<br \/>\nfeature is not implemented yet.<\/p>\n<p>-r\u00a0\u00a0\u00a0\u00a0 Report certain statistics for each fsck when it completes.<br \/>\nThese statistics include the exit status, the maximum run set<br \/>\nsize (in kilobytes), the elapsed all-clock time and the user<br \/>\nand system CPU time used by the fsck run.\u00a0 For example:<\/p>\n<p>\/dev\/sda1: status 0, rss 92828, real 4.002804, user 2.677592,<br \/>\nsys 0.86186<\/p>\n<p>-s\u00a0\u00a0\u00a0\u00a0 Serialize fsck operations.\u00a0 This is a good idea if you are<br \/>\nchecking multiple filesystems and the checkers are in an<br \/>\ninteractive mode.\u00a0 (Note: e2fsck(8) runs in an interactive<br \/>\nmode by default.\u00a0 To make e2fsck(8) run in a non-interactive<br \/>\nmode, you must either specify the -p or -a option, if you wish<br \/>\nfor errors to be corrected automatically, or the -n option if<br \/>\nyou do not.)<\/p>\n<p>-t fslist<br \/>\nSpecifies the type(s) of filesystem to be checked.\u00a0 When the<br \/>\n-A flag is specified, only filesystems that match fslist are<br \/>\nchecked.\u00a0 The fslist parameter is a comma-separated list of<br \/>\nfilesystems and options specifiers.\u00a0 All of the filesystems in<br \/>\nthis comma-separated list may be prefixed by a negation<br \/>\noperator &#8216;no&#8217; or &#8216;!&#8217;, which requests that only those<br \/>\nfilesystems not listed in fslist will be checked.\u00a0 If none of<br \/>\nthe filesystems in fslist is prefixed by a negation operator,<br \/>\nthen only those listed filesystems will be checked.<\/p>\n<p>Options specifiers may be included in the comma-separated<br \/>\nfslist.\u00a0 They must have the format opts=fs-option.\u00a0 If an<br \/>\noptions specifier is present, then only filesystems which<br \/>\ncontain fs-option in their mount options field of \/etc\/fstab<br \/>\nwill be checked.\u00a0 If the options specifier is prefixed by a<br \/>\nnegation operator, then only those filesystems that do not<br \/>\nhave fs-option in their mount options field of \/etc\/fstab will<br \/>\nbe checked.<\/p>\n<p>For example, if opts=ro appears in fslist, then only<br \/>\nfilesystems listed in \/etc\/fstab with the ro option will be<br \/>\nchecked.<\/p>\n<p>For compatibility with Mandrake distributions whose boot<br \/>\nscripts depend upon an unauthorized UI change to the fsck<br \/>\nprogram, if a filesystem type of loop is found in fslist, it<br \/>\nis treated as if opts=loop were specified as an argument to<br \/>\nthe -t option.<\/p>\n<p>Normally, the filesystem type is deduced by searching for<br \/>\nfilesys in the \/etc\/fstab file and using the corresponding<br \/>\nentry.\u00a0 If the type can not be deduced, and there is only a<br \/>\nsingle filesystem given as an argument to the -t option, fsck<br \/>\nwill use the specified filesystem type.\u00a0 If this type is not<br \/>\navailable, then the default filesystem type (currently ext2)<br \/>\nis used.<\/p>\n<p>-A\u00a0\u00a0\u00a0\u00a0 Walk through the \/etc\/fstab file and try to check all<br \/>\nfilesystems in one run.\u00a0 This option is typically used from<br \/>\nthe \/etc\/rc system initialization file, instead of multiple<br \/>\ncommands for checking a single filesystem.<\/p>\n<p>The root filesystem will be checked first unless the -P option<br \/>\nis specified (see below).\u00a0 After that, filesystems will be<br \/>\nchecked in the order specified by the fs_passno (the sixth)<br \/>\nfield in the \/etc\/fstab file.\u00a0 Filesystems with a fs_passno<br \/>\nvalue of 0 are skipped and are not checked at all.<br \/>\nFilesystems with a fs_passno value of greater than zero will<br \/>\nbe checked in order, with filesystems with the lowest<br \/>\nfs_passno number being checked first.\u00a0 If there are multiple<br \/>\nfilesystems with the same pass number, fsck will attempt to<br \/>\ncheck them in parallel, although it will avoid running<br \/>\nmultiple filesystem checks on the same physical disk.<\/p>\n<p>fsck does not check stacked devices (RAIDs, dm-crypt, &#8230;) in<br \/>\nparallel with any other device.\u00a0 See below for<br \/>\nFSCK_FORCE_ALL_PARALLEL setting.\u00a0 The \/sys filesystem is used<br \/>\nto detemine dependencies between devices.<\/p>\n<p>Hence, a very common configuration in \/etc\/fstab files is to<br \/>\nset the root filesystem to have a fs_passno value of 1 and to<br \/>\nset all other filesystems to have a fs_passno value of 2.<br \/>\nThis will allow fsck to automatically run filesystem checkers<br \/>\nin parallel if it is advantageous to do so.\u00a0 System<br \/>\nadministrators might choose not to use this configuration if<br \/>\nthey need to avoid multiple filesystem checks running in<br \/>\nparallel for some reason \u2013 for example, if the machine in<br \/>\nquestion is short on memory so that excessive paging is a<br \/>\nconcern.<\/p>\n<p>fsck normally does not check whether the device actually<br \/>\nexists before calling a filesystem specific checker.<br \/>\nTherefore non-existing devices may cause the system to enter<br \/>\nfilesystem repair mode during boot if the filesystem specific<br \/>\nchecker returns a fatal error.\u00a0 The \/etc\/fstab mount option<br \/>\nnofail may be used to have fsck skip non-existing devices.<br \/>\nfsck also skips non-existing devices that have the special<br \/>\nfilesystem type auto.<\/p>\n<p>-C [fd]<br \/>\nDisplay completion\/progress bars for those filesystem checkers<br \/>\n(currently only for ext[234]) which support them.\u00a0 fsck will<br \/>\nmanage the filesystem checkers so that only one of them will<br \/>\ndisplay a progress bar at a time.\u00a0 GUI front-ends may specify<br \/>\na file descriptor fd, in which case the progress bar<br \/>\ninformation will be sent to that file descriptor.<\/p>\n<p>-M\u00a0\u00a0\u00a0\u00a0 Do not check mounted filesystems and return an exit code of 0<br \/>\nfor mounted filesystems.<\/p>\n<p>-N\u00a0\u00a0\u00a0\u00a0 Don&#8217;t execute, just show what would be done.<\/p>\n<p>-P\u00a0\u00a0\u00a0\u00a0 When the -A flag is set, check the root filesystem in parallel<br \/>\nwith the other filesystems.\u00a0 This is not the safest thing in<br \/>\nthe world to do, since if the root filesystem is in doubt<br \/>\nthings like the e2fsck(8) executable might be corrupted!\u00a0 This<br \/>\noption is mainly provided for those sysadmins who don&#8217;t want<br \/>\nto repartition the root filesystem to be small and compact<br \/>\n(which is really the right solution).<\/p>\n<p>-R\u00a0\u00a0\u00a0\u00a0 When checking all filesystems with the -A flag, skip the root<br \/>\nfilesystem.\u00a0 (This is useful in case the root filesystem has<br \/>\nalready been mounted read-write.)<\/p>\n<p>-T\u00a0\u00a0\u00a0\u00a0 Don&#8217;t show the title on startup.<\/p>\n<p>-V\u00a0\u00a0\u00a0\u00a0 Produce verbose output, including all filesystem-specific<br \/>\ncommands that are executed.<\/p>\n<p>fs-specific-options<br \/>\nOptions which are not understood by fsck are passed to the<br \/>\nfilesystem-specific checker.\u00a0 These options must not take<br \/>\narguments, as there is no way for fsck to be able to properly<br \/>\nguess which options take arguments and which don&#8217;t.<\/p>\n<p>Options and arguments which follow the &#8212; are treated as<br \/>\nfilesystem-specific options to be passed to the filesystem-<br \/>\nspecific checker.<\/p>\n<p>Please note that fsck is not designed to pass arbitrarily<br \/>\ncomplicated options to filesystem-specific checkers.\u00a0 If<br \/>\nyou&#8217;re doing something complicated, please just execute the<br \/>\nfilesystem-specific checker directly.\u00a0 If you pass fsck some<br \/>\nhorribly complicated options and arguments, and it doesn&#8217;t do<br \/>\nwhat you expect, don&#8217;t bother reporting it as a bug.\u00a0 You&#8217;re<br \/>\nalmost certainly doing something that you shouldn&#8217;t be doing<br \/>\nwith fsck.<\/p>\n<p>Options to different filesystem-specific fsck&#8217;s are not standardized.<br \/>\nIf in doubt, please consult the man pages of the filesystem-specific<br \/>\nchecker.\u00a0 Although not guaranteed, the following options are<br \/>\nsupported by most filesystem checkers:<\/p>\n<p>-a\u00a0\u00a0\u00a0\u00a0 Automatically repair the filesystem without any questions (use<br \/>\nthis option with caution).\u00a0 Note that e2fsck(8) supports -a<br \/>\nfor backward compatibility only.\u00a0 This option is mapped to<br \/>\ne2fsck&#8217;s -p option which is safe to use, unlike the -a option<br \/>\nthat some filesystem checkers support.<\/p>\n<p>-n\u00a0\u00a0\u00a0\u00a0 For some filesystem-specific checkers, the -n option will<br \/>\ncause the fs-specific fsck to avoid attempting to repair any<br \/>\nproblems, but simply report such problems to stdout.\u00a0 This is<br \/>\nhowever not true for all filesystem-specific checkers.\u00a0 In<br \/>\nparticular, fsck.reiserfs(8) will not report any corruption if<br \/>\ngiven this option.\u00a0 fsck.minix(8) does not support the -n<br \/>\noption at all.<\/p>\n<p>-r\u00a0\u00a0\u00a0\u00a0 Interactively repair the filesystem (ask for confirmations).<br \/>\nNote: It is generally a bad idea to use this option if<br \/>\nmultiple fsck&#8217;s are being run in parallel.\u00a0 Also note that<br \/>\nthis is e2fsck&#8217;s default behavior; it supports this option for<br \/>\nbackward compatibility reasons only.<\/p>\n<p>-y\u00a0\u00a0\u00a0\u00a0 For some filesystem-specific checkers, the -y option will<br \/>\ncause the fs-specific fsck to always attempt to fix any<br \/>\ndetected filesystem corruption automatically.\u00a0 Sometimes an<br \/>\nexpert may be able to do better driving the fsck manually.<br \/>\nNote that not all filesystem-specific checkers implement this<br \/>\noption.\u00a0 In particular fsck.minix(8) and fsck.cramfs(8) do not<br \/>\nsupport the -y option as of this writing.<\/p>\n<p>FILES<\/p>\n<p>\/etc\/fstab.<\/p>\n<p>ENVIRONMENT VARIABLES<\/p>\n<p>The fsck program&#8217;s behavior is affected by the following environment<br \/>\nvariables:<\/p>\n<p>FSCK_FORCE_ALL_PARALLEL<br \/>\nIf this environment variable is set, fsck will attempt to<br \/>\ncheck all of the specified filesystems in parallel, regardless<br \/>\nof whether the filesystems appear to be on the same device.<br \/>\n(This is useful for RAID systems or high-end storage systems<br \/>\nsuch as those sold by companies such as IBM or EMC.)\u00a0 Note<br \/>\nthat the fs_passno value is still used.<\/p>\n<p>FSCK_MAX_INST<br \/>\nThis environment variable will limit the maximum number of<br \/>\nfilesystem checkers that can be running at one time.\u00a0 This<br \/>\nallows configurations which have a large number of disks to<br \/>\navoid fsck starting too many filesystem checkers at once,<br \/>\nwhich might overload CPU and memory resources available on the<br \/>\nsystem.\u00a0 If this value is zero, then an unlimited number of<br \/>\nprocesses can be spawned.\u00a0 This is currently the default, but<br \/>\nfuture versions of fsck may attempt to automatically determine<br \/>\nhow many filesystem checks can be run based on gathering<br \/>\naccounting data from the operating system.<\/p>\n<p>PATH\u00a0\u00a0 The PATH environment variable is used to find filesystem<br \/>\ncheckers.\u00a0 A set of system directories are searched first:<br \/>\n\/sbin, \/sbin\/fs.d, \/sbin\/fs, \/etc\/fs, and \/etc.\u00a0 Then the set<br \/>\nof directories found in the PATH environment are searched.<\/p>\n<p>FSTAB_FILE<br \/>\nThis environment variable allows the system administrator to<br \/>\noverride the standard location of the \/etc\/fstab file.\u00a0 It is<br \/>\nalso useful for developers who are testing fsck.<\/p>\n<p>LIBBLKID_DEBUG=all<br \/>\nenables libblkid debug output.<\/p>\n<p>LIBMOUNT_DEBUG=all<br \/>\nenables libmount debug output.<\/p>\n<p>SEE ALSO<\/p>\n<p>fstab(5), mkfs(8), fsck.ext2(8) or fsck.ext3(8) or e2fsck(8),<br \/>\ncramfsck(8), fsck.minix(8), fsck.msdos(8), fsck.jfs(8), fsck.nfs(8),<br \/>\nfsck.vfat(8), fsck.xfs(8), reiserfsck(8).<\/p>\n<p>AUTHOR<\/p>\n<p>Theodore Ts&#8217;o \u27e8tytso@mit.edu\u27e9<\/p>\n<p>AVAILABILITY<\/p>\n<p>The fsck command is part of the util-linux package and is available<br \/>\nfrom Linux Kernel Archive<br \/>\n\u27e8ftp:\/\/ftp.kernel.org\/pub\/linux\/utils\/util-linux\/\u27e9.<\/p>\n<p>COLOPHON<\/p>\n<p>This page is part of the util-linux (a random collection of Linux<br \/>\nutilities) project.\u00a0 Information about the project can be found at<br \/>\n\u27e8https:\/\/www.kernel.org\/pub\/linux\/utils\/util-linux\/\u27e9.\u00a0 If you have a<br \/>\nbug report for this manual page, send it to<br \/>\nutil-linux@vger.kernel.org.\u00a0 This page was obtained from the<br \/>\nproject&#8217;s upstream Git repository<br \/>\n(git:\/\/git.kernel.org\/pub\/scm\/utils\/util-linux\/util-linux.git) on<br \/>\n2014-12-30.\u00a0 If you discover any rendering problems in this HTML ver\u2010<br \/>\nsion of the page, or you believe there is a better or more up-to-date<br \/>\nsource for the page, or you have corrections or improvements to the<br \/>\ninformation in this COLOPHON (which is not part of the original man\u2010<br \/>\nual page), send a mail to\u00a0man-pages@man7.org<\/p>\n<p>util-linux\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 February 2009\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 FSCK(8)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>FSCK(8)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 System Administration\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 FSCK(8) NAME fsck &#8211; check and repair a Linux filesystem SYNOPSIS fsck [-lrsAVRTMNP] [-C [fd]] [-t fstype] [filesystem&#8230;] [&#8211;] [fs- specific-options] DESCRIPTION fsck is used to check and optionally repair one or more Linux filesystems.\u00a0 filesys can be a device name (e.g.\u00a0 \/dev\/hdc1, \/dev\/sdb2), a mount point (e.g.\u00a0 \/, \/usr, \/home), or [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_sitemap_exclude":false,"_sitemap_priority":"","_sitemap_frequency":"","footnotes":""},"categories":[8],"tags":[],"class_list":["post-318","post","type-post","status-publish","format-standard","hentry","category-shell"],"a3_pvc":{"activated":false,"total_views":0,"today_views":0},"_links":{"self":[{"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/posts\/318","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=318"}],"version-history":[{"count":0,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/posts\/318\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=318"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=318"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=318"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}