One day learn about Linux File System attribute modification operations

Source: Internet
Author: User

 

View File System attributes

Dumpe2fs displays the super block and blocks group information of the file system.

If no parameter is specified, all content is displayed.

-H: only list superblock data

 

Notes for frequently used superblock display content are as follows:

 

Filesystem volume name: <none ><== File System tag

Last mounted on:/<= mount point of the file system

Filesystem UUID: 8e4f6141-20f9-4f5a-aad4-bac0483720.2 <= code of this file system

 

Default mount options: user_xattr acl <= Default mount Option

 

Inode count: 960992 <= number of Inode

Block count: 3840000 <= number of blocks

Reserved block count: 192000 <= number of Reserved Blocks

Free blocks: 3093336 <= number of remaining parts

Free inodes: 855672 <= remaining Inode count

First block: 0

Block size: 4096 <= The Block size is 4 K

 

Mount count: 21 <= number of times the file system is mounted

Maximum mount count:-1 <= How many times does the file need to be mounted? FSCK. If it is a negative number or 0, it will never be self-checked.

 

Reserved blocks uid: 0 (user root) <= block Reserved for a user

Reserved blocks gid: 0 (group root) <= block Reserved for a group

First inode: 11

Inode size: 256 <= Inode size

 

 

All of the above are supberblock-related information. To view the Block Group-related information, run the dumpe2fs command without adding a parameter. Under supberblock, information about the Block Group starts with a Group.

Group *: <= all block group information.

 

 

 

View the UUID of the file system

Blkid

[Root @ yufei ~] # Blkid

/Dev/sda1: UUID = "744b208e-0951-40e1-a4ae-1ece29840ddb" TYPE = "ext4" LABEL = "/dev/sda1 ″

/Dev/sda2: UUID = "c70cd6a4-09cd-4aea-ba94-f3641df4e981" TYPE = "swap"

 

Ls-l/dev/disk/by-uuid/

[Root @ yufei ~] # Ls-l/dev/disk/by-uuid/

Total 0

Lrwxrwxrwx. 1 root 10 Apr 4 744b208e-0951-40e1-a4ae-1ece29840ddb->.../sda1

Lrwxrwxrwx. 1 root 10 Apr 4 c70cd6a4-09cd-4aea-ba94-f3641df4e981->.../sda2

 

View the file system information of a disk

Fdisk/dev/sda

[Root @ yufei ~] # Fdisk/dev/sda

Command (m for help): p

 

Disk/dev/sda: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065*512 = 8225280 bytes

Sector size (logical/physical): 512 bytes/512 bytes

I/O size (minimum/optimal): 512 bytes/512 bytes

Disk identifier: 0x00093fdc

 

Device Boot Start End Blocks Id System

/Dev/sda1*1 1913 15360000 83 Linux

/Dev/sda2 1913 1978 524288 82 Linux swap/Solaris

Q exit

Here we can see the information of the SWAp partition. If df is used, we cannot see the information of the SWAp partition. The usage of the fdisk partition command will be detailed later.

 

Adjust File System Parameters

 

Change the file system label e2label

Command Format

E2label device name new Label name

Note: you do not know how to restore LABLE. If you have any idea, you can leave a message to share it. Thank you!

 

Adjust/view the parameters of the ext2/ext3/ext4 File System in tune2fs

Common options:

-L viewing the file system information is equivalent to the information displayed in dumpe2fs-h.

 

-C max-mount-counts: sets the number of mount times for force self-check. If this option is enabled, mount conut is added to each mount time. After this option is exceeded, the force self-check is performed.

 

-I interval-between-checks [d | m | w] sets the time interval for force self-check [d days, m months, w weeks]

 

-M reserved-blocks-percentage: sets the percentage of reserved blocks.

-R reserved-blocks-count

 

-L volume-label: Set/modify the label of the file system. Functions similar to e2label.

 

-O [^] mount-option [,...] Set or clear the indicated default mount options in the filesystem. Set or clear the default mounted file system options

Tune2fs-o ^ acl/dev/sda1 clear acl attributes

Tune2fs-o + acl/dev/sda1

 

-U uid

-G gid

Set the user and user group for which blocks is retained

 

-U UUID

How to obtain UUID Information

Uuidgen dynamically obtains the UUID information of the file system, which can be changed based on your preferences.

It has two parameters.

-R random acquisition

-T random acquisition based on time

Note: After modification, You need to modify the corresponding/etc/fstab and/boot/grub/menu. lst files. Otherwise, your system will not start. During my experiments, I changed the fstab file and forgot the menu. lst file. As a result, the startup device could not be found.

 

The number and size of blocks and inode are generated when a file system is created. If you want to change the size, you need to format it again.

From yufei blog

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.