The management of disks and files is an important part of the daily maintenance of Linux systems. Because disks are also used as files in Linux, the management of disks and files is actually the management of Linux files. This article will introduce the management methods of Linux and Linux disk systems and files.
First, the file interface: open (), read (), write (), close () and so on.
Device Type:
Block Device: The feature of random access, the unit of data exchange is “block”,
character device (character): linear device, The data exchange unit is “character”. For example: keyboard input
device file: FHS (level system standard for file system)
The /dev/directory in Linux is used to store device files, device files are associated with device drivers and access devices. Portal
Device Management: Device Number
Device Number: Major, Major Device Number (minor)
major: Device Type, Distinguish Device Type for indicating the desired driver
minor: under the same type of different devices, particularly devices (c, character device, b block device) driver driving
II. Linux disk device file naming:
IDE (ATA): 133MB/s, /dev/hd
SCSI: 640MB/s
SATA: 6Gbps
SAS: 6Gbps
USB: 480MB/s
Identifying hard disk devices in Linux other than IDE: /dev/sd
Marking different hard disk devices: /dev/sd [az]
Mark different partitions on the same device: /dev/sd[az][1-]
1-4: Primary or extended partition ID
5+: Logical partition identifier
Third, mechanical hard disk introduction: track track, sector sector, cylinder cylinder
MBR: 0 track 0 sector, master boot sector (master boot record )
MBR is divided into three parts: 446bytes: bootloader, bootloader
64bytes: partition table
16bytes: mark a partition
2bytes:55AA, current Whether the MBR information is valid or not
If the single hard disk exceeds 2T, the MBR partition cannot be used, only the GPT partition can be used.
Partition: Separate storage space into multiple small spaces, each space File system can be used independently;
Partitioning tools:
fdisk, parted, sfdisk
Use of fdisk tools:
fdisk supports up to one hard disk 15 partitions;
fdisk partition management subcommand:
m: Get help for displaying subcommands
p: Display existing partition table
>
n: Create
d: Delete
t: Modify Partition ID
l: List all supported ID types
w: Save and exit
q: Discard changes and exit
4. After the creation is complete, check whether the kernel has been identified. New partition:
# cat /proc/partitions
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: Note: The partition on the mounted hard disk needs to be executed, and the command may need to be executed twice or Partition can be read successfully
partx DEVICE
partx -a DEVICE
partx -a -n M:N DEVICE
M
M:
: N
2.kpartx command: the need to create a file system
kpartx -af DEVICE
and create a partition after Formatting
The above is the Linux system disk and file management method. After learning the method of this article, you will partition, rename, and format the Linux disk.
rvm as a command-line tool, can provide a lot of convenience, is an inaccessible to
apport error report can let programmers understand the error and modify the error code, but if you c
The Nginx log in the Linux system can view the system running records and error des
Tmux is a terminal-use software that can open multiple terminals remotely and has m
Linux system uses commands to print files
Detailed method of configuring CentOS devices using Quagga software
Two ways to enable IPv6 on Ubuntu systems
Linux installation using fail2ban method
Linux uses KSysguard to monitor remote hosts
Linux uses rm to delete the database file how to recover?
X11 forwarding request failed on channel 0 error under Linux
What if CentOS 6.4 can't read ntfs disk?
Ubuntu 12.04 background color can not be changed solution
Win7 installation can not create a partition solution
How does WinXP view computer usage records? See how the computer uses traces
Win10 system quickly switch to the desktop method
Windows10 how to set the lock screen wallpaper to change a fresh or personalized wallpaper
Win10 built-in Windows defender function detailed
Win10 mobile phone preview version 10080 Cortana search crash solution
Windows XP startup delay after operation? Five strokes easily solved
Win8 system starts Win8 automatic backup function
Win8 system has blue screen error code 0x000007B Solution
The reason why the Win7 computer is inserted into the USB flash drive and the solution is