kk Blog —— 通用基础


date [-d @int|str] [+%s|"+%F %T"]
netstat -ltunp
sar -n DEV 1

LVM 输出更多信息

显示PE到LE的映射, 即PE的使用情况

1
pvdisplay -m /dev/sdd1

https://www.cnblogs.com/useradd/p/10005211.html

显示LVM信息常用 pvs,lvs,vgs 命令,如果想显示详细信息可以使用 pvdisplay ,vgdisplay ,lvdisplay,其中前面命令仅用于简单输出 lvm 对象相关信息,可以格式化输出;第二种命令会详细显示 lvm 对像信息,但不易于格式化输出。

1
2
3
pvs  # 显示物理卷(pv)信息
vgs   # 显示逻辑卷组(vg)信息
lvs   # 显示逻辑卷(lv)信息

显示额外信息

1
2
3
pvs -v
vgs -v
lvs -v

只显示 pv_name,dev_size 字段

1
2
3
4
[root@redhat6 lvm]# pvs -o pv_name,dev_size
  PV         DevSize
  /dev/sda2   14.51g
  /dev/sdb     4.00g

增加 -o 参数,指定需要输出的字段。

在pvs 默认输出上,增加字段

1
2
3
4
[root@redhat6 lvm]# pvs -o +pv_uuid
  PV         VG         Fmt  Attr PSize  PFree PV UUID                              
  /dev/sda2  vg_redhat6 lvm2 a--  14.51g    0  dpTW84-DHRy-PIA9-u1tY-YUH4-XQKw-8Hy2Zm
  /dev/sdb   vg_redhat6 lvm2 a--   4.00g 2.81g YKIQwX-zc6H-TZ65-P3qr-sRfk-LX0p-T18vdG

如果想在默认输出的前提下增加字段,可以使用 -o + 字段名。

vgs 显示卷组成员

1
2
3
4
5
[root@redhat6 lvm]# vgs -o +lv_name
  VG         #PV #LV #SN Attr   VSize  VFree LV
  vg_redhat6   2   3   0 wz--n- 18.50g 2.81g lv_root
  vg_redhat6   2   3   0 wz--n- 18.50g 2.81g lv_swap
  vg_redhat6   2   3   0 wz--n- 18.50g 2.81g lv_pgdata_01

字段排序

根据 lv_size 字段排序

1
2
3
4
5
[root@redhat6 lvm]# lvs -O lv_size
  LV           VG         Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  lv_pgdata_01 vg_redhat6 -wi-ao 700.00m
  lv_swap      vg_redhat6 -wi-ao   1.91g
  lv_root      vg_redhat6 -wi-ao  13.10g

如果想根据输出字段排序,可以使用 -O 字段名 选项。

附 lvs,vgs,pvs 字段

4.1 lvs 字段

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
lv_all               - All fields in this section.
lv_uuid              - Unique identifier.
lv_name              - Name.  LVs created for internal use are enclosed in brackets.
lv_path              - Full pathname for LV.
lv_attr              - Various attributes - see man page.
lv_major             - Persistent major number or -1 if not persistent.
lv_minor             - Persistent minor number or -1 if not persistent.
lv_read_ahead        - Read ahead setting in current units.
lv_kernel_major      - Currently assigned major number or -1 if LV is not active.
lv_kernel_minor      - Currently assigned minor number or -1 if LV is not active.
lv_kernel_read_ahead - Currently-in-use read ahead setting in current units.
lv_size              - Size of LV in current units.
seg_count            - Number of segments in LV.
origin               - For snapshots, the origin device of this LV.
origin_size          - For snapshots, the size of the origin device of this LV.
snap_percent         - For snapshots, the percentage full if LV is active.
copy_percent         - For mirrors and pvmove, current percentage in-sync.
move_pv              - For pvmove, Source PV of temporary LV created by pvmove.
convert_lv           - For lvconvert, Name of temporary LV created by lvconvert.
lv_tags              - Tags, if any.
mirror_log           - For mirrors, the LV holding the synchronisation log.
modules              - Kernel device-mapper modules required for this LV.

4.2 pvs 字段

1
2
3
4
5
6
7
8
9
10
11
pv_all               - All fields in this section.
pe_start             - Offset to the start of data on the underlying device.
pv_size              - Size of PV in current units.
pv_free              - Total amount of unallocated space in current units.
pv_used              - Total amount of allocated space in current units.
pv_attr              - Various attributes - see man page.
pv_pe_count          - Total number of Physical Extents.
pv_pe_alloc_count    - Total number of allocated Physical Extents.
pv_tags              - Tags, if any.
pv_mda_count         - Number of metadata areas on this device.
pv_mda_used_count    - Number of metadata areas in use on this device.

4.3 vgs 字段

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
vg_all               - All fields in this section.
vg_fmt               - Type of metadata.
vg_uuid              - Unique identifier.
vg_name              - Name.
vg_attr              - Various attributes - see man page.
vg_size              - Total size of VG in current units.
vg_free              - Total amount of free space in current units.
vg_sysid             - System ID indicating when and where it was created.
vg_extent_size       - Size of Physical Extents in current units.
vg_extent_count      - Total number of Physical Extents.
vg_free_count        - Total number of unallocated Physical Extents.
max_lv               - Maximum number of LVs allowed in VG or 0 if unlimited.
max_pv               - Maximum number of PVs allowed in VG or 0 if unlimited.
pv_count             - Number of PVs.
lv_count             - Number of LVs.
snap_count           - Number of snapshots.
vg_seqno             - Revision number of internal metadata.  Incremented whenever it changes.
vg_tags              - Tags, if any.
vg_mda_count         - Number of metadata areas on this VG.
vg_mda_used_count    - Number of metadata areas in use on this VG.
vg_mda_free          - Free metadata area space for this VG in current units.
vg_mda_size          - Size of smallest metadata area for this VG in current units.
vg_mda_copies        - Target number of in use metadata areas in the VG.

LVM 缩减 VG 大小 ( pvmove )

显示PE到LE的映射, 即PE的使用情况

1
pvdisplay -m /dev/sdd1

https://www.systutorials.com/docs/linux/man/8-pvmove/

https://www.linuxcool.com/pvmove

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Move all physical extents that are used by simple LVs on the specified PV to free physical extents elsewhere in the VG.
pvmove /dev/sdb1

Use a specific destination PV when moving physical extents.
pvmove /dev/sdb1 /dev/sdc1

Move extents belonging to a single LV.
pvmove -n lvol1 /dev/sdb1 /dev/sdc1

Rather than moving the contents of an entire device, it is possible to move a range of physical extents, for example numbers 1000 to 1999 inclusive on the specified PV.
pvmove /dev/sdb1:1000-1999

A range of physical extents to move can be specified as start+length. For example, starting from PE 1000. (Counting starts from 0, so this refers to the 1001st to the 2000th PE inclusive.)
pvmove /dev/sdb1:1000+1000

Move a range of physical extents to a specific PV (which must have sufficient free extents).
pvmove /dev/sdb1:1000-1999 /dev/sdc1

Move a range of physical extents to specific new extents on a new PV.
pvmove /dev/sdb1:1000-1999 /dev/sdc1:0-999

If the source and destination are on the same disk, the anywhere allocation policy is needed.
pvmove --alloc anywhere /dev/sdb1:1000-1999 /dev/sdb1:0-999

The part of a specific LV present within in a range of physical extents can also be picked out and moved.
pvmove -n lvol1 /dev/sdb1:1000-1999 /dev/sdc1

https://www.cnblogs.com/useradd/p/10005212.html

pvmove 命令用来将一块盘上的数据移到另一块盘,可以移动整块盘的数据,也可以移动指定 extent 范围的数据, 接下来演示 pvmove 的一个例子,下面这个例子的 VG 由三个 PV 组成,我们想将其中一个 PV 的数据移动其它 PV中,空闲的PV 可以用来创建新的 VG。

1 显示 pv 使用信息

1
2
3
4
5
 [root@redhat6 ~]# pvs -o+pv_used
  PV         VG         Fmt  Attr PSize  PFree Used  
  /dev/sda2  vg_redhat6 lvm2 a--  14.51g    0   14.51g
  /dev/sdb   vg_redhat6 lvm2 a--   4.00g 2.62g   1.38g
  /dev/sdc   vg_redhat6 lvm2 a--   6.00g 5.60g 404.00m

从上面看出,有三块 pv

2 移动 /dev/sdb 数据到 /dev/sdc 盘上

1
2
3
4
5
6
7
8
[root@redhat6 ~]# pvmove /dev/sdb /dev/sdc
  /dev/sdb: Moved: 0.8%
  /dev/sdb: Moved: 28.3%
  /dev/sdb: Moved: 42.5%
  /dev/sdb: Moved: 57.2%
  /dev/sdb: Moved: 72.8%
  /dev/sdb: Moved: 92.6%
  /dev/sdb: Moved: 100.0%

上述命令将 /dev/sdb 文件移动 /dev/sdc 上。

3 再次查看 pv 信息

1
2
3
4
5
[root@redhat6 ~]# pvs -o+pv_used
  PV         VG         Fmt  Attr PSize  PFree Used 
  /dev/sda2  vg_redhat6 lvm2 a--  14.51g    0  14.51g
  /dev/sdb   vg_redhat6 lvm2 a--   4.00g 4.00g     0
  /dev/sdc   vg_redhat6 lvm2 a--   6.00g 4.22g  1.77g

从上面看出 /dev/sdb 盘使用空间为 0,说明空间被腾出。

4 将 /dev/sdb 从 VG vg_redhat6 中移出

1
2
3
4
5
6
7
8
[root@redhat6 ~]# vgreduce /dev/vg_redhat6 /dev/sdb 
  Removed "/dev/sdb" from volume group "vg_redhat6" 

[root@redhat6 ~]# pvs
  PV         VG         Fmt  Attr PSize  PFree
  /dev/sda2  vg_redhat6 lvm2 a--  14.51g    0
  /dev/sdb              lvm2 a--   4.00g 4.00g
  /dev/sdc   vg_redhat6 lvm2 a--   6.00g 4.22g 

根据pvs 信息, /dev/sdb 已经不是 VG vg_redhat6 的成员了。 那么 /dev/sdb 盘可以移除,或者它用。

5 在 /dev/sdb 上创建新的 VG

1
2
3
4
5
6
[root@redhat6 ~]# vgcreate vg_pgroot  /dev/sdb
  Volume group "vg_pgroot" successfully created
[root@redhat6 ~]# vgs
  VG         #PV #LV #SN Attr   VSize  VFree
  vg_pgroot    1   0   0 wz--n-  4.00g 4.00g
  vg_redhat6   2   4   0 wz--n- 20.50g 4.22g

6 再次查看 PV /dev/sdb 信息

1
2
3
4
5
[root@redhat6 ~]# pvs
  PV         VG         Fmt  Attr PSize  PFree
  /dev/sda2  vg_redhat6 lvm2 a--  14.51g    0
  /dev/sdb   vg_pgroot  lvm2 a--   4.00g 4.00g
  /dev/sdc   vg_redhat6 lvm2 a--   6.00g 4.22g

/dev/sdb 已经是 VG vg_pgroot 的成员了。

Chrome浏览器使用Overrides调试线上代码

https://blog.csdn.net/qq_42961150/article/details/123499276

2. 创建文件夹

在自己电脑任何地方创建一个空的文件夹,比如:我在桌面上创建了一个test文件夹。

3. 打开浏览器开发者工具

f12可打开浏览器开发者工具,找到Sources=>Overrides=>+Select folder for overrides选择文件,找到创建的test文件夹,记住不要双击进文件夹,直接单击选择,然后下面窗口下面的选择文件夹即可。

注意: 选择了文件夹后,浏览器上方会有个提示,点击允许。点击允许后,选择的文件夹就会显示在浏览器里面。

4. 打开线上源码

找到线上需要调试的代码,一般都是在network里面找到需要修改的文件,然后选中文件,在右边可以显示出读取的源码,然后鼠标右击选择菜单中的Open in Sources panel,就会自动转到刚刚选择文件夹的界面。

5. 编辑代码

编辑源码,比如我在源码中增加了一行代码,然后ctrl+s直接保存,就可以看到左侧test文件夹中就多了一个文件夹,里面就是保存的就是web.html到本地。

6. 刷新页面,看效果

刷新,就可以看到console控制台中多了一行打印,说明已经实现了该功能。