2019.7.31 Linux Chapter V operation and ownership rights management

1, the new two 30GB SCSI hard disk for the host


2, divided into three primary partitions, each 5GB, the remaining space for the extended partition

/dev/sdb1 2048 10487807 5242880 83 Linux
/dev/sdb2 10487808 20973567 5242880 83 Linux
/dev/sdb3 20973568 31459327 5242880 83 Linux
/dev/sdb4 31459328 62914559 15727616 5 Extended

3, the establishment of two logical partitions, the capacity in the extended partition is 2GB, 10GB, respectively

/dev/sdb5 31461376 35655679 2097152 82 Linux swap / Solaris
/dev/sdb6 35657728 56629247 10485760 83 Linux

4, the type of the first logical partition to swap

/dev/sdb5 31461376 35655679 2097152 82 Linux swap / Solaris

5, the first partition is formatted as a primary ext4

[root@localhost ~]# mkfs.ext4 /dev/sdb1

6, the second primary partition as xfs

[root@localhost ~]# mkfs -t xfs /dev/sdb2

[root@localhost ~]# mkfs.xfs -f /dev/sdb2


7, the third primary partition formatted as FAT32

[root@localhost ~]# mkfs -t vfat -F 32 /dev/sdb3

8, create / data1 / data2 / data3

[root@localhost ~]# mkdir /data{1..3}

9, the first primary partition to mount / data1, create a file in the directory test, and implement / etc / fstab

[root@localhost ~]# mount /dev/sdb1 /data1
[root@localhost ~]# vim /etc/fstab

/ dev / sdb1 / data1 ext4 Defaults 0 0
10, the second primary partition to mount / data2, create a file in the directory test, and implement / etc / fstab

[root@localhost ~]# mount /dev/sdb2 /data2
[root@localhost ~]# vim /etc/fstab


11, the second primary partition to mount / data3, create a test file in the directory, and based on the UUID implement / etc / fstab

[root@localhost ~]# mount -a/dev/sdb2 /data3

[root@localhost ~]# blkid /dev/sdb2

/dev/sdb2: UUID="b8d60a47-b52f-4620-a331-e897356fd31c" TYPE="xfs"

 


12, the first logical partition formatting a format swap, the swap partition extend, test to see

[root @ localhost ~] # mkswap / dev / sdb5 --------- // create file sorting system
is provided swap version 1, size = 2097148 KiB
no label, UUID = a4dbd2f7-5ecd-470c-a0b4 -16b673df0236

root @ localhost ~] # swapon -s --------- // Check
the file permissions name type size has been with
/ dev / dm-1 partition 2097148 0 -1


[root @ localhost ~] # swapon / dev / sdb5 --------- // activation
[root @ localhost ~] # swapon -s ------------ // View
files name type size used permission
/ dev / DM-2,097,148 Partition 0. 1 -1
/ dev / sdb5 2,097,148 Partition 0 -2
[the root @ localhost ~] # CAT / proc / meminfo | grep -i "SwapTotal"
SwapTotal: 4194296 kB


13, by xftp other tools linux.iso reached linux virtual machine, and mount view the content


[root @ localhost ~] # Mount / dev / SR0 / Media /
Mount: / dev / SR0 write protection, will be mounted read-only
[root @ localhost ~] # LS / Media /
CentOS_BuildTag the GPL LiveOS RPM-GPG-KEY . 7--CentOS
the EFI Images the Packages the RPM-the GPG-KEY-the CentOS-Testing. 7-
the EULA the isolinux the repodata TRANS.TBL


14, based on papers will expand 500M SWAP

[root @ localhost ~] # dd if = / dev / zero of = / sw bs = 1M count = 500
the recording 500 + 0 read into
the recording to write a 0 + 500
524 288 000 bytes (524 MB) have been copied, 3.28226 seconds, 160 MB / sec

[root@localhost ~]# mkswap /sw

We are setting up swap space version 1, size = 511996 KiB

No label, UUID = bab8c32e-1eb8-465b-b719-043143ff12fe

[root@localhost ~]# swapon /sw

swapon: / sw: unsafe permissions 0644, we recommended 0600.

[root@localhost ~]# swapoff /sw

[root@localhost ~]# swapon /sw

swapon: / sw: unsafe permissions 0644, we recommended 0600.

[root@localhost ~]# cat /proc/meminfo | grep -i "swaptotal"

SwapTotal: 4706292 kB

 

15, the optical disc contents using a command dd made into iso image

16, view disk usage

[root @ localhost ~] # df -hT
file system type with capacity has been available by the mount point%
/ dev / Mapper / XFS CentOS the root 37G-34G. 9% 3.3G /
devtmpfs devtmpfs 897m 897m 0 0% / dev
tmpfs tmpfs 0% 0 912M 912M / dev / SHM
tmpfs tmpfs 912M 903m. 1% 9.0 M / RUN
tmpfs tmpfs 912M 0 912M 0% / SYS / FS / a cgroup
/ dev / sda1 XFS 18 is for Style 179M% of 10-14m / Boot
tmpfs tmpfs 183M 183M. 1 2OK % / RUN / User / 0
/ dev / ISO9660 SR0 4.3G 4.3G 0 100% / RUN / Media / the root /. 7 the CentOS the x86_64
/ dev / sdb1 ext4 20M 4.6G 4.8G. 1% / DATAl
/ dev / XFS 5.0G sdb2 33M 5.0G 1% / data2


17, by using the above commands parted partitioning process over again for another hard


18, try to use a shell script to configure yum warehouse

19, try to use a shell script to configure the httpd service

20, try to use a shell script to achieve 2 to 12 questions

Note: 181 920 As an extension, you can choose to make

Guess you like

Origin www.cnblogs.com/otherwise/p/11279039.html