服务器sata-raid混用模式下热插拔磁盘扩容

用的是惠普dl360服务器,增加了几块磁盘后,发现ubuntu中看不到。

新增6块:
2块保留sata模式
4块组成raid6

查看物理磁盘信息

lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0    7:0    0     4K  1 loop /snap/bare/5
loop1    7:1    0  63.4M  1 loop /snap/core20/1974
loop2    7:2    0  63.9M  1 loop /snap/core20/2182
loop3    7:3    0  73.9M  1 loop /snap/core22/858
loop4    7:4    0 237.2M  1 loop /snap/firefox/2987
loop5    7:5    0 349.7M  1 loop /snap/gnome-3-38-2004/143
loop6    7:6    0 485.5M  1 loop /snap/gnome-42-2204/120
loop7    7:7    0   497M  1 loop /snap/gnome-42-2204/141
loop8    7:8    0  91.7M  1 loop /snap/gtk-common-themes/1535
loop9    7:9    0  12.3M  1 loop /snap/snap-store/959
loop10   7:10   0  53.3M  1 loop /snap/snapd/19457
loop11   7:11   0  40.4M  1 loop /snap/snapd/20671
loop12   7:12   0   452K  1 loop /snap/snapd-desktop-integration/83
sda      8:0    0   2.2T  0 disk 
sdb      8:16   0 238.5G  0 disk 
├─sdb1   8:17   0   512M  0 part /boot/efi
└─sdb2   8:18   0   238G  0 part /var/snap/firefox/common/host-hunspell
                                 /
sdc      8:32   0 745.2G  0 disk 
sdd      8:48   0 745.2G  0 disk 
sde      8:64   0   512M  1 disk 
└─sde1   8:65   0 509.8M  1 part /media/zcj/VID

格式化

# 格式化成 Ext4
mkfs.ext4 /dev/vdb1
​
# 格式化为 XFS
apt install xfsprogs
mkfs.xfs /dev/vdb2
​
# 格式化为 Btrfs
apt install btrfs-progs
mkfs.btrfs /dev/vdb3

这里我们选择xfs

sudo mkfs.xfs /dev/sdc
meta-data=/dev/sdc               isize=512    agcount=4, agsize=48838262 blks
         =                       sectsz=4096  attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=0
         =                       reflink=1    bigtime=0 inobtcount=0
data     =                       bsize=4096   blocks=195353046, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=95387, version=2
         =                       sectsz=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
Discarding blocks...Done.

临时挂载

普通单xfs 磁盘

mount -t xfs /dev/sdc /disk2

raid磁盘

sudo mkfs.xfs /dev/sda
mkfs.xfs: /dev/sda appears to contain a partition table (gpt).
mkfs.xfs: Use the -f option to force overwrite.

这里提示无法挂载,有gpt分区表,因为确认是新raid,我们选择强制格式化,加-f参数:
sudo mkfs.xfs -f /dev/sda

df -h 查看挂载结果

永久挂载

vim /etc/fstab

/swapfile                                 none            swap    sw              0       0
/dev/sdc        /disk2          xfs     defaults         0       0
/dev/sdd        /disk3           xfs    defaults          0        0

生效查看:
mount -a

brew git错误

fatal: not in a git directory
Error: Command failed with exit 128: git

首先 网上说的那个git config 是没用的,我是在brew -v 正常的情况下,出现这个错误的,

所以,继续搜索...

解决:
执行 brew doctor,然后按照提示,把所有的warnning消除掉,然后就正常了

brew doctor
Your system is ready to brew.

brew update --verbose
Checking if we need to fetch /opt/homebrew/Homebrew...
Fetching /opt/homebrew/Homebrew...
Checking if we need to fetch formula.jws.json...
Checking if we need to fetch cask.jws.json...
Checking if we need to fetch formula_tap_migrations.jws.json...
Checking if we need to fetch cask_tap_migrations.jws.json...
Already up-to-date.

m1 macbook(arm版通用)安装brew

安装:
cd /opt/homebrew/

/bin/zsh -c "$(curl -fsSL https://gitee.com/huwei1024/HomebrewCN/raw/master/Homebrew.sh)"

消除告警:
git config --global --add safe.directory /opt/homebrew/Homebrew/Library/Taps/homebrew/homebrew-core git config --global --add safe.directory /opt/homebrew/Homebrew/Library/Taps/homebrew/homebrew-cask

最后将brew路径写入shell配置 .zshrc
export PATH=$PATH:/opt/homebrew/bin

linux(ubuntu)下运行shadowsocks客户端

最终一键脚本:ssc-1key-linux

系统: Ubuntu 22.04

shadowsocks相关

  1. 将系统更新到最新版
  2. 安装shadowsocks及必要组件
    pip install https://github.com/shadowsocks/shadowsocks/archive/master.zip -U
    sudo apt-get install -y libsodium*
  3. 配置shadowsocks client
    sudo vi /etc/shadowsocks.json
{
  "server": "您服务器地址",
  "server_port": 9999,
  "local_address": "127.0.0.1",
  "local_port": 1080,
  "password": "密码",
  "timeout": 600,
  "method": "aes-256-cfb"
}
  1. 解决sodium库问题
    sudo ln -s /usr/lib/x86_64-linux-gnu/libsodium.a /usr/lib/x86_64-linux-gnu/liblibsodium.a

  2. 设置路径权限
    sudo chmod 777 /var/log
    sudo chmod 777 /var/run

  3. shadowsocks 开机自启动
    sudo vim /etc/systemd/system/shadowsocks.service:

    Description=Shadowsocks Client Service
    After=network.target
    [Service]
    Type=simple
    User=root
    ExecStart=/usr/local/bin/sslocal -c /etc/shadowsocks.json restart
    [Install]
    WantedBy=multi-user.target

    systemctl enable shadowsocks.service

HTTP全局代理

实现全局代理,我们可以使用polipo

  1. polipo 安装
    wget http://archive.ubuntu.com/ubuntu/pool/universe/p/polipo/polipo_1.1.1-8_amd64.deb
    安装 sudo dpkg -i polipo_1.1.1-8_amd64.deb
    配置 vi /etc/polipo/config

    logSyslog = true
    logFile = /var/log/polipo/polipo.log
    proxyAddress = "0.0.0.0"
    socksParentProxy = "127.0.0.1:1080"
    socksProxyType = socks5
    chunkHighMark = 50331648
    objectHighMark = 16384
    serverMaxSlots = 64
    serverSlots = 16
    serverSlots1 = 32

    polipo安装后会自动运行。

  2. 通过polipo设置本地http代理

    export http_proxy=http://127.0.0.1:8123
    export https_proxy=http://127.0.0.1:8123

    取消代理
    unset http_proxy
    unset https_proxy

pac代理

如果想使用http下的pac机制,可以考虑用provoxy替换polipo

  1. provoxy 安装
    安装:sudo apt-get install -y privoxy
    cp /etc/privoxy/config /etc/privoxy/config.bak
    vim /etc/privoxy/config
    确保 listen-address 127.0.0.1:8118 打开
    在/etc/profile, ~/.bashrc,~/.bash_profile 中添加:

    proxy="http://127.0.0.1:8118"
    export https_proxy=$proxy
    export http_proxy=$proxy
    export ftp_proxy=$proxy

    systemctl enable privoxy
    systemctl restart privoxy

  2. GFWList2Privoxy 制作pac条目
    pip install gfwlist2privoxy
    添加自定义域名:在生成的gfwlist.action文件中添加需要通过proxy访问的域名
    使pac生效:在/etc/privoxy/config文件中加上actionsfile gfwlist.action,然后重启privoxy服务

issue shooting:

  1. AttributeError: module 'collections' has no attribute 'MutableMapping'
    解决:/home/zcj/.local/lib/python3.10/site-packages/shadowsocks/lru_cache.py 34行 MutableMapping前面加上abc.
  2. [Errno 2] No such file or directory: b'liblibsodium.a'
    解决:sudo ln -s /usr/lib/x86_64-linux-gnu/libsodium.a /usr/lib/x86_64-linux-gnu/liblibsodium.a

参考:

  1. https://github.com/enpenguc/linux-backup/blob/master/doc/Ubuntu%20Server%E5%AE%89%E8%A3%85shadowsocks%E5%AE%A2%E6%88%B7%E7%AB%AF.md

燕尾蝶

凭着些许的记忆,我找到了《燕尾蝶》,那是少年时的震撼,一直萦绕于心,趁这个春节有空,得以找到资源。重温后,却感觉些许的迷茫,一种破碎记忆的感觉,时间太久远了,记忆已经模糊,感觉就是印象中的故事,又感觉有些生疏,因为印象中没有这么多细节,我只记依稀得移民,黑社会,各种混杂的语言,昏暗的画面。。。

一时恍惚。

我又仔细搜索了下,着实找不到第二个能对的上记忆的影片,只能悻悻道,可能就是它吧。

人的记忆是会变的,趁年轻,多写些记忆吧。

如何在windows中模拟arm64安卓系统

quem efi:

https://releases.linaro.org/reference-platform/enterprise/17.12/uefi/release/qemu-aarch64/QEMU_EFI.fd

安卓 iso:

https://developers.google.cn/android/images?hl=zh-cn#crosshatch

quem

pacman 所需的msys2 安装

https://www.qemu.org/download/#windows

For 64 bit Windows 8.1 or above (in UCRT64):

pacman -S mingw-w64-ucrt-x86_64-qemu
qemu-img --version
qemu-img version 8.2.0
Copyright (c) 2003-2023 Fabrice Bellard and the QEMU Project developers

qemu-system-aarch64

debian下安装docker后无法使用

安装后提示:
docker is already the newest version (1.5-2)

但是运行docker 命令提示找不到。

然后重新安装:
curl -sSL https://get.docker.com/ | sudo sh
提示:
The repository 'https://download.docker.com/linux/ubuntu bookworm Release' does not have a Release file.

cd /etc/apt/sources.list.d/

发现有个 archive_uri-https_download_docker_com_linux_ubuntu-bookworm.list

rm archive_uri-https_download_docker_com_linux_ubuntu-bookworm.list
删除后再执行,就正常了。

Client: Docker Engine - Community
 Version:           25.0.3
 API version:       1.44
 Go version:        go1.21.6
 Git commit:        4debf41
 Built:             Tue Feb  6 21:14:25 2024
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          25.0.3
  API version:      1.44 (minimum version 1.24)
  Go version:       go1.21.6
  Git commit:       f417435
  Built:            Tue Feb  6 21:14:25 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.28
  GitCommit:        ae07eda36dd25f8a1b98dfbf587313b99c0190bb
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

gitlab配置

看日志:
gitlab-ctl tail

看运行状态:
gitlab-ctl status

配置:
vi /etc/gitlab/gitlab.rb
打开屏蔽,然后 gitlab-ctl reconfigure

网上的一份最简配置

external_url 'http://git.xxx.com'
gitlab_rails['time_zone'] = 'Asia/Shanghai'

# 关闭电子邮件相关功能
gitlab_rails['smtp_enable'] = false
gitlab_rails['gitlab_email_enabled'] = false
gitlab_rails['incoming_email_enabled'] = false

# Terraform
gitlab_rails['terraform_state_enabled'] = false

# Usage Statistics
gitlab_rails['usage_ping_enabled'] = false
gitlab_rails['sentry_enabled'] = false
grafana['reporting_enabled'] = false

# 关闭容器仓库功能
gitlab_rails['gitlab_default_projects_features_container_registry'] = false
gitlab_rails['registry_enabled'] = false
registry['enable'] = false
registry_nginx['enable'] = false

# 包仓库
gitlab_rails['packages_enabled'] = false
gitlab_rails['dependency_proxy_enabled'] = false

# GitLab KAS
gitlab_kas['enable'] = false
gitlab_rails['gitlab_kas_enabled'] = false

# Mattermost
mattermost['enable'] = false
mattermost_nginx['enable'] = false

# Kerberos
gitlab_rails['kerberos_enabled'] = false
sentinel['enable'] = false

# GitLab Pages
gitlab_pages['enable'] = false
pages_nginx['enable'] = false

# 禁用 PUMA 集群模式
puma['worker_processes'] = 0
puma['min_threads'] = 1
puma['max_threads'] = 2

# 降低后台守护进程并发数
sidekiq['max_concurrency'] = 5

gitlab_ci['gitlab_ci_all_broken_builds'] = false
gitlab_ci['gitlab_ci_add_pusher'] = false

# 关闭监控
prometheus_monitoring['enable'] = false
alertmanager['enable'] = false
node_exporter['enable'] = false
redis_exporter['enable'] = false
postgres_exporter['enable'] = false
pgbouncer_exporter['enable'] = false
gitlab_exporter['enable'] = false
grafana['enable'] = false
sidekiq['metrics_enabled'] = false