learning_doc

This commit is contained in:
dashan 2022-06-26 23:29:05 +08:00
parent f52e805a30
commit 9f86b9ad1f
27 changed files with 360 additions and 47 deletions

5
.obsidian/app.json vendored
View File

@ -1,4 +1,7 @@
{
"legacyEditor": false,
"attachmentFolderPath": "./assets"
"attachmentFolderPath": "./assets",
"newLinkFormat": "relative",
"useMarkdownLinks": true,
"newFileLocation": "current"
}

View File

@ -1,3 +1,3 @@
{
"baseFontSize": 21
"baseFontSize": 13
}

67
.obsidian/workspace vendored
View File

@ -1,19 +1,15 @@
{
"main": {
"id": "a32a17ad4cdacd00",
"id": "1c78de9b842f3d85",
"type": "split",
"children": [
{
"id": "7eb2511e30cd8b3a",
"id": "0a8ca340a6b98c99",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
<<<<<<< HEAD
"file": "git/gitlab/gitlab---create blank project and push.md",
=======
"file": "GIt 错误记录.md",
>>>>>>> test2
"file": "ubuntu/fdisk/linux 分区满了,如何进行扩容.md",
"mode": "source",
"source": false
}
@ -23,15 +19,15 @@
"direction": "vertical"
},
"left": {
"id": "f02df00dae391176",
"id": "b7f9cb940e0033b7",
"type": "split",
"children": [
{
"id": "7d6c46e25b82a62c",
"id": "02f1ba640fab0859",
"type": "tabs",
"children": [
{
"id": "914594b0e21a5aac",
"id": "3c2f1e60391ce1aa",
"type": "leaf",
"state": {
"type": "file-explorer",
@ -39,7 +35,7 @@
}
},
{
"id": "69a36f77ce322f8d",
"id": "1841eb746b6d7625",
"type": "leaf",
"state": {
"type": "search",
@ -57,27 +53,23 @@
}
],
"direction": "horizontal",
"width": 445
"width": 455
},
"right": {
"id": "e66ca0b0c34a1e7f",
"id": "beb34dc5a95aa22e",
"type": "split",
"children": [
{
"id": "1cd91799f12135b0",
"id": "f4afd477ae75ace8",
"type": "tabs",
"children": [
{
"id": "07f4554ee5b95f3d",
"id": "e29520e33bb22368",
"type": "leaf",
"state": {
"type": "backlink",
"state": {
<<<<<<< HEAD
"file": "git/gitlab/gitlab---create blank project and push.md",
=======
"file": "GIt 错误记录.md",
>>>>>>> test2
"file": "ubuntu/fdisk/linux 分区满了,如何进行扩容.md",
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical",
@ -95,30 +87,17 @@
"width": 300,
"collapsed": true
},
"active": "7eb2511e30cd8b3a",
"active": "0a8ca340a6b98c99",
"lastOpenFiles": [
<<<<<<< HEAD
"git/gitlab/gitlab---create blank project and push.md",
"front_end/vue/vue引入百度地图.md",
"front_end/vue/element upload手动文件上传多文件上传.md",
"front_end/vue/nodejs安装命令.md",
"front_end/js/js监听键盘键盘输入.md",
"elk/es、logstash安装.md",
"docker/Ubuntu20.04 安装Docker.md",
"docker/无损升级Docker容器的镜像版本.md",
"docker/重置portainer密码.md",
"docker/docker-compose 安装.md"
=======
"GIt 错误记录.md",
"docker/docker-compose 安装.md",
"docker/Ubuntu20.04 安装Docker.md",
"docker/无损升级Docker容器的镜像版本.md",
"docker/重置portainer密码.md",
"apps/vscode/VsCode-鼠标滑轮控制字体大小.md",
"vm/virtualbox/VirtualBox 搭建Ubuntu20.04.md",
"vm/virtualbox/assets/1650301557(1).png",
"vm/virtualbox/assets/1650303777(1).png",
"vm/virtualbox/assets/1650304260(1).png"
>>>>>>> test2
"ubuntu/fdisk/linux 分区满了,如何进行扩容.md",
"ubuntu/fdisk/嵌入式开发之 Vmware 虚拟机磁盘扩容.md",
"ubuntu/fdisk/assets/Pasted image 20220623023724.png",
"ubuntu/fdisk/assets/Pasted image 20220623023412.png",
"ubuntu/fdisk/assets/Pasted image 20220623023642.png",
"ubuntu/fdisk/assets/Pasted image 20220623023436.png",
"ubuntu/fdisk/assets/Pasted image 20220623023455.png",
"ubuntu/fdisk/assets/Pasted image 20220623023512.png",
"ubuntu/fdisk/assets/Pasted image 20220623023520.png",
"ubuntu/fdisk/assets/Pasted image 20220623023529.png"
]
}

View File

@ -0,0 +1,2 @@
## 创建新项目或导入项目时总是自动使用IDEA自带的maven 通过以下设置可以更改默认使用的版本
`File->New Projects Setup ->Settings for New Projects ->Build,Execution,Deployment->BuildTools->Maven->(Maven Home path,User settings,Local reposit)`

BIN
git/GIt push失败.pdf Normal file

Binary file not shown.

1
mysql/记录.md Normal file
View File

@ -0,0 +1 @@
##

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

View File

@ -0,0 +1,76 @@
> 本文由 [简悦 SimpRead](http://ksria.com/simpread/) 转码, 原文地址 [blog.csdn.net](https://blog.csdn.net/valage/article/details/73332147?spm=1001.2101.3001.6650.2&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-2-73332147-blog-122472846.pc_relevant_aa&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-2-73332147-blog-122472846.pc_relevant_aa&utm_relevant_index=5)
图片中可以看到[挂载](https://so.csdn.net/so/search?q=%E6%8C%82%E8%BD%BD&spm=1001.2101.3001.7020)点 “/” 的利用率移到 100%,空间不够,所以要对其进行分区。
![](assets/Pasted%20image%2020220623023219.png)
1.     先进入[虚拟机](https://so.csdn.net/so/search?q=%E8%99%9A%E6%8B%9F%E6%9C%BA&spm=1001.2101.3001.7020)设置里增大磁盘空间
注意:将 25 改成 50以扩大空间。这里一定要写比 25 大的数,因为他是 “增加到”50GB而不是 “增加了 25GB”
![](assets/Pasted%20image%2020220623023249.png)
2.     下图可以看到,硬盘空间增大为 53.7GB在设备那里可以看到有两个分区sda1 跟 sda2请忽略 sda3。接下来增加一个分区。
![](assets/Pasted%20image%2020220623023317.png)
键入命令:`fdish /dev/sda`
        键入m获取帮助
        键入n (增加分区)
键入p增加主分区
        键入:回车(起始跟结束扇区)
最后w(退出)
![](assets/Pasted%20image%2020220623023344.png)
>注意:“起始扇区” 那里直接回车,随便乱写容易造成空间浪费。
       现在系统就有 3 个分sda1,sda2,sda3
3.     创建物理卷
键入命令:`pvcreate /dev/sda3`
如果提示 sda3 找不到键入partprobe 或者重启虚拟机。
![](assets/Pasted%20image%2020220623023412.png)
4.     使用 `vgscan` 查询物理卷
4.1 可以查到本机物理卷名称为 “cl”
![](assets/Pasted%20image%2020220623023724.png)
4.2 使用新增物理卷扩展 cl
键入命令:`vgextendcl  /dev/sda3`
![](assets/Pasted%20image%2020220623023831.png)
5.     扩展 lv
键入命令:`lvextend -L +24G`  加上要扩展的分区名
![](assets/Pasted%20image%2020220623023902.png)
接着用 `dh f`,发现实际容量并没有变化,因为我们的系统还不认识刚刚添加进来的磁盘的文件系统,所以还需要对文件系统进行扩容。
键入:`xfs_growfs`  加上要扩展的分区名
或者
`resize2fs  f` 加 上要扩展的分区名
![](assets/Pasted%20image%2020220623023918.png)
参考链接:[http://blog.itpub.net/24486203/viewspace-1790666](http://blog.itpub.net/24486203/viewspace-1790666)
[http://blog.csdn.net/junglyfine/article/details/4974269](http://blog.csdn.net/junglyfine/article/details/4974269)
[http://www.linuxidc.com/Linux/2014-06/103839p4.htm](http://www.linuxidc.com/Linux/2014-06/103839p4.htm)
 ------20180409 更新 ----------------
最近又遇到要扩容的 centos 虚拟机,结果发现不能在增加分区了,才想起来当初装 centos 虚拟机的时候,手动分区分了太多区了,而一个系统只能挂 4 个分区。结果没办法时间紧重新装了一个,弄了整整一天!!回去要好好补下 linux 的知识,做一篇笔记。

View File

@ -0,0 +1,210 @@
> 本文由 [简悦 SimpRead](http://ksria.com/simpread/) 转码, 原文地址 [blog.csdn.net](https://blog.csdn.net/sanallen/article/details/78996253)
### 参考文档
1. [VMware 下 ubuntu 扩展磁盘空间](http://blog.csdn.net/openrd/article/details/51405884)
提示:
**本文档的适用范围为 Vmware+Ubuntu 的开发环境**
[嵌入式](https://so.csdn.net/so/search?q=%E5%B5%8C%E5%85%A5%E5%BC%8F&spm=1001.2101.3001.7020)开发中一般会使用 Vmware 中安装 Ubuntu 虚拟机来进行软件开发,为了提高虚拟机的磁盘性能推荐在创建虚拟机的时候采用预先分配磁盘的方式,如下图所示:
![](assets/Pasted%20image%2020220623023004.png)
如上图提示文字如果立即分配所有磁盘空间可以提高性能,但是随之带来的问题就是当创建[虚拟机](https://so.csdn.net/so/search?q=%E8%99%9A%E6%8B%9F%E6%9C%BA&spm=1001.2101.3001.7020)时的磁盘空间不够用时扩容比较麻烦。下面将具体分析在预先分配磁盘的情况如何进行磁盘扩容。
首先在预先分配磁盘空间的基础上再分配新的空间 (示例从 85GB 扩展 90GB)
![](assets/Pasted%20image%2020220623023043.png)
点击扩展按钮,经过一段比较长时间的等待之后新磁盘的分配申请工作已经完成,但是如界面提示 “扩展操作仅增加磁盘的大小,分区和文件系统的大小不受影响” 所示还需要进入到 [Ubuntu](https://so.csdn.net/so/search?q=Ubuntu&spm=1001.2101.3001.7020) 系统中进行文件系统分区的大小调整
**提示:所有 Ubuntu 分区相关操作需要在 root 用户下进行**
查看现有磁盘相关信息:**fdisk -l**
**建议记录现在的磁盘情况供之后重新分配分区参考**
```sh
root:~#fdisk -l
Disk /dev/sda: 90 GiB, 96636764160 bytes, 188743680 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x6a1fff92
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 174065663 174063616 83G 83 Linux
/dev/sda2 174067710 178255871 4188162 2G 5 Extended
/dev/sda5 174067712 178255871 4188160 2G 82 Linux swap / Solaris
```
从 fdisk 命令的信息来看可以发现 / dev/sda 的空间已经扩展为 90GiB但是 Ubuntu 下面的 / dev/sda1、/dev/sda2、/dev/sda5 分区依然是按照扩展前的 85GiB 来分布的,所以现在的思路是**先删除掉现有分区然后根据新的磁盘空间来重新创建分区**
关闭交换分区功能
```sh
root@ubuntu:# swapoff -a
```
确保交换分区已经关闭Swap 行全部为 0
```sh
root@ubuntu:# free -m
total used free shared buff/cache available
Mem: 1982 630 467 14 885 1110
Swap: 0 0 0
```
使用 fdisk 命令删除所有分区
```sh
root@ubuntu:~# fdisk /dev/sda
Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): d
Partition number (1,2,5, default 5): 1
Partition 1 has been deleted.
Command (m for help): d
Partition number (2,5, default 5): 2
Partition 2 has been deleted.
Command (m for help): p
Disk /dev/sda: 90 GiB, 96636764160 bytes, 188743680 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x6a1fff92
```
重新创建分区
```shell
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p):
Using default response p.
Partition number (1-4, default 1):
First sector (2048-188743679, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-188743679, default 188743679): 184555520
Created a new partition 1 of type 'Linux' and of size 88 GiB.
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p):
Using default response p.
Partition number (2-4, default 2):
First sector (184555521-188743679, default 184557568):
Last sector, +sectors or +size{K,M,G,T,P} (184557568-188743679, default 188743679):
Created a new partition 2 of type 'Linux' and of size 2 GiB.
Command (m for help): p
Disk /dev/sda: 90 GiB, 96636764160 bytes, 188743680 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x6a1fff92
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 184555520 184553473 88G 83 Linux
/dev/sda2 184557568 188743679 4186112 2G 83 Linux
```
这里 sda1 的 End 需要通过计算得到,计算方法为 / dev/sda 总 Sector 数 - 交换分区占用 Sector 数
```sh
/dev/sda总Sector数可以从之前保存的分区信息得到为188743680
交换分区占用Sector数为4188160
新的sda1分区的End位置为188743680-4188160=184555520
```
更新 sda2 分区的 Id
```sh
Command (m for help): t
Partition number (1,2, default 2):
Partition type (type L to list all types): 82
Changed type of partition 'Linux' to 'Linux swap / Solaris'.
Command (m for help): p
Disk /dev/sda: 90 GiB, 96636764160 bytes, 188743680 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x6a1fff92
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 184555520 184553473 88G 83 Linux
/dev/sda2 184557568 188743679 4186112 2G 82 Linux swap / Solaris
```
保存分区信息
```sh
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy
The kernel still uses the old table. The new table will be used at the next reboot or after you run
partprobe(8) or kpartx(8).
```
重启 Ubuntu 虚拟机
创建新的交换分区前关闭交换分区功能
```sh
root@ubuntu:# swapoff -a
```
更新交换分区的 UUID否则将无法正常使用交换分区功能
```sh
root@ubuntu:~# awk '/swap/ { print $1 }' /etc/fstab
#
UUID=d3dc807d-3d2b-477a-a77b-03b783b0317e
root@xiaoyalun:~# dd if=/dev/zero of=/dev/sda2
dd: writing to '/dev/sda2': No space left on device
4186113+0 records in
4186112+0 records out
2143289344 bytes (2.1 GB, 2.0 GiB) copied, 68.846 s, 31.1 MB/s
root@ubuntu:~# mkswap -U d3dc807d-3d2b-477a-a77b-03b783b0317e /dev/sda2
Setting up swapspace version 1, size = 2 GiB (2143285248 bytes)
no label, UUID=d3dc807d-3d2b-477a-a77b-03b783b0317e
```
首先是从 / etc/fstab 查询到新的 UUID通过 mkswap 命令创建新的交换分区
调整分区大小
```sh
root@ubuntu:~# resize2fs /dev/sda1
resize2fs 1.42.13 (17-May-2015)
Filesystem at /dev/sda1 is mounted on /; on-line resizing required
old_desc_blocks = 6, new_desc_blocks = 6
The filesystem on /dev/sda1 is now 23069184 (4k) blocks long.
```
至此虚拟机磁盘扩容已经完成

View File

@ -0,0 +1,43 @@
> 本文由 [简悦 SimpRead](http://ksria.com/simpread/) 转码, 原文地址 [blog.csdn.net](https://blog.csdn.net/weixin_40542512/article/details/101105433)
### 使用 VirtualBox 时,发现一个分区大小不够用,使用 resize 扩容,提示失败。
```cpp
D:\VirtualBox>VBoxManage modifyhd "D:\vx\docker1\docker1.vdi" --resize 15480
0%...
Progress state: VBOX_E_NOT_SUPPORTED
VBoxManage.exe: error: Failed to resize medium
VBoxManage.exe: error: Resizing to new size 16231956480 is not yet supported for medium 'D:\vx\docker1\docker1.vdi'
VBoxManage.exe: error: Details: code VBOX_E_NOT_SUPPORTED (0x80bb0009), component MediumWrap, interface IMedium
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleModifyMedium(struct HandlerArg *)" at line 768 of file VBoxManageDisk.cpp
```
### 解决方案
**在命令行先创建一个空的 vdi 虚拟机介质,创建时设置大小为扩容后的大小,然后使用克隆命令进行虚拟机介质克隆。**
**创建新虚拟介质命令**
```cpp
D:\VirtualBox>VBoxManage.exe createhd -filename "D:\vx\docker1\server2008r2_810g" -size 151920 -format VDI -variant Standard
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Medium created. UUID: aac9dd3f-ba41-46a8-bb49-c6559fef0360
```
**克隆命令**
```cpp
D:\VirtualBox>VBoxManage.exe clonehd "D:\vx\docker1\docker1.vdi" "D:\vx\docker1\server2008r2_810g.vdi" --existing
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone medium created in format 'VDI'. UUID: aac9dd3f-ba41-46a8-bb49-c6559fef0360
```
**此时原来的那个 docker1.vdi 已经克隆到 server2008r2_810g.vdi 了,再执行以下 VBoxManage modifyhd 命令即可。**
```cpp
D:\VirtualBox>VBoxManage modifyhd "D:\vx\docker1\server2008r2_810g.vdi" --resize 151920
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
```
>PS注意 - size -format 等命令它们前面貌似只能有一个空格否则会提示Syntax error: Invalid parameter '-format' .....

View File

@ -18,7 +18,6 @@
默认
![[Pasted image 20220419004014.png]]
默认
![[Pasted image 20220419004022.png]]

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB