Linux disk and file system management

Source: Internet
Author: User
Tags disk usage

Linuxdisk and file system Management

I know the question.

How do I list all disk partition information? cat/proc/partitions

Or you can: ll/dev/sda*; list

ll/dev/sdb*

1. First we need to familiarize ourselves with the inode,block, and superblock their meaning and their relationship

Each inode and block is numbered, and each file occupies an inode, and the data for this file is recorded Block number, so if we can find the inode of the file, we can know the block number of the data placed in the file, Of course, you will be able to read the actual data of the file.

We call this method of data access an indexed file system.

2. Introduce The basic composition of the EXT2 file system

There is a boot sector (boot sector)at the very front of the filesystem, which can be used to install the BootManager, which is a non-bands important sector because we are able to install different boot management programs at the forefront of individual file systems. Instead of overwriting the entire hard disk's only MBR, it is possible to create a multi-boot environment

The EXT2 file system is basically differentiated into blocks (block group) when formatted, and each block group has a separate inode/block/superblock System. Each of the blockgroup is divided into six main parts:

Data block: where to place the file

inodetable:inode table, where inode block

each inode 128bytes, inode . inode the size is fixed 128bytes, But there are so many things to record, if a file is too large, then just a inode The space is not enough, so ext2 p202

Superblock ( Super block ): Where the entire file system information is recorded, there is no superblock without the file system.

File System Description ( FileSystem description Description )

Block Bitmap ( table )

Inode Bitmap (inode table )

3. View superblock information:dumpe2fs

Eg:dumpe2fs/dev/hdc2

4. Contents:EXT2 will allocate an inode with at least one block to the directory,inode Records the permissions and properties of the directory, and records the assigned block number, while block records the file name in this directory Inode Number data.

files: ext2 assigns a inode and files relative to file size block Quantity to the file.

eg:  /  inode : Find the by loading the information of the mount point. /dev/hdc2 inode number is 2 inode inode have permissions so that we can read the block r and x)

access to 5.EXT2/EXT3 files and the functionality of the log file system

If we want to add a file, then the file system behaves as follows:

Because the ext2 file system may have inconsistent state of data, and in order to effectively solve this problem, there is a log file system appears. and ext3 has the ability to do so.

How does a journaled file system effectively resolve data inconsistencies? A block is planned in our file system that specifically records the steps to write or revise a file, so that it can be easily resolved.

6. Significance of Mount point

The operation of combining the file system and the directory tree is what we call mount.

The mount point must be a directory, which is the entry to the file system.

the VFS 7.Linux

Linux supports a variety of file systems, sohow does theLinux kernel manage these file systems? In fact, the entire Linux system is read through the vitual Filesystem Switch ( virtual file management,VFS) of the kernel functional area of the file system. In other words, The Linux-aware file system is the VFS in the management.

8. Simple operation of the file system

DF : List The overall disk usage of the file system

Du : Evaluating the disk usage of the file system (commonly used in the estimate catalog)

ln :  connect file, create a hard connection, that is hard link inode number. But ln objects need attention, Cannot cross file system, cannot link directory.

You can also create a symbol link , a symbolic connection that takes up inode and block, and it can link directory, can effectively do the protection of files. For More detailed application of LN please refer to the reference book P213.

9. Partitioning, formatting, checking and mounting of disks

Disk partition:fdisk

Here are some of the uses of fdisk :

Add partition, delete partition, display basic information of partition. Please refer to the P217 of the reference book for details .

10. Disk Format:mkfs ( default format ), MKE2FS ( can be customized format )

11. Disk Inspection:fsck,badblock.

12. Disk mount and unload:mount,umount

Mount Required Note: A single file system should not be repeatedly mounted on different mount points

A single directory should not repeatedly mount multiple file systems

Directory as mount point should be empty directory as well

13. Disk parameter modification:mknod

Modify System Volume Label:E2label

There are also some commands:tune2fs, Hdparm

14. Set the boot mount

Set the boot mount, where the settings file is in:/etc/fstab

15. Special Set loop mount (image file does not burn on Mount use)

16. parted can also be used for large-capacity ( more than 2TB) partitions

Key reviews

Related Article

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.