Results 1 to 8 of 8

Thread: checking disk for errors

  1. #1

    Default checking disk for errors

    Hi,
    Ubuntu has a default property that after several boot of a partition of hdd, it checks the partition for errors on boot time. Can I apply this to opensuse? How can I manually check my disk for errors? If the electricity went off, it might affect the hdd. Would it be affect the os? Thanks

  2. #2
    Join Date
    Jun 2008
    Location
    /dev/belgium
    Posts
    1,946

    Default Re: checking disk for errors

    There's a difference between a corrupted filesystem and actual physical damaged blocks on the disk itself. What Ubuntu does is check the filesystem itself which SUSE also does after a set period of time which can be controlled by the tune2fs program (assuming you're using Ext2/3 file system). Also if power goes off suddenly, Ext3 upon boot will replay its journal so you'll be safe (in most cases)

    from man tune2fs
    -i interval-between-checks[d|m|w]
    Adjust the maximal time between two filesystem checks. No postfix or d result in
    days, m in months, and w in weeks. A value of zero will disable the time-depen-
    dent checking.
    tune2fs -i 2m /dev/sdXX (replace XX accordingly - will set check interval for 2 months).

    To see the interval between checks: tune2fs -l /dev/sdXX (replace XX accordingly)
    and look for "Last Checked" and "Check Interval"

    if, on the other hand, you want to check the disk itself for physical problems, you can use as root the badblocks utility

    badblocks -b 4096 -n -s /dev/sdXX (change XX accordingly)

  3. #3

    Default Re: checking disk for errors

    Its good in any case, EXT is very good at surviving power outages, as is many Linux filesystems.
    This is because of most linux filesystems are journalized and from what I hear thats a very good thing.
    Now so far Ubuntu is the only one I know that does a disk check every 20 or so boots, the others not so much but meh its nothing to panic about.

    http://en.wikipedia.org/wiki/Journaling_file_system

  4. #4
    Chris Maaskant NNTP User

    Default Re: checking disk for errors

    TaraIkeda wrote:

    > Now so far Ubuntu is the only one I know that does a disk check every
    > 20 or so boots


    Opensuse checks after 60 bootups i believe..
    --
    Chris Maaskant

  5. #5

    Default Re: checking disk for errors

    I've been using reloaded (kde 4.2.3) version of opensuse 11.1, and when I get info with tune2fs, it hadn't showed any "check interval". So, I can say that opensuse has no default value for "check interval". After I set the interval to 15 day, I got this:

    Code:
    linux-fxl5:/home/baris # tune2fs -l /dev/sda7
    tune2fs 1.41.1 (01-Sep-2008)
    Filesystem volume name:   <none>
    Last mounted on:          <not available>
    Filesystem UUID:          873f94a5-4436-46ff-8b7b-8c01b38e03dc
    Filesystem magic number:  0xEF53
    Filesystem revision #:    1 (dynamic)
    Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery sparse_super large_file
    Filesystem flags:         signed_directory_hash
    Default mount options:    (none)
    Filesystem state:         clean
    Errors behavior:          Continue
    Filesystem OS type:       Linux
    Inode count:              14098432
    Block count:              56384125
    Reserved block count:     2819206
    Free blocks:              48966441
    Free inodes:              14083816
    First block:              0
    Block size:               4096
    Fragment size:            4096
    Reserved GDT blocks:      1010
    Blocks per group:         32768
    Fragments per group:      32768
    Inodes per group:         8192
    Inode blocks per group:   512
    Filesystem created:       Fri May 29 18:44:54 2009
    Last mount time:          Sun Jul  5 12:08:25 2009
    Last write time:          Sun Jul  5 13:19:12 2009
    Mount count:              169
    Maximum mount count:      -1
    Last checked:             Fri May 29 18:44:54 2009
    Check interval:           1296000 (2 weeks, 1 day)
    Next check after:         Sat Jun 13 18:44:54 2009
    Reserved blocks uid:      0 (user root)
    Reserved blocks gid:      0 (group root)
    First inode:              11
    Inode size:               256
    Required extra isize:     28
    Desired extra isize:      28
    Journal inode:            8
    Default directory hash:   half_md4
    Directory Hash Seed:      748ddf23-697a-4b29-801f-6cc078846a0c
    Journal backup:           inode blocks
    When I was using ubuntu, it doesn't allow you to cancel disk check in boot time, which is sometime quite disturbing if want a quick reboot. NTFS is also using journaling file system,but after a improper shutdown to the system, it always results bad situations for me. Are there any difference between the journaling system of EXT3 and NTFS?

    Regards,

  6. #6
    Join Date
    Jun 2008
    Location
    /dev/belgium
    Posts
    1,946

    Default Re: checking disk for errors

    That's very strange that suse doesn't set a check interval. IIRC, check interval is not controlled by suse itself but by mkfs.ext3 which automatically sets it for 2 months and I don't think suse disables this as it will be very stupid to do so. Are you sure you have created your partition with SUSE? Because if you have, the check interval will always be set as I've never experienced partitions created by SUSE to not have a check interval.

    Yes, there are differences between journaling NTFS and Ext3. The check interval in Ext3 is there to ensure proper filesystem consistency. In case there's a kernel bug, a bad disk cable or something else which can *silently* corrupt the filesystem, the check interval ensures consistency after ext3 runs a check. IIRC, NTFS does not have such a feature (auto check interval) and only replays its journal after a power failure / unclean shutdown, but this alone will not catch possible kernel bugs/cable problems which may corrupt the filesystem. Checks are *not* meant to be interrupted as it can bring problems. I, for one, have completely disabled check intervals on my ext3 partitions and never had any problems in doing so. Ext3 has a robust enough journaling technology (though not perfect)

    Further, NTFS uses meta-data only logical journaling whereas Ext3 uses ordered meta-data physical journaling which can be much more robust in specific cases (but also slower, mostly due to the physical journaling which overwrites a whole block instead of only commiting the changes to that block as done by logical journaling). However, latest version of NTFS has added transactional atomic support which ensures that in specific cases, if a transaction does not finish due to interruption like a power failure, it won't show up on next boot (rollback). If a transaction finishes (success) and then a power failure occurs, it most certainly will show up on next boot

  7. #7
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: checking disk for errors

    Quote Originally Posted by microchip8 View Post
    That's very strange that suse doesn't set a check interval. IIRC, check interval is not controlled by suse itself but by mkfs.ext3 which automatically sets it for 2 months and I don't think suse disables this as it will be very stupid to do so. Are you sure you have created your partition with SUSE? Because if you have, the check interval will always be set as I've never experienced partitions created by SUSE to not have a check interval.
    I didn't think so too, but I just looked at a 11.1 EXT3 superblock with tune2fs -l, and this is part of the result.

    Maximum mount count: -1
    ...
    Check interval: 0 (<none>)
    There are two types of check counters in EXT3, a max mount count and a check interval. Both can be enabled or disabled separately.

    However I do know that openSUSE does check from time to time and I don't know at the moment how or where it forces that check. Maybe someone with time to kill can look through the startup scripts and work it out.

  8. #8

    Default Re: checking disk for errors

    Quote Originally Posted by microchip8 View Post
    That's very strange that suse doesn't set a check interval. IIRC, check interval is not controlled by suse itself but by mkfs.ext3 which automatically sets it for 2 months and I don't think suse disables this as it will be very stupid to do so.
    Actually, there was no line as "Check interval" and "Next check after", before I set the check intervals to 15 days. It might be that tune2fs -l didn't show the default values for them as well, if you say that check interval is 2 months.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •