Linux Disk Management and Linux file System management

Source: Internet
Author: User

Linux Disk Management
Hard disk
Machinist Hard Drive
Ssds

Mechanical hard-disk
Track: Tracks
Sector: 512bytes per sector
Cylinder: The cylinder consists of several tracks of the same number

Mbr:0 Track 0 sector master boot record main boot cylinder
512bytes
Top 446bytes: Storage bootloader function is the operating system on the boot disk
64bytes: Partition table that holds the file system on disk
16bytes identifies a partition

Identify the hard drive device:/DEV/SD
Tags for different hard drives:/dev/sd[a-z]
Different partitions on the same drive:/dev/sda[1-..]
1-4: Primary or extended partition identification
5 +: Logical partition

Device Files: Special files
Device number:
Major: Marking Device type
Minor: Identify different devices under the same type
"Block": block, random device, access unit for data block
"Character": Character, linear device, access unit for character


Partitioning: Split storage space for multiple small spaces, each of which can use the file system independently

Partitioning tool: Fdisk
Format fdisl "option" Hard drive file name
Manage subcommands:
P: Display
N: Create
D: Delete
T: Modify the partition ID
L: List all supported partition type IDs
W: Save and exit
Q: Discard Save and exit
M: Get Help

After the creation is complete, see if the kernel has identified the new partition
Cat/proc/partitions

There are three commands that allow the kernel to read the disk partition table:
CentOS 5:partprobe [DEVICE]

                    centos6,7  
                         partx    
                              partx Device display partition    
                              PARTX-A DEVICE adds partition information to the kernel, an existing duplicate submission will report an error    
                             PARTX-A-N m:n device adds the specified partition information to the kernel to avoid adding existing ones.    

KPARTX command:
Kpartx-af DEVICE


Linux File System Management
File system: Edit the address has its own index, convenient for computer Management.

Linux uses VMFS (virtual file system) to unify the interfaces of various file systems

Linux:ext2,ext3,ext4,reiserfs,xfs,btefs,swap
Disc: iso9660
Windows:fat32,ntfs
Unix:ffs,ufs,jfs,jfs2
Network File System: NFS, CIFS
Cluster file system: OCFS2, GFS2
Distributed File systems: Ceph,
Moosefs, MogileFS, HDFs, GFS, Glusterfs


(1) journaled file system
Ext3
In disk space dedicated to a log area to put metadata, with metadata corresponding to the database after the completion of the metadata to write to the metadata area. This way, when writing the data, an error occurs that requires self-test to be able to find the metadata of the error directly in the log area, without having to traverse all data areas

(2) Swap swap

Each process considers the physical memory to be used by itself, once the process has used too much memory to cause memory exhaustion. It is time to write the data temporarily unused in memory to the swap partition of the disk to free up physical memory space. Write back to physical memory when this data is needed.


Creating a file system
Perform formatting on a partition (advanced formatting)
To use a file system, two conditions are met:
Kernel: Support for this file system
User space: There are file System management tools


Create tool: Mkfs (make filesystem)
MKFS-T type DEVICE

Mkfs.type DEVICE

Special management tools for the EXT series file system:
mke2fs-t {EXT2|EXT3|EXT4} DEVICE
-B block:1024, 2048, 4096
-L ' LABEL ': Set volume label

Blkid command:
Blkid DEVICE
LABEL, UUID, TYPE

Linux Disk Management and Linux file System management

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.