Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of disk Management in basic system of Linux Operation and maintenance

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces the Linux operation and maintenance basic system disk management example analysis, the article is very detailed, has a certain reference value, interested friends must read it!

1. Disk Partition:

2.fdisk partitions use fdisk partitions for less than 2t and gdisk partitions for larger than 2t. Check the disk condition [root@localhost ~] # lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTfd0 2:0 1 4K 0 disk sda 8:0 0 20G 0 disk ├─ sda1 8:1 0500M 0 part / boot └─ sda2 8:2 019.5G 0 part rhel-root 253 sda2 0 17.5G 0 lvm / └─ rhel-swap 253 sda2 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 for help): n / / New partition Partition type: P primary (0 primary, 0 extended, 4 free) / / main partition e-partition / / extended partition Select (default p): P / / Select primary partition number (1-4, default 1): start sector (2048-41943039) Default is 2048): the default 2048Last sector will be used, + sector or + size {K primary M free G} (2048-41943039, default is 41943039): + 99MB partition 1 has been set to Linux type, size set to 94 MiB command (enter m for help): n / / New partition Partition type: P partition (1 primary, 0 extended, 3 free) e extended / / extended partition Select (default p): e partition number (2-4) Default 2): start sector (194560-41943039, default is 194560): the default value 194560Last sector will be used, + sector or + size {KMagne MMagne G} (194560-41943039, default is 41943039): will use default value 41943039 Partition 2 has been set to Extended type The size is set to 19.9 GiB// create logical partition command (enter m for help): n / / new partition Partition type: P primary (1 primary, 1 extended, 2 free) l logical (numbered from 5) Select (default p): l / / create logical partition add logical partition 5 starting sector (196608-41943039, default is 196608): the default 196608Last sector, + sector or + size {K or M G} (196608-41943039) will be used Default is 41943039): + 100MB partition 5 has been set to Linux type, size set to 95 MiB command (enter m for help): P / / View partition creation disk / dev/sdb:21.5 GB, 21474836480 bytes 41943040 sector Units = sector of 1 * 512 = 512 bytes sector size (logical / physical): 512byte / 512byte I Zero size (min / optimal): 512byte / 512byte disk label type: dos disk identifier: 0xf812a8fb device Boot 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 (enter m for help): W / / keep The partition table has been altered calling ioctl () to re-read partition table. Synchronizing disks. 3. Disk format 1. File type of format disk [root@localhost ~] # mkfs.mkfs.btrfs mkfs.cramfs mkfs.ext2 mkfs.ext3 mkfs.ext4 mkfs.minix mkfs.xfs 2. Formatted as xfs file system [root@localhost ~] # mkfs.xfs / dev/sdb1 completed 4. Permanently mount disk / / use blkid command to obtain UUID [root@localhost ~] # blkid | grep "sdb1" / dev/sdb1: UUID= "e271b5b2-b1ba-4b18-bde5-66e394fb02d9" TYPE= "xfs" / / use UUID to mount disk sdb1 partition as for db1, temporarily mount [root@localhost ~] # mount UUID= "e271b5b2-b1ba-4b18-bde5-66e394fb02d9" / db1// can also write the following line to / etc/fstab Permanently mount, boot automatically mount [root@localhost ~] # tail-1 / etc/fstabUUID=e271b5b2-b1ba-4b18-bde5-66e394fb02d9 / db1 xfs defaults 00 fstab / load fstab configuration file, and detect syntax errors [root@localhost ~] # mount-A1. Use the blkid command to get the UUID [root@localhost ~] # blkid of each partition | grep sdb1/dev/sdb1: UUID= "00e35670-d6c9-44d1-8e8c-f52bd71edf59" TYPE= "xfs" 2. Write the following line in / etc/fstab Permanent mount Boot automatic mount [root@localhost ~] # tail-1 / etc/fstab UUID=00e35670-d6c9-44d1-8e8c-f52bd71edf59 / oppo xfs defaults 0 0fstab configuration file introduction: root@localhost ~] # vim / etc/fstab1// partition ID (UUID or device name) 2pm / mount point 3pm / file type 4pm / mount parameter 5pm / do not check 6pm / do not back up 1//00e35670-d6c9-44d1-8e8c-f52bd71edf59 2///oppo 3pm / Xfs 4//defaults 5max 06max / 0max / mount parameters You can write a fstab configuration file, or you can use the-o parameter when mount to specify the 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 allows / disallows partitions to have suid attributes suidrw,ro can specify whether the file system is read-only (ro) or writable (rw) rwexec,noexec allows / disallows executable execution, do not mount root partition execuser,nouser allows / disallows users other than root to mount partition nouserauto Noauto boot auto mount / no auto mount autodefault default file system mount settings rw, suid, dev, exec, auto, nouser Async// loads all configurations [root@localhost ~] # mount-a to check disk mount [root@localhost ~] # lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTfd0 2:0 1 4K 0 disk sda 8:0 020G 0 disk ├─ sda1 8:1 0500M 0 part / boot └─ sda2 8:2 019.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 13.5G 0 rom / mnt and above are all the contents of the article "sample Analysis of disk Management in Linux Operation and maintenance basic system" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report