"Turn" Linux tune2fs command

Source: Internet
Author: User
Tags uuid

Transferred from: http://czmmiao.iteye.com/blog/1749232

TUNE2FS Introduction
TUNE2FS is to adjust and view the file system parameters of Ext2/ext3 file system, under Windows if there is an unexpected power outage, the next boot will generally appear system self-test. The Linux system also has a file system self-test, and it is possible to define self-test cycles and methods by TUNE2FS commands.
tune2fs usage
TUNE2FS [-L] [-c max-mount-counts] [-e Errors-behavior] [-f] [-I interval-between-checks] [-j] [-j journal-op tions] [-M
Reserved-blocks-percentage] [-O [^]mount-options[,...]] [-R Reserved-blocks-count] [-S Sparse-super-flag] [-u user] [-G
Group] [-C Mount-count] [-l volume-name] [-M last-mounted-directory] [-O [^]feature[,...]] [-T time-last-checked] [-U
UUID] Device
Common Options Description:
-L: View File System Information
-c:max-mount-counts: Set the number of mounts to force self-test, if on, Mount Conut will be added 1 per mount, and will force self-test
-c:mount-count: Sets the number of times the file system mounts, if the-C option is specified for a file system at the same time, and the value of the-c parameter is greater than-C, the self-test will be enforced on the next startup
-I:INTERVAL-BETWEEN-CHECKS[D|M|W] Set the time interval for force self-test [D days M W Week]
-m:reserved-blocks-percentage percent of reserved blocks
-J: Convert ext2 file system to ext3 type file system, Ext2 can go ext3 but can not turn back, data loss is reversed
-l:volume-label similar to the E2label function, can modify the file system label
-r:reserved-blocks-count Adjusting System Reserve space
-o:[^]mount-option[,...] Set or clear the indicated default mount options in the filesystem. Set or clear the default mounted file system options
-I: Set the number of self-test days
-M: Set the reserved space
-U: To set the UUID you can use the command "tune2fs-u UUID device profile, (to display the UUID of each storage device, you can use the command
-e:error_behavior
The following list shows the behavior after 3 errors are found:
Continue: Continue to perform the test
Remount-ro: Re-hooking with read-only mode
Panic: Generating a system crash (panic)
Note: By default, if the system detects a file system error, the file system is set to perform fsck detection at the next boot. The-C and-c parameters can be used to set the file system to force the execution of fsck at the next reboot. The-I and-c parameters can also be set on a file system at the same time. Note that file system checks are performed if a file system has reached a condition of max_mount_counts or check_interval.

Introduction to the output of tune2fs-l

Tune2fs-l/DEV/RAM3

File system volume name (Filesystem volume name): is the file System label (Filesystem label), used as a brief description of the purpose of the file system or its stored data. At present, Gnu/linux will use USB finger/ieee1394 hard disk and other Removable storage device file system label as its mount directory name, user-friendly identification. and individual gnu/linux distribution such as Fedora, RHEL and CentOS are also in the fstab to replace the traditional device file name (i.e./dev/sda1 and/DEV/HDC5, etc.) designated to mount the file system, to avoid accidental because B Confusion caused by changes in IOS settings or insertion order. You can use the command E2label or tune2fs-l to change.
Last mount on mounted ': The last mount point path of the file system mounted, this column is generally empty and seldom used. You can use the command tune2fs-m settings.
File system uuid (Filesystem UUID): A general number generated by the chaos of the identification code, can be used to identify the file system. Individual gnu/linux distribution such as Ubuntu] are also in the fstab to replace the traditional device file name (i.e./dev/sda1 and/DEV/HDC5, etc.) to mount the file system, to avoid accidental because of the BIOS setting or insertion order changes and caused the confusion. You can use the command tune2fs-u to change.
(Filesystem magic number): Used to identify this file system for the EXT2/EXT3/EXT3 signature, location in the file system 0x0438-0x0439 (Superblock 0x38-0x39), now must be 0xef53.
File system version number (Filesystem revision #)-File System micro-version number, can only be used when formatting the mke2fs-r settings. Now only support [1]:
0-Original format, Linux 1.2 or previously only supported in this format [2]
1 (dymanic)-V2 format supports dynamic inode size (this version is now generally used)
File system function (Filesystem Features): Open the file system function, you can use the tune2fs-o change. You can now have the following features:
Has_journal-There is a log (journal), also on behalf of this file system must be EXT3 or EXT4
EXT_ATTR-Support Extended attribute
RESIZE_INODE-RESIZE2FS can increase the size of the file system
Dir_index-supports directory indexing to speed up searches of files in large directories.
FileType-Catalog Item no record file type
NEEDS_RECOVERY-E2FSCK Check the Ext3/ext4 file system to determine whether it is necessary to complete the unfinished work in the log record, quickly and automatically repair the file system
Extent-Supports EXT4 extent function to speed up file system performance and reduce external fragmentation
Flex_bg
Sparse_super-Save space with only a few superblock backups, rather than having superblock backups for each chunk group.
Large_file-support for files larger than 2GiB
Huge_file
Uninit_bg
Dir_nlink
Extra_isize
File system banner (Filesystem flags): Signed_directory_hash
Default mount options: Mount the option for the missing capital of this file system
File system Status (Filesystem State): Can be clean (the file system has been successfully uninstalled), Not-clean (indicating that the file system is not uninstalled after being mounted as read-write mode) or erroneous (the file system was found to be problematic)
Error handling Scheme (Errors behavior): The file system when the problem of the processing scheme, can be continue (continue to function normally), Remount-ro (re-mount as read-only mode) or panic (instant off system). Can be changed using TUNE2FS-E.
Type of operating system (Filesystem OS type): Set up the operating system of the file system, can be linux/hurd/masix/freebsd/lites[1]
Number of Inode (inode count): The total number of inode in the file system, which is also the upper limit on the number of files that the entire file system may have
Number of blocks (block count): Number of total blocks in the file system
Number of reserved blocks (Reserved block count): Number of blocks reserved for the system administrator to work
Number of unused chunks (free blocks): Number of unused chunks
Number of unused inode (free inodes): Number of Inode not used
First block number: The number of chunks that superblock or the first block group begins. This value in the 1 KiB chunk size of the file system is 1, larger than 1 KiB chunk size of the file system is 0. (superblock/first block group usually starts at the filing system 0x0400 (1024)) [1]
Block size-Chunk size, can be 1024, 2048 or 4096 bytes (the Compaq Alpha system can use 8192-byte chunks)
Fragment Sizes (Fragment size): EXT2/EXT3/EXT4 does not actually support Fragment, so this value is generally the same as the chunk size
Number of reserved GDT blocks (Reserved GDT blocks)-the number of blocks reserved for online change of file system size. If this value is 0, it can only be uninstalled offline to change the file system size [3]
Block/Group (Blocks per group): Number of chunks per block group
fragments/Group (fragments per group): Number of fragment per block group, also used to calculate the size of block bitmap per block group
Inodes/Group (inodes per group): Number of inode per block group
Inode block/Group (Inode blocks per group): Number of Inode blocks per block group
(Flex block Group size): 16
File system setup time (Filesystem created): Time to format this file system
Last mount time: The time the file system was last mounted
Last write Time: time when the file system content was last changed
Mount Count: The number of times the file system was mounted since the last time the full file system was checked, and let fsck decide if another full file system check should be performed
Maximum Mounts (Maximum mount count): The number of times a file system can be mounted for another full check, and if mount Count is greater than this value, FSCK will perform another full file system check
Final check time (last checked): Time of last file system for complete inspection
Check the spacing (check interval): The maximum time interval that the file system should perform another full check
Next check-in time: The next time the file system should perform another full check
Reserved chunk User ID (Reserved blocks UID): 0 (User root)
Reserved Chunk group ID (Reserved blocks GID): 0 (Group Root)
First Inode: The first inode number that can be used to store normal file attributes, which must be one in the original format, and the V2 format can also change this value [1]
Inode size (inode size): Inode sizes, traditionally 128 bytes, new system uses 256 bytes of inode to make expansion more convenient
(Required extra isize): 28
(Desired extra isize): 28
Log inode (Journal inode): inode number for log files
Default directory hash algorithm (default directory hash): HALF_MD4
Directory hash seed (directory hash Seed): 17e9c71d-5a16-47ad-b478-7c6bc3178f1d
Log backup (Journal Backup): Inode blocks
Log size (Journal size): The size of the log file
using the example

Set the number of times a file system can mount before forcing a check

Tune2fs-c 30/dev/hda1

To turn off forced check mount count limit
Tune2fs-c-l/dev/hda1

10 days after inspection
Tune2fs-i 10/dev/hda1

1 days after inspection
Tune2fs-i 1d/dev/hda1

3 weeks after inspection
Tune2fs-i 3w/dev/hda1

Six months later check
Tune2fs-i 6m/dev/hda1

Disabling time checking
Tune2fs-i 0/dev/hda1
Add log function to convert ext2 to ext3 file system
Tune2fs-j/dev/hda1
Adjust the/DEV/HDA1 partition to a reserved space of 40,000 disk blocks
Tune2fs-r 40000/dev/hda1
Adjust the/DEV/HDA1 partition's reserved space to 10%
Tune2fs-m 10/dev/hda1

Set the/DEV/HDA1 mount option to enable POSIX Access Control lists and user-specified extended properties
Tune2fs-o acl,user_xattr/dev/hda1
Power-on cancel self-test
Tune2fs-l/DEV/SDB1 | Grep-e ' Maximum mount Count:|check interval '
Tune2fs-i 0-c 0/DEV/SDB1

Change the device to a specified UUID
Tune2fs-u 51f7e9a4-5154-4e29-a7a6-208417290b85/dev/sda1
The-u parameter if the random indicates that a new UUID is directly generated:
Tune2fs-u random/dev/sda1
The-u parameter, if the time representation, produces a new UUID directly at the current moment:
Tune2fs-u time/dev/sda1
The-u parameter clears the UUID of the file system if it is clear:
Tune2fs-u clear/dev/sda1

Reduced reserved space has expanded usage capacity

#tune2fs-L/dev/sdd12|grep-i ' reserved Block count '
Reserved Block count:7984
# df-th
Filesystem Type Size used Avail use% mounted on
/DEV/SDA1 ext3 289G 5.6G 268G 3%/
Tmpfs tmpfs 633M 0 633M 0%/dev/shm
/dev/sdd12 ext3 38M 4.5M 26M 15%/mnt
# tune2fs-m 1/dev/sdd12
TUNE2FS 1.39 (29-may-2006)
Setting reserved blocks percentage to 1% (399 blocks)
# df-th
Filesystem Type Size used Avail use% mounted on
/DEV/SDA1 ext3 289G 5.6G 268G 3%/
Tmpfs tmpfs 633M 0 633M 0%/dev/shm
/dev/sdd12 ext3 38M 4.5M 33M 13%/mnt

"Turn" Linux tune2fs command

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.