Bo's Oracle Station

查看: 1847|回复: 0

课程第18/19次

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2019-5-21 21:49:06 | 显示全部楼层 |阅读模式
2019-05-21  2019-05-23
  1. [root@station60 ~]# cat /proc/partitions
  2. major minor  #blocks  name

  3.    8        0   20971520 sda
  4.    8        1    1048576 sda1
  5.    8        2   19921920 sda2
  6.    8       16    1048576 sdb
  7.    8       19          0 sdb3
  8.    8       21     204800 sdb5
  9.    8       22     204800 sdb6
  10.   11        0    4391936 sr0
  11. 253        0   17821696 dm-0
  12. 253        1    2097152 dm-1
  13.    7        0    1048576 loop0
  14. [root@station60 ~]# df -Th
  15. Filesystem            Type      Size  Used Avail Use% Mounted on
  16. /dev/mapper/rhel-root xfs        17G  4.9G   13G  29% /
  17. devtmpfs              devtmpfs  894M     0  894M   0% /dev
  18. tmpfs                 tmpfs     1.5G     0  1.5G   0% /dev/shm
  19. tmpfs                 tmpfs     910M  2.8M  908M   1% /run
  20. tmpfs                 tmpfs     910M     0  910M   0% /sys/fs/cgroup
  21. /dev/sdb6             ext4      190M  1.6M  175M   1% /mnt
  22. /dev/sda1             xfs      1014M  178M  837M  18% /boot
  23. tmpfs                 tmpfs     182M  8.0K  182M   1% /run/user/42
  24. tmpfs                 tmpfs     182M   32K  182M   1% /run/user/0
  25. /dev/sr0              iso9660   4.2G  4.2G     0 100% /run/media/root/RHEL-7.6 Server.x86_64
  26. /dev/loop0            xfs      1014M   33M  982M   4% /run/media/root/155b06c3-e700-4347-8247-52ec954369bc
  27. [root@station60 ~]# umount  /mnt
  28. [root@station60 ~]# blkid  /dev/sdb6
  29. /dev/sdb6: LABEL="/mnt" UUID="27e8f7cb-5770-4711-be5f-710401a26bcb" TYPE="ext4"
  30. [root@station60 ~]# vim /etc/fstab
  31. [root@station60 ~]# e2label /dev/sdb6
  32. /mnt
  33. [root@station60 ~]# vim /etc/fstab
  34. [root@station60 ~]# swapon -a
  35. [root@station60 ~]# swapon -s
  36. Filename                                Type                Size        Used        Priority
  37. /dev/dm-1                                      partition        2097148        0        1
  38. /dev/sdb5                                      partition        204796        0        1
  39. [root@station60 ~]# swapoff /dev/sdb5
  40. [root@station60 ~]# vim /etc/fstab
  41. [root@station60 ~]# blkid /dev/sdb5
  42. /dev/sdb5: UUID="a52e60db-23e4-447c-b7e8-2250eace2e1a" TYPE="swap"
  43. [root@station60 ~]# vim /etc/fstab
  44. [root@station60 ~]# pvs
  45.   PV         VG   Fmt  Attr PSize   PFree
  46.   /dev/sda2  rhel lvm2 a--  <19.00g    0
  47. [root@station60 ~]# cat /proc/partitions
  48. major minor  #blocks  name

  49.    8        0   20971520 sda
  50.    8        1    1048576 sda1
  51.    8        2   19921920 sda2
  52.    8       16    1048576 sdb
  53.    8       19          0 sdb3
  54.    8       21     204800 sdb5
  55.    8       22     204800 sdb6
  56.   11        0    4391936 sr0
  57. 253        0   17821696 dm-0
  58. 253        1    2097152 dm-1
  59.    7        0    1048576 loop0
  60. [root@station60 ~]# fdisk /dev/sdb
  61. Welcome to fdisk (util-linux 2.23.2).

  62. Changes will remain in memory only, until you decide to write them.
  63. Be careful before using the write command.


  64. Command (m for help): p

  65. Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 sectors
  66. Units = sectors of 1 * 512 = 512 bytes
  67. Sector size (logical/physical): 512 bytes / 512 bytes
  68. I/O size (minimum/optimal): 512 bytes / 512 bytes
  69. Disk label type: dos
  70. Disk identifier: 0x01a7270d

  71.    Device Boot      Start         End      Blocks   Id  System
  72. /dev/sdb3            2048     2097151     1047552    5  Extended
  73. /dev/sdb5            4096      413695      204800   82  Linux swap / Solaris
  74. /dev/sdb6          415744      825343      204800   83  Linux

  75. Command (m for help): d
  76. Partition number (3,5,6, default 6): 3
  77. Partition 3 is deleted

  78. Command (m for help): p

  79. Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 sectors
  80. Units = sectors of 1 * 512 = 512 bytes
  81. Sector size (logical/physical): 512 bytes / 512 bytes
  82. I/O size (minimum/optimal): 512 bytes / 512 bytes
  83. Disk label type: dos
  84. Disk identifier: 0x01a7270d

  85.    Device Boot      Start         End      Blocks   Id  System

  86. Command (m for help): n
  87. Partition type:
  88.    p   primary (0 primary, 0 extended, 4 free)
  89.    e   extended
  90. Select (default p): p
  91. Partition number (1-4, default 1):
  92. First sector (2048-2097151, default 2048):
  93. Using default value 2048
  94. Last sector, +sectors or +size{K,M,G} (2048-2097151, default 2097151): +256M
  95. Partition 1 of type Linux and of size 256 MiB is set

  96. Command (m for help): t
  97. Selected partition 1
  98. Hex code (type L to list all codes): 8e
  99. Changed type of partition 'Linux' to 'Linux LVM'

  100. Command (m for help): n
  101. Partition type:
  102.    p   primary (1 primary, 0 extended, 3 free)
  103.    e   extended
  104. Select (default p): p
  105. Partition number (2-4, default 2):
  106. First sector (526336-2097151, default 526336):
  107. Using default value 526336
  108. Last sector, +sectors or +size{K,M,G} (526336-2097151, default 2097151): +256M
  109. Partition 2 of type Linux and of size 256 MiB is set

  110. Command (m for help): t
  111. Partition number (1,2, default 2):
  112. Hex code (type L to list all codes): 8e
  113. Changed type of partition 'Linux' to 'Linux LVM'

  114. Command (m for help): p

  115. Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 sectors
  116. Units = sectors of 1 * 512 = 512 bytes
  117. Sector size (logical/physical): 512 bytes / 512 bytes
  118. I/O size (minimum/optimal): 512 bytes / 512 bytes
  119. Disk label type: dos
  120. Disk identifier: 0x01a7270d

  121.    Device Boot      Start         End      Blocks   Id  System
  122. /dev/sdb1            2048      526335      262144   8e  Linux LVM
  123. /dev/sdb2          526336     1050623      262144   8e  Linux LVM

  124. Command (m for help): w
  125. The partition table has been altered!

  126. Calling ioctl() to re-read partition table.
  127. Syncing disks.
  128. [root@station60 ~]# pvcreate /dev/sdb{1,2}
  129. WARNING: dos signature detected on /dev/sdb1 at offset 510. Wipe it? [y/n]: y
  130.   Wiping dos signature on /dev/sdb1.
  131.   Physical volume "/dev/sdb1" successfully created.
  132.   Physical volume "/dev/sdb2" successfully created.
  133. [root@station60 ~]# pvs
  134.   PV         VG   Fmt  Attr PSize   PFree  
  135.   /dev/sda2  rhel lvm2 a--  <19.00g      0
  136.   /dev/sdb1       lvm2 ---  256.00m 256.00m
  137.   /dev/sdb2       lvm2 ---  256.00m 256.00m
  138. [root@station60 ~]# vgcreate vol0  /dev/sdb[12]
  139.   Volume group "vol0" successfully created
  140. [root@station60 ~]# pvs
  141.   PV         VG   Fmt  Attr PSize   PFree  
  142.   /dev/sda2  rhel lvm2 a--  <19.00g      0
  143.   /dev/sdb1  vol0 lvm2 a--  252.00m 252.00m
  144.   /dev/sdb2  vol0 lvm2 a--  252.00m 252.00m
  145. [root@station60 ~]# vgs
  146.   VG   #PV #LV #SN Attr   VSize   VFree  
  147.   rhel   1   2   0 wz--n- <19.00g      0
  148.   vol0   2   0   0 wz--n- 504.00m 504.00m
  149. [root@station60 ~]# vgdisplay  vol0
  150.   --- Volume group ---
  151.   VG Name               vol0
  152.   System ID            
  153.   Format                lvm2
  154.   Metadata Areas        2
  155.   Metadata Sequence No  1
  156.   VG Access             read/write
  157.   VG Status             resizable
  158.   MAX LV                0
  159.   Cur LV                0
  160.   Open LV               0
  161.   Max PV                0
  162.   Cur PV                2
  163.   Act PV                2
  164.   VG Size               504.00 MiB
  165.   PE Size               4.00 MiB
  166.   Total PE              126
  167.   Alloc PE / Size       0 / 0   
  168.   Free  PE / Size       126 / 504.00 MiB
  169.   VG UUID               lTte1h-UeX6-gpJu-I6YF-NxDh-aHZM-YUFRyB
  170.    
  171. [root@station60 ~]# vgremove /dev/vol0
  172.   Volume group "vol0" successfully removed
  173. [root@station60 ~]# vgcreate -s 16M  vol0  /dev/sdb[12]
  174.   Volume group "vol0" successfully created
  175. [root@station60 ~]# vgdisplay  vol0
  176.   --- Volume group ---
  177.   VG Name               vol0
  178.   System ID            
  179.   Format                lvm2
  180.   Metadata Areas        2
  181.   Metadata Sequence No  1
  182.   VG Access             read/write
  183.   VG Status             resizable
  184.   MAX LV                0
  185.   Cur LV                0
  186.   Open LV               0
  187.   Max PV                0
  188.   Cur PV                2
  189.   Act PV                2
  190.   VG Size               480.00 MiB
  191.   PE Size               16.00 MiB
  192.   Total PE              30
  193.   Alloc PE / Size       0 / 0   
  194.   Free  PE / Size       30 / 480.00 MiB
  195.   VG UUID               rFbSJL-mgbZ-PXfG-pXl1-cNgU-PbNM-T4qecJ
  196.    
  197. [root@station60 ~]# dd if=/dev/zero of=/dev/sdb2 bs=512 count=1
  198. 1+0 records in
  199. 1+0 records out
  200. 512 bytes (512 B) copied, 0.00253245 s, 202 kB/s
  201. [root@station60 ~]# pvs
  202.   PV         VG   Fmt  Attr PSize   PFree  
  203.   /dev/sda2  rhel lvm2 a--  <19.00g      0
  204.   /dev/sdb1  vol0 lvm2 a--  240.00m 240.00m
  205.   /dev/sdb2  vol0 lvm2 a--  240.00m 240.00m
  206. [root@station60 ~]# sync
  207. [root@station60 ~]# partprobe /dev/sdb
  208. [root@station60 ~]# sync
  209. [root@station60 ~]# pvs
  210.   PV         VG   Fmt  Attr PSize   PFree  
  211.   /dev/sda2  rhel lvm2 a--  <19.00g      0
  212.   /dev/sdb1  vol0 lvm2 a--  240.00m 240.00m
  213.   /dev/sdb2  vol0 lvm2 a--  240.00m 240.00m
  214. [root@station60 ~]# dd if=/dev/zero of=/dev/sdb2 bs=512 count=10
  215. 10+0 records in
  216. 10+0 records out
  217. 5120 bytes (5.1 kB) copied, 0.00273818 s, 1.9 MB/s
  218. [root@station60 ~]# pvs
  219.   WARNING: Device for PV S3U6Td-XCxI-yY3k-U5UH-xJka-Tz8e-aYTE2N not found or rejected by a filter.
  220.   Couldn't find device with uuid S3U6Td-XCxI-yY3k-U5UH-xJka-Tz8e-aYTE2N.
  221.   PV         VG   Fmt  Attr PSize   PFree  
  222.   /dev/sda2  rhel lvm2 a--  <19.00g      0
  223.   /dev/sdb1  vol0 lvm2 a--  240.00m 240.00m
  224.   [unknown]  vol0 lvm2 a-m  240.00m 240.00m
  225. [root@station60 ~]# vgs
  226.   WARNING: Device for PV S3U6Td-XCxI-yY3k-U5UH-xJka-Tz8e-aYTE2N not found or rejected by a filter.
  227.   Couldn't find device with uuid S3U6Td-XCxI-yY3k-U5UH-xJka-Tz8e-aYTE2N.
  228.   VG   #PV #LV #SN Attr   VSize   VFree  
  229.   rhel   1   2   0 wz--n- <19.00g      0
  230.   vol0   2   0   0 wz-pn- 480.00m 480.00m
  231. [root@station60 ~]# vgreduce  --remove-missing
  232.   No command with matching syntax recognised.  Run 'vgreduce --help' for more information.
  233.   Nearest similar command has syntax:
  234.   vgreduce --removemissing VG
  235.   Remove all missing PVs from a VG.

  236. [root@station60 ~]# man vgreduce  
  237. [root@station60 ~]# vgreduce  --removemissing
  238.   No command with matching syntax recognised.  Run 'vgreduce --help' for more information.
  239.   Nearest similar command has syntax:
  240.   vgreduce --removemissing VG
  241.   Remove all missing PVs from a VG.

  242. [root@station60 ~]# vgreduce  --removemissing   vol0
  243.   WARNING: Device for PV S3U6Td-XCxI-yY3k-U5UH-xJka-Tz8e-aYTE2N not found or rejected by a filter.
  244.   Couldn't find device with uuid S3U6Td-XCxI-yY3k-U5UH-xJka-Tz8e-aYTE2N.
  245.   Wrote out consistent volume group vol0.
  246. [root@station60 ~]# pvs
  247.   PV         VG   Fmt  Attr PSize   PFree  
  248.   /dev/sda2  rhel lvm2 a--  <19.00g      0
  249.   /dev/sdb1  vol0 lvm2 a--  240.00m 240.00m
复制代码
  1. [root@station60 ~]# lvextend -L +500M  /dev/vol0/lv1
  2.   Rounding size to boundary between physical extents: 512.00 MiB.
  3.   Size of logical volume vol0/lv1 changed from 208.00 MiB (13 extents) to 720.00 MiB (45 extents).
  4.   Logical volume vol0/lv1 successfully resized.
  5. [root@station60 ~]# vgdisplay vol0
  6.   --- Volume group ---
  7.   VG Name               vol0
  8.   System ID            
  9.   Format                lvm2
  10.   Metadata Areas        3
  11.   Metadata Sequence No  8
  12.   VG Access             read/write
  13.   VG Status             resizable
  14.   MAX LV                0
  15.   Cur LV                1
  16.   Open LV               0
  17.   Max PV                0
  18.   Cur PV                3
  19.   Act PV                3
  20.   VG Size               976.00 MiB
  21.   PE Size               16.00 MiB
  22.   Total PE              61
  23.   Alloc PE / Size       45 / 720.00 MiB
  24.   Free  PE / Size       16 / 256.00 MiB
  25.   VG UUID               rFbSJL-mgbZ-PXfG-pXl1-cNgU-PbNM-T4qecJ
  26.    
  27. [root@station60 ~]# lvreduce -L -500M  /dev/vol0/lv1
  28.   Rounding size to boundary between physical extents: 496.00 MiB.
  29.   WARNING: Reducing active logical volume to 224.00 MiB.
  30.   THIS MAY DESTROY YOUR DATA (filesystem etc.)
  31. Do you really want to reduce vol0/lv1? [y/n]: y
  32.   Size of logical volume vol0/lv1 changed from 720.00 MiB (45 extents) to 224.00 MiB (14 extents).
  33.   Logical volume vol0/lv1 successfully resized.
  34. [root@station60 ~]# lvreduce -L 200M  /dev/vol0/lv1
  35.   Rounding size to boundary between physical extents: 208.00 MiB.
  36.   WARNING: Reducing active logical volume to 208.00 MiB.
  37.   THIS MAY DESTROY YOUR DATA (filesystem etc.)
  38. Do you really want to reduce vol0/lv1? [y/n]: y
  39.   Size of logical volume vol0/lv1 changed from 224.00 MiB (14 extents) to 208.00 MiB (13 extents).
  40.   Logical volume vol0/lv1 successfully resized.
  41. [root@station60 ~]# lvs
  42.   LV   VG   Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  43.   root rhel -wi-ao---- <17.00g                                                   
  44.   swap rhel -wi-ao----   2.00g                                                   
  45.   lv1  vol0 -wi-a----- 208.00m                                                   
  46. [root@station60 ~]#
复制代码

列出SELinux上下文策略的命令:
  1. semanage fcontext -l
复制代码
/var/lib/samba/winbindd_privileged(/.*)?           all files          system_ubject_r:winbind_var_run





  1. semanage  fcontext -a -t samba_share_t '/sharedpath(/.*)?'
复制代码




回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-5-8 09:07 , Processed in 0.034010 second(s), 24 queries .

快速回复 返回顶部 返回列表