View Linux system partition and memory

df -h View the partition situation
View the memory usage.
Free -m or free -l can be used, but the obtained unit is different. After the main partition is separated by
ps
, the rest can be divided into extended partitions. Generally, all the remaining parts are divided into extended partitions. , Or not fully divided, the remaining part is wasted.
The extended partition cannot be used directly and is not allowed to be divided into several logical partitions. All logical partitions are part of the extended partition

Hard disk capacity = primary partition capacity + extended partition capacity

The capacity of the extended partition = the sum of the capacities of each logical partition
Main extended logic

&> Mixed output
1> Correct output
2> Wrong output
1> yes.txt 2> no.txt
/dev/null Recycle bin trash can
yum -y install at
systemctl restart atd
at now +1 min
Action crtl +d save Delete ctrl +backspace
ping -c1 xxx >/dev/null

if [ $? -eq 0 ];then
echo “is up” > up.txt

else
echo “x is down.” > down.txt
fi

| |

sort -t":" -kx -n /etc/passwd -r

The three partitions that a Linux system must have are
/ /boot swap
swap partition oom out of memory to prevent memory overflow
/boot boot
/

1 What is the partition standard of Linux server system in the enterprise? To put it another way, linux must have 3 partitions.
Answer:
/
/boot
swap
2 How to format a disk? What commands are used?
Cancel the mount first, then format
mkfs.xfs /dev/sdb1 format the main partition
mkfs.xfs /dev/sdb -f format the entire disk
3 to sdc partition 20G. The first primary partition is 4G and the second primary partition (non-extended partition) is 2G. The logical partition is all the remaining space.
fdisk /dev/sdb
n
p
+4G
n
p
+2G
n
e
w
4 After formatting /dev/sdc, create a 2G primary partition and the second 4G. Temporarily mount to
mkfs.xfs /dev/sdc -f
fdisk /dev/sdc
n
p
+2G
n
p
+4G
w
mkdir /dir1
mkdir /dir2
mkfs.xfs /dev/sdc1
mkfs in the /dir1 and /dir2 directories respectively . xfs /dev/sdc2
mount /dev/sdc1 /dir1 -f
mount /dev/sdc2 /dir2 -f
5 Format /dev/sdc directly. Restore the disk to unpartitioned state.
mkfs.xfs /dev/sdc -f
6 What is the file cannot be created the reason?
The disk partition is unreasonable and the partition space is too small. The
disk space is full.
7 Mount the sdb disk to /mnt/dir1 and mount the sdc disk to /mnt/dir2.
mkdir /mnt/dir1
mkdir /mnt/dir2
mount /dev/sdb /mnt/dir1
mount /dev/sdc /mnt/dir2
8

9 What operating system are you using? What file system?
uname -r
cat /etc/redhat-release
.xfs .extdf-
10 How many disk rotation speeds do you know?
7200
10000
11 What command is used for mixed output? The correct output is written to up.txt and the wrong information is written to erro.txt.
&>1.txt
1>up.txt 2>error.txt
12 How to cancel the mount? What command to use?
umount /dev/sdb /dir1
13 What command is used to view partitions?
df -h
14 What command is used to view / partition remaining space and file system type?
free -m
15 Arrange the GID of your /etc/passwd file in flashback.
sort -t":" -k4 -n /etc/passwd -r

Guess you like

Origin blog.csdn.net/qq_43812373/article/details/109263169