Linux System Management--disk Management and system management

Source: Internet
Author: User
Tags uuid

1.Linux Disk Management

Hard disk:

Mechanical hard-disk

Ssds


Mechanical type:

Track

Sector:512bytes

Cylinder: The basic unit of the partition;


Mbr:master Boot Record

512bytes

446:bootloader

64:filesystem Allocation table

16: Identify a partition

2:55aa


Disk interface type:

IDE (ATA): 133MB/S,/DEV/HD

scsi:640mb/s

sata:6gbps

sas:6gbps

usb:480mb/s


Identify the hard drive device:/DEV/SD

Mark a different hard drive device:/dev/sd[a-z]

Mark different partitions on the same device:/dev/sd[a-z][1-]

1-4: Primary or extended partition identification

5 +: Logical partition identification


Device Files: Special files

Device number:

Major, minor

Major: Device type

Minor: Different devices under the same type


"Block": block, Random device

"Character": Character, linear device


Gpt


Partitioning: Separates the storage space into multiple small spaces, each of which can use the file system independently;



2. Partitioning tools:

Fdisk, parted, Sfdisk


Use of the Fdisk tool:

Support for up to 15 partitions on one hard drive;

Partition Management sub-command:

P: Display

N: Create

D: Delete

T: Modify the partition ID

L: List all support ID types

W: Save exit

Q: Discard Changes and exit

M: Get Help



FDISK/DEV/SDA, creating a new disk partition

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/9F/wKioL1XpktuQKEKpAAEVYo__eVk043.jpg "title=" QQ picture 20150904203748.png "alt=" Wkiol1xpktuqkekpaaevyo__evk043.jpg "/>


Fdisk-l/DEV/SDA confirm that the partition is established successfully



650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/A3/wKiom1Xpk6zjC5wdAAFduaT2BgQ156.jpg "title=" 123. PNG "alt=" wkiom1xpk6zjc5wdaafduat2bgq156.jpg "/>



After the creation is complete, check to see if the kernel has identified the new partition:

# cat/proc/partitions


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/A3/wKiom1XplPjCNet3AACnqGXNC2Y289.jpg "title=" 12.png "alt=" Wkiom1xplpjcnet3aacnqgxnc2y289.jpg "/>

There are three commands that allow the kernel to reread the disk partition table:

CentOS 5:partprobe [DEVICE]

CentOS 6, 7:

Partx

Kpartx


PARTX command:

-A,--add add the specified partition or all partitions

-D,--delete delete the specified partition or all partitions

-S,--show list partitions


-U,--update update the specified partition or all partitions

-B,--bytes to print a SIZE in bytes rather than in an easy-to-read format

-G,--noheadings--show when the title is not printed

-N,--nr <n:m> specify partition range (for example:--nr 2:4)

-O,--output <type> define which output column to use

-P,--pairs using key= "value" output format

-R,--raw using native output format

-T,--type < type > Specify partition type (DOS, BSD, Solaris, etc.)

-V,--verbose verbose mode


KPARTX command:

Kpartx-af DEVICE


3. System File Management



To create 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)


-T,--type=< type > file system type; If not specified, ext2 will be used

Fs-options parameters of the actual file system Builder

< device > path to use the device

< size > To use the number of blocks on the device

-V,--verbose explains the operation in progress;

Specifying-v multiple times will result in an empty run (Dry-run)



MKFS-T type DEVICE

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/9F/wKioL1XpoYrCvZunAAI9HA8vV-k273.jpg "title=" 11.png "alt=" Wkiol1xpoyrcvzunaai9ha8vv-k273.jpg "/>


Mkfs.type DEVICE

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/A3/wKiom1XpnyqQl0bMAAIr_tywvbU372.jpg "title=" QQ picture 20150904213918.png "alt=" Wkiom1xpnyqql0bmaair_tywvbu372.jpg "/>

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

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/A0/wKioL1Xpol6AKSYfAABaQICfQkM612.jpg "title=" 123. PNG "alt=" wkiol1xpol6aksyfaabaqicfqkm612.jpg "/>



File System Properties View and adjustment tools:

E2label

E2lable DEVICE [LABEL]


Tune2fs

Displays the properties of the Ext series file system, or adjusts its properties;


-L: Displays information in the Super block, and displays information about the properties and layout of the entire file;

-L ' LABEL ': Modify the volume label;

-M #: Adjust the percentage of administrative space reserved to administrators;

-J:EXT2-Ext3

-O: File System Properties start or close

-O: File system default mount option enabled or closed


DUMPE2FS:

-H: Displays only the Super block information;


File System Detection:

Fsck:filesystem Check

FSCK-T type

Fsck.type

-A: Auto fix error

-r: Interactive fix error

-F: Force detection


E2fsck:ext Series file system-specific detection and repair tools;

-Y: Auto Answer "yes"

-f:force

4. File system mount and use

Mount points: mount point, device mounted to directory;


Note: After the mount point is mounted, its internal files are temporarily hidden, and an empty directory is used as the mount point;


Mount Method:

Mount: Displays all devices that are already mounted on the current system by reading the/etc/mtab file;

MOUNT-A: Mounts all file systems in the/etc/fstab file that support automatic mounting;

mount [Options] [-o options] DEVICE mount_point

[Options]: Command options

[-O options]: Mount options


Device: Devices to be mounted

(1) Device file:/dev/sda5

(2) Volume Label:-L ' LABEL '

(3) uuid:-u ' UUID '

(4) pseudo file system name

Mount_point: Mount point

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/A3/wKiom1XpozeTAW_HAABBz7LuXKA646.jpg "title=" 2.png " alt= "Wkiom1xpozetaw_haabbz7luxka646.jpg"/>

Umount: Uninstall command

# Umount DEVICE

# Umount Mount_point


To view the process that is accessing the specified mount point:

# fuser-v Mount_point


Terminates all processes that are accessing the specified mount point:

# fuser-km Mount_point

5. Create a 10G file system, type EXT4, require boot to automatically mount to/mydata directory

Create a MyData file 650) this.width=650; "Src=" http://s3.51cto.com/wyfs02/M01/72/A0/wKioL1Xppd_xhOumAAAfAGnLP7U095.jpg " Title= "1.png" alt= "Wkiol1xppd_xhoumaaafagnlp7u095.jpg"/>

Mount the previously created 10G to MyData

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/A3/wKiom1XpozeTAW_HAABBz7LuXKA646.jpg "title=" 2.png " alt= "Wkiom1xpozetaw_haabbz7luxka646.jpg"/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/A3/wKiom1XppD3wWc-gAAE_-ddNtRg720.jpg "title=" QQ picture 20150904220101.png "alt=" Wkiom1xppd3wwc-gaae_-ddntrg720.jpg "/>


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/A0/wKioL1Xpq1LBmm16AAGZdX31ZZs583.jpg "title=" QQ picture 20150904222219.png "alt=" Wkiol1xpq1lbmm16aagzdx31zzs583.jpg "/>


This article from "Entertain Yourself" blog, reproduced please contact the author!

Linux System Management--disk Management and 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.