Tune2fs and fsck usage

Source: Internet
Author: User

Tune2fs -- a tool used to adjust the ext2/ext3 file system features.
-L <device> View File System Information
-C <count> sets the number of mounting times for force self-check.
-I <nday> sets the time interval for force self-check.
-M <percentage> Percentage of reserved Blocks
-J: Convert the ext2 file system to an ext3 File System

The ext2 file system does not have the log function. By converting the ext3 File System to the ext3 type, the log function can be added to the server. For old servers that have been used for a long time, this function is very useful. It can prevent power outages, abnormal shutdown, data loss, or long-term self-check.

# Tune2fs-L/dev/sdb1
# Mount/dev/sdb1/mnt/d1
# Tune2fs-L/dev/sdb1
View Mount count mounting times
Maximum Mount count. After the maximum number of mounting times is reached, the system will force self-check upon re-boot.

Use the tune2fs-C parameter to modify the number of forced self-check tasks
# Tune2fs-C 2/dev/sdb1
# Tune2fs-L/dev/sdb1 | grep-I "Mount count"
# Tune2fs-L/dev/sdb1 | grep-I "Mount count"
# Umount/mnt/d1
# Mount/dev/sdb1/mnt/d1
# Tune2fs-L/dev/sdb1 | grep-I "Mount count"
At this time, sdb1 has reached the maximum number of mounting times 2. At this point, if you restart the computer, the device will be forced to perform self-check.
# Umount/mnt/d1
# Mount/dev/sdb1/mnt/d1
# Tune2fs-L/dev/sdb1 | grep-I "Mount count"
# Tune2fs-C-1/dev/sdb1 # use a negative value to set a device never to perform self-check.

-I check interval system self-check interval
The default system self-check time is 6 months. If you do not want it to perform self-check. You can change it to 0 or-1. If you want to perform self-check once a day, you can change it to 2.
# Tune2fs-C-1-I-1/dev/sdb1

Tune2fs-L/dev/sdb1 | more (View File System Information)
Tune2fs-C 100/dev/hdb1 (for example, adjust the number of fully checked root file system loads every two times to 100 times)
Tune2fs-L/dev/sdb4 | more inode count (number of loads)
# Tune2fs-r 60/dev/sdb1 (retain 60 blocks for system space use)
Tune2fs-I 5 W/dev/sdb1 (adjust the interval of 5 weeks for every 2 full checks of the root file system)
Tune2fs-L/dev/sdb1 check the reserced block count (P This is the reserved space)
Tune2fs-L <device>/dev. sdb4 | grep Reserved
Tune2fs-O (View File System Information)-C <count> (set the number of mounting requests for force self-check)-I <n day> (set the interval of force self-check) -M <percentage> Percentage of reserved blocks-J converts the ext2 File System to the ext3 format
Tune2fs-L/dev/sdb1 maximum Mount count Mount times tune2fs-C 2/dev/sdb1 tune2fs-L/dev/sdb1 | grep-I "Mount count"
Tune2fs-C-1/dev/sdb1 (self-check is not allowed if it is a negative number)
Tune2fs-I 0/dev/sdb1
Tune2fs-L/dev/sdb4 | grep-I "reserced"
Tune2fs-M 10/dev/sdb4 (changed to 110%)
Mkfs. ext2/dev/sdb4 Mount/dev/sdbv4/mnt
CP/etc/service/mnt
Tune2fs-J/dev/sdb4 umount/dev/sdb4 Mount/dev/mnt
DF-H: Check that ext2 can be converted to ext3, but cannot be converted back, and data is lost.
Tune2fs-L/dev/sdb4 | more in the file system filesystem features: has_journal (with logs) filetype sparse_super can be compared. ext2
If you need to perform self-check, you can use manual self-check. Fsck tool.

> Center <File System Check Tool

Fsck-a tool used to check the data integrity of the file system.
Usage 1: fsck-T ext2/dev/sdb1
Usage 2: fsck. ext2/dev/sdb1
E2fsck: tool for checking the ext2/ext3 File System
(Note: This e2fsck has many risks. Many people have reported that using this tool may cause damage to the file system. Especially when both ext2 and ext3 file systems are used. It will produce certain errors during automatic identification, so it is very dangerous. Do not use .)
Use the fsck tool later. Fsck has two usage methods, similar to mkfs. One is the type followed by fsck-t. Another type is the file system connected with. After fsck, followed by a device. It mainly checks whether there are errors in the file and whether there are error nodes with incomplete data. It automatically fixes errors in the file system.
<Note: Do not use the error parameter for fsck>
# Fsck. ext2/dev/sdb1
# Fsck. ext3/dev/sdb4
In the/etc/fstab file, either one or two of the last bits after the mount option are post-boot. Some devices do not perform self-check for a long time. The root partition is the first self-check, so it is marked as 1.
# DF
# Mkfs. ext2/dev/sdb1 format/dev/sdb1 using the ext2 File System
# Mkfs-T ext3/dev/sdb4
# Fsck-T ext3/dev/sdb1
# Fsck. ext3-y/dev/sdb4 automatically fixes file system errors on sdb4. -Y indicates yes.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.