Linux Fundamentals-Disk Management

Source: Internet
Author: User

MBR: Master boot Record

Master Boot Record

446bytes:bootloader

64bytes:

Identifies one primary partition per 16bytes, so it can identify up to 4 help zones

2bytes:magic number

Mark MBR is valid

Link file:

Soft Link: Equivalent to create a shortcut, save the source file path, link file and source file Inode number is not the same, delete the linked file, the source file can continue to access, delete the source file, the link file is inaccessible. Can be applied to the directory, can cross the file system, does not increase the number of links. Its size is the number of characters that the path that the pointer contains.

Example: [[email protected] backup]# ln-s/backup/abc/backup/test/abc2[[email protected] backup]# lltotal 8-rw-r--r--. 1 root root 884 Dec 21:04 abcdrwxr-xr-x. 2 root root 4096 Dec 21:06 Test[[email protected] backup]# ll test/total 0lrwxrwxrwx. 1 root root one Dec 21:06 ABC2-/BACKUP/ABC

Hard links: Similar to replication, linked files and source files use the same inode number, delete source files, and link files can continue to be accessed. To avoid looping hard links, hard links cannot be applied to a directory and can only be applied to files. Also because the source and link files use the same inode number, they cannot be created across file systems. Creating a hard link increases the number of times the file will be linked.

Example: [[email protected] backup]# ln/backup/abc/backup/test/abc2[[email protected] backup]# lltotal 8-rw-r--r--. 2 root root 884 Dec 21:04 abcdrwxr-xr-x. 2 root root 4096 Dec 21:05 Test[[email protected] backup]# ll test/total 4-rw-r--r--. 2 root root 884 Dec 21:04 abc2# The number of links to ABC after creation became 2

Grammar:

ln [options] [parameters]

Command options

-B or--backup: Delete, overwrite the backup before the target file,-D or-F or--directory: Make a hard connection to the directory,-F or--force: Forcibly create a connection to a file or directory, regardless of whether the file or directory exists;-I or-- Interactive: Ask the user before overwriting the existing file,-N or--no-dereference: treats the destination directory of the symbolic connection as a generic file;-S or--symbolic: establishes a symbolic connection to the source file instead of a hard connection;-s< Tail backup string > or--suffix=< Tail backup string;: After backing up the target file with "-B" parameter, the tail of the backup file is added a backup string, the default backup string is the symbol "~", the user can change it by "-S" parameter;-V or-- Verbose: show instruction execution process;-v< backup mode > or--version-control=< backup method;: After backing up the target file with the "-B" parameter, the tail of the backup file is added with a backup string, which is not only available with "-S" Parameter changes, when using the "-V" parameter < backup method > Specify different backup mode, will also produce a different tail of the backup string;--help: Online Help;--version: Displays version information.


Linux device files:/dev

C: Character devices, unit by block, random access devices, common with hard drives

B: Block device, by character unit, linear device, common with mouse, etc.

[Email protected] backup]# LL/DEVBRW-RW----. 1 root disk 7, 6 Dec 12:24 LOOP6BRW-RW----. 1 root disk 7, 7 Dec 12:24 LOOP7CRW-RW----. 1 Root LP 6, 0 Dec 12:24 Lp0#lp0 6 represents the primary device number, identifies the device type in #lp0, 0 represents the secondary device number, identifies the different devices in the same type # The system is looking for the device by the major and secondary device number.

Create a device file [Mknod]: Access entry for the device

Syntax: Mknod [OPTION] ... NAME TYPE [MAJOR MINOR]

#创建个字符设备 [[email protected] backup]# Mknod mydev C (0[[email protected] backup]# ll Mydev crw-r--r--. 1 root root, 0 Dec 21:21 mydev# Create a character device with a permission of 644 [[email protected] backup]# mknod-m 644 mydev2 C 1[[email protected ] backup]# ll Mydev2 crw-r--r--. 1 root root, 1 Dec 21:22 Mydev2

#如果使用echo "Hello" >>/dev/sda, the consequence is that it will be written to the/DEV/SDA disk in the first place, the MBR will be covered part. Very dangerous.


Hard drive Identification method:

Ide,ata:hd

Sata:sd

Scsi:sd

Usb:sd

A,b,c ... Distinguish different devices under the same type.

1,2,3,4 .... partition number

/DEV/HDA1: Represents the first primary partition of the first primary disk of a single IDE device.


Disk partition management: fdisk

-L: View the current system with several disks

-L/DEV/SDA1: View partition information for/DEV/SDA1

This article from "Liang Childe" blog, please be sure to keep this source http://iyull.blog.51cto.com/4664834/1885177

Linux Fundamentals-Disk 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.