1. Disk partition:2. fdisk partitionIf the disk is smaller than 2 TB, use fdisk partition; if it is larger than 2 TB, use gdisk partition1. Check the disk status [root@localhost ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT fd0 2:0 1 4K 0 disk sda 8:0 0 20G 0 disk ├─sda1 8:1 0 500M 0 part /boot └─sda2 8:2 0 19.5G 0 part ├─rhel-root 253:0 0 17.5G 0 lvm / └─rhel-swap 253:1 0 2G 0 lvm [SWAP] sdb 8:16 0 20G 0 disk sdc 8:32 0 20G 0 disk sr0 11:0 1 3.5G 0 rom 2. Partition [root@localhost ~]# fdisk /dev/sdb Command (enter m to get help): n //Create a new partition Partition type: p primary (0 primary, 0 extended, 4 free) //Primary partition e extended //Extended partition Select (default p): p //Select the primary partition number (1-4, default 1): Starting sector (2048-41943039, default is 2048): The default value of 2048 will be used Last sector, +sectoror +size{K,M,G} (2048-41943039, default is 41943039): +99MB Partition 1 is set to Linux type and 94 MiB in size Command (enter m to get help): n //Create a new partition Partition type: p primary (1 primary, 0 extended, 3 free) e extended //Extended partition Select (default p): e Partition number (2-4, default 2): Starting sector (194560-41943039, default is 194560): The default value of 194560 will be used Last sector, +sectoror +size{K,M,G} (194560-41943039, default is 41943039): The default value of 41943039 will be used Partition 2 has been set to Extended type and size set to 19.9 GiB //Create logical partition command (enter m to get help): n //Create new partition Partition type: p primary (1 primary, 1 extended, 2 free) l logical (numbered from 5) Select (default p): l //Create logical partitions and add logical partition 5 Starting sector (196608-41943039, default is 196608): The default value of 196608 will be used Last sector, +sectoror +size{K,M,G} (196608-41943039, default is 41943039): +100MB Partition 5 is set to Linux type and 95 MiB in size Command (type m for help): p //View partition creation Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes/512 bytes I/O size (minimum/optimal): 512 bytes/512 bytes Disk label type: dos Disk identifier: 0xf812a8fb DeviceBoot Start End Blocks Id System /dev/sdb1 2048 194559 96256 83 Linux /dev/sdb2 194560 41943039 20874240 5 Extended /dev/sdb5 196608 391167 97280 83 Linux Command (type m for help): w //Keep partitions The partition table has been altered! Calling ioctl() to re-read partition table. Synchronizing disks. 3. Disk formatting1.Format disk file type [root@localhost ~]# mkfs. mkfs.btrfs mkfs.cramfs mkfs.ext2 mkfs.ext3 mkfs.ext4 mkfs.minix mkfs.xfs 2. Format as xfs file system [root@localhost ~]# mkfs.xfs /dev/sdb1 Finish 4. Permanently mount the disk//Use the blkid command to obtain the UUID of each partition [root@localhost ~]# blkid |grep "sdb1" /dev/sdb1: UUID="e271b5b2-b1ba-4b18-bde5-66e394fb02d9" TYPE="xfs" //Use UUID to mount the disk sdb1 partition As for db1, temporarily mount [root@localhost ~]# mount UUID="e271b5b2-b1ba-4b18-bde5-66e394fb02d9" /db1 //You can also write the following line to /etc/fstab to mount it permanently and automatically mount it when the computer starts [root@localhost ~]# tail -1 /etc/fstab UUID=e271b5b2-b1ba-4b18-bde5-66e394fb02d9 /db1 xfs defaults 0 0 //Load the fstab configuration file and check if there are any syntax errors [root@localhost ~]# mount –a 1. Use the blkid command to obtain the UUID of each partition [root@localhost ~]# blkid |grep sdb1 /dev/sdb1: UUID="00e35670-d6c9-44d1-8e8c-f52bd71edf59" TYPE="xfs" 2. Write the following line to /etc/fstab to mount it permanently and automatically at boot time [root@localhost ~]# tail -1 /etc/fstab UUID=00e35670-d6c9-44d1-8e8c-f52bd71edf59 /oppo xfs defaults 0 0 Introduction to the fstab configuration file:root@localhost ~]# vim /etc/fstab 1//Partition ID (UUID or device name) 2//Mount point 3//File type 4//Mount parameters 5//Do not check 6//Do not back up 1//00e35670-d6c9-44d1-8e8c-f52bd71edf59 2///oppo 3//xfs 4//defaults 5//0 6// 0 //Mount parameters, you can write fstab configuration file, or use -o parameter to specify parameters when mounting. Parameter meaning system default value async system writes memory data to disk at regular intervals. sync synchronizes data in memory and disk from time to time; suid, nosuid allow/disallow partitions to have suid attributessuid rw, ro You can specify whether the file system is read-only (ro) or writable (rw) rw exec, noexec allow/disallow executable file execution, do not mount the root partition exec user, nouser Allow/disallow users other than root to mount partitions nouser auto, noauto Automatically mount at boot/not automatically mount auto default default file system mount settings rw, suid, dev, exec, auto, nouser, async //Load all configurations [root@localhost ~]# mount -a Check disk mount status[root@localhost ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT fd0 2:0 1 4K 0 disk sda 8:0 0 20G 0 disk ├─sda1 8:1 0 500M 0 part /boot └─sda2 8:2 0 19.5G 0 part ├─rhel-root 253:0 0 17.5G 0 lvm / └─rhel-swap 253:1 0 2G 0 lvm [SWAP] sdb 8:16 0 20G 0 disk ├─sdb1 8:17 0 191M 0 part /oppo ├─sdb2 8:18 0 1K 0 part └─sdb5 8:21 0 95M 0 part sdc 8:32 0 20G 0 disk sr0 11:0 1 3.5G 0 rom /mnt The above is the detailed content of the Linux operation and maintenance basic system disk management tutorial. For more information about Linux operation and maintenance basic system disk management, please pay attention to other related articles on 123WORDPRESS.COM! You may also be interested in:
|
<<: Vue+Openlayer realizes the dragging and rotation deformation effect of graphics
>>: How to create a style guide for your website in web interface design (with pictures and text)
The SQL query statement execution order is as fol...
Two days ago, I took advantage of the Double 11 s...
Redux is a data state management plug-in. When us...
The effect shows that two browsers simulate each ...
calc is a function in CSS that is used to calcula...
illustrate: VMware IOInsight is a tool that helps...
I don’t know if you have noticed that when we ope...
When I was writing a project yesterday, I needed ...
Swap space is a common aspect of computing today,...
Table of contents Implementation ideas: Step 1: C...
Table of contents Preface Scope 1. What is scope?...
Problem background: There is a requirement to tak...
If you are using the latest Ubuntu Server version...
When I was asked this question, I was ignorant an...
1.This points to 1. Who calls whom? example: func...