Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Disk and file system management-summary

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Review: disks, disk partitions, fs

Centos6,7:/dev/sd [a Murz [#]

Administrative partition: fdisk,parted,sfdisk

Create a file system:

Linux fs type: ext2,ext3,ext4,xfs,reiserfsf,iso9660,swap

Terms in the organizational structure of the file system:

Block groups,block,inode table,inode,inode bitmap,block bitmap

Block groups: internally divided into metadata area and data area

Block groups includes blocks

Inode bitmap: identifies which inode has been used and which is not

Block bitmap: which blocks can be used and which cannot be used

Superblock: which block groups of partitions on the system have been used and which are not

Block-- > block groups (group descriptor)-- > super block (partition information)

Group descriptor: each has several important block pointers to inode table,block bitmap,inode bitmap in block group

Super block: the information is the size of each block in the partition, how many block group are there on the hard disk, and how many inode are there in each block group

Uname-r / / View the kernel release

Cat / etc/issue / / View the distribution of the system

Fdisk-l

/ dev/mapper/8 these are logical volumes

Partx-a / dev/sda / / update partition

Kpart-af / dev/sda / / Update Partition

-an add a new partition mapping

-d Delete

-f force the creation of a mapping

Components of the kernel-level file system

File system driver: / / can be compiled into the kernel or made into a kernel module

Lsmod | grep ext4 / / can be seen when compiled into a module

Kernel provides

File system management tools: user space applications provide

1. Tools for creating fs

Mkfs. {ext2,3,4,xfs}

-t ext2/xfs/ext4

Mke2fs / / function is powerful

-t {ext2,3,4}

-b {1024 | 2048 | 4096} / / specify the block size of the file system

-L label / / indicates the volume label

/ / mke2fs-t ext4-L TESTDATA / dev/sdb1

-j enable logging function

-I bytes-per-inode / / how many inode per person

-N directly specifies that you want to create an inode for this fs

-O [^] FEATURE adds or cancels a feature, ^ turns it off

/ / feature can only be used when formatting

-m is the percentage reserved by the administrator, specifying the reserved percentage

Parted

two。 Tools for detecting and repairing fs

Fsck / / the operation is terminated abnormally due to reasons such as unexpected termination of the process or system crash, which may lead to file corruption. At this time, fs should be detected and repaired. It is recommended to proceed offline.

Fsck. {ext2,3,4,xfs}

-an automatically fix all errors

-t specifies the fs type

-r interactive repair

E2fsck checks the ext file system

-y automatically answer yes

-f mandatory, even if fs is clean

3. Tools for viewing its properties

Dumpe2fs is similar to tune2fs in displaying fs attribute information.

All volume group information is displayed by default

-b display bad block

-h displays only superblock information, just like tune2fs-l

Tune2fs: view or modify some properties of the ext system, some are adjustable and some are immutable

-l list the contents of the super blocks of fs

-j / / upgrade ext2 to ext3

-L volume label

-m percentage of reserved space

-O [^] FEATURE: turn a feature on or off and reformat it without reformatting

Tune2fs-l / dev/sdb1

Filesystem features: has_journal ext_attr resize_inode dir_index filetype sparse_super large_file

Tune2fs-O ^ has_journal / dev/sdb1 / / turn off a feature

-o [^] mount_options turns certain mount options on or off

Acl,uid16,user_xattr,journal_data

Tune2fs-o ^ acl / dev/sdb1

Blkid / / View the UUID and partition type of the device

Blkid-L label |-U uuid / /-L view the label corresponding to the volume label, and locate the device according to UUID

4. Adjust fs Properti

Tune2fs

E2label / dev/sdb1 TEST// volume label can be viewed and modified without adding a name.

Swap file system

Swap partitions on Linux must use a separate fs

And the system ID of fs must be 82

Mkswap / dev/sdb1

-f compulsion

-L specifies the volume label

Swapon / dev/sdb1

Windows does not recognize the fs of linux

USB disk is formatted into vfat (fat32) format

Btrfs:btree fs may be a trend in the future, Centos7.

Disk Partition:

Summary of fs management tools:

Management tool: mkfs,mke2fs,e2lable,tune2fs,dumpe2fs,blkid

Mkfs.xfs,mkfs.vfat,fsck,e2fsck

Mount: mount,umount

Df,du,fuser,lsof

Swap Partition:

Mkswap,swapon,swapoff

Fstab file:

Device mount point mount option backup self-test order

File system:

A directory; a file.

Metadata: inode,inode table

Data: data blocks

The corresponding relationship between the file name of a subordinate file or directory and its inode

File name: parent directory

Delete the file:

Mark all data block pointed to by the file inode as unused; Mark the inode of this file as unused

Copying: creating a new file

Move: move files on the same fs

Just modify its path mapping, the inode remains the same, and the data block pointed to by the inode remains the same.

Across file systems, copy the data to the target file and delete the source file

Symbolic links:

Most symbolic links do not point to data block / / data block will only be referenced when the path name is too long to accommodate the metadata area.

Permissions: lrwxrwxrwx / / user's permissions on symbolic links, depending on the source file itself

/ / is mostly used for directories

Hard links:

Point to the same inode

Any path can access the source file, inode is the same. Updating one will modify the other.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report