LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   fsck and e2fsck (https://www.linuxquestions.org/questions/linux-general-1/fsck-and-e2fsck-479143/)

ygloo 08-31-2006 09:43 AM

fsck and e2fsck
 
i have 2 partitions - ext3 fs
rc.S - "fsck" to check on mount
"man mount" says to use "e2fsck"...
how are they different..
is it safe to switch "fsck" in rc.S to "e2fsck"?

ygloo 08-31-2006 09:55 AM

tune2fs 1.35 (28-Feb-2004)
Filesystem volume name: <none>
Last mounted on: <not available>
Filesystem UUID: fc82c874-90fe-11da-98f8-fa00051c2071
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal filetype needs_recovery sparse_super
Default mount options: (none)
Filesystem state: clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 1612512
Block count: 3223954
Reserved block count: 161197
Free blocks: 2978623
Free inodes: 1610411
First block: 0
Block size: 4096
Fragment size: 4096
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 16288
Inode blocks per group: 509
Last mount time: Thu Aug 31 18:02:05 2006
Last write time: Thu Aug 31 18:02:05 2006
Mount count: 23
Maximum mount count: 39
Last checked: Wed Aug 23 16:44:42 2006
Check interval: 15552000 (6 months)
Next check after: Mon Feb 19 15:44:42 2007

Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 128
Journal inode: 8
Journal backup: inode blocks

are mount count and check interval connected?

ygloo 08-31-2006 09:58 AM

df -
Filesystem Type Size Used Avail Use% Mounted on
/dev/hda1 ext3 5.8G 1.4G 4.1G 26% /
/dev/hda6 ext3 13G 760M 11G 7% /home
none tmpfs 189M 0 189M 0% /dev/shm
# mount -
/dev/hda1 on / type ext3 (rw,noatime)
/dev/hda6 on /home type ext3 (rw,nosuid,nodev,noatime)
none on /dev/pts type devpts (rw,gid=5,mode=666)
none on /dev/shm type tmpfs (rw)
usbfs on /proc/bus/usb type usbfs (rw)

fdisk - hda1 -ext2 !?

haertig 08-31-2006 12:56 PM

Quote:

Originally Posted by ygloo
is it safe to switch "fsck" in rc.S to "e2fsck"?

Yep, provided you're using it to check and EXT2 or EXT3 filesystem. If you use e2fsck on some other filesystem type, e.g., XFS, it will report lots of errors and (probably) tell you that it doesn't think it's target filesystem is really an EXT2/EXT3 one. But you can then force it to go ahead and try to fix things anyway, which would surely be a disaster as it tries to turn an XFS filesystem into and EXT2 one!

fsck is just a frontend that calls a filesystem-specific version. So if you run fsck on an EXT2 filesystem, it will actually call fsck.ext2 (or e2fsck - same thing). Note that there is really no specific fsck for EXT3. It just uses the EXT2 version (because EXT3 is nothing more than EXT2 with an added journal - journals don't matter when fsck-ing).

You can see the filesystem-specific versions of fsck like this:
Code:

$ ls -l /sbin/*fsck*
-rwxr-xr-x  1 root root  45036 2005-04-03 05:59 /sbin/dosfsck
-rwxr-xr-x  3 root root 138348 2005-05-26 18:22 /sbin/e2fsck
-rwxr-xr-x  1 root root  18136 2005-05-26 18:22 /sbin/fsck
-rwxr-xr-x  1 root root  10616 2005-09-18 01:04 /sbin/fsck.cramfs
-rwxr-xr-x  3 root root 138348 2005-05-26 18:22 /sbin/fsck.ext2
-rwxr-xr-x  3 root root 138348 2005-05-26 18:22 /sbin/fsck.ext3
-rwxr-xr-x  1 root root  22072 2005-09-18 01:04 /sbin/fsck.minix
lrwxrwxrwx  1 root root      7 2005-10-21 10:50 /sbin/fsck.msdos -> dosfsck
-rwxr-xr-x  1 root root    413 2005-01-04 15:43 /sbin/fsck.nfs
lrwxrwxrwx  1 root root      7 2005-10-21 10:50 /sbin/fsck.vfat -> dosfsck
$


ygloo 08-31-2006 01:14 PM

10x, great
i don't get it why fdisk shows hda1 -ext2??

i think i formatted it as ext2 before intall OS...

haertig 08-31-2006 01:33 PM

Quote:

Originally Posted by ygloo
i don't get it why fdisk shows hda1 -ext2??

I don't see where you showed any fdisk output that indicates this.

fdisk output does not distinguish between EXT2 and EXT3 anyway. fdisk shows a "partition id", which is "83" for both EXT2 and EXT3 filesystems (and maybe some others as well). An ID of "82" indicates a swap partition. NTFS is "7" and FAT is "B". Note: partition id number's do not have to accurately match what's really out there. You can scramble these up if you want to, although there's usually no good reason to do that, and many bad reasons. Here's a list of various partition id numbers: http://www.win.tue.nl/~aeb/partition...n_types-1.html See my example fdisk output below:
Code:

$ sudo fdisk -l

Disk /dev/hda: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/hda1              1          34      273073+  b  W95 FAT32
/dev/hda2              35        799    6144862+  7  HPFS/NTFS
/dev/hda3            2272      24321  177116625    f  W95 Ext'd (LBA)
/dev/hda5            2272      22939  166015678+  8e  Linux LVM
/dev/hda6          22940      24214    10241406  8e  Linux LVM
/dev/hda7          24215      24278      514048+  82  Linux swap / Solaris
/dev/hda8          24279      24317      313236  83  Linux
/dev/hda9  *      24318      24321      32098+  83  Linux

Disk /dev/hdb: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/hdb1              1        6080    48837568+  5  Extended
/dev/hdb5              1        1216    9767457  8e  Linux LVM
/dev/hdb6            1217        2432    9767488+  8e  Linux LVM
/dev/hdb7            2433        3648    9767488+  8e  Linux LVM
/dev/hdb8            3649        4864    9767488+  8e  Linux LVM
/dev/hdb9            4865        6080    9767488+  83  Linux
$


ygloo 08-31-2006 01:46 PM

[HTML]
fdisk -l

Disk /dev/hda: 20.0 GB, 20020396032 bytes
16 heads, 63 sectors/track, 38792 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 12190 6143728+ 83 Linux
/dev/hda2 12191 38792 13407408 5 Extended
/dev/hda5 12191 13205 511528+ 82 Linux swap
/dev/hda6 13206 38792 12895816+ 83 Linux[/HTML]

haertig 08-31-2006 02:06 PM

Your fdisk output shows hda1 as type "83". Which includes EXT2, EXT3, Reister, etc. Here's a quote from that link I provided above regarding partition id's:

Quote:

83 Linux native partition
...
Various filesystem types like xiafs, ext2, ext3, reiserfs, etc. all use ID 83. Some systems mistakenly assume that 83 must mean ext2.

ygloo 08-31-2006 02:19 PM

[HTML]cfdisk -

Disk Drive: /dev/hda
Size: 20020396032 bytes, 20.0 GB
Heads: 16 Sectors per Track: 63 Cylinders: 38792

Name Flags Part Type FS Type [Label] Size (MB)
----------------------------------------------------------------------------------------------------------------------------------
hda1 Boot Primary Linux ext2 6291.22
hda5 Logical Linux swap 523.84
hda6 Logical Linux ext3 13205.35

















































[Bootable] [ Delete ] [ Help ] [Maximize] [ Print ] [ Quit ] [ Type ] [ Units ] [ Write ]


Toggle bootable flag of the current partition[/HTML]


All times are GMT -5. The time now is 08:25 AM.