Ubuntu新增ssh使用者

打開ssh登錄日誌

1
nano /etc/ssh/sshd_config

Ubuntu使用未分割的硬碟區域

因為 growpart 是用來擴展分割區(partition)的,但從你的 lsblk 輸出來看:

1
sdb       8:16   0    1T  0 disk /home

sdb 是整顆磁碟直接掛載/home,底下沒有任何分割區(沒有 sdb1 之類的)。所以 growpart 在這裡不適用。

如果你的目的是擴展 /home 的檔案系統(例如雲端供應商幫你把 sdb 從小容量擴大到 1T),你應該直接對整顆磁碟做 resize2fs(假設是 ext4):

1
2
3
4
5
# 先確認檔案系統類型
df -Th /home

# 如果是 ext4
sudo resize2fs /dev/sdb

這樣就能讓檔案系統擴展到磁碟的完整大小。

如果硬碟沒有分割區,可以用以下指令擴大硬碟區域:
https://unix.stackexchange.com/questions/643026/how-to-resize-a-disk-without-partition

首先查看系統是否已經辨識到新空間

1
fdisk -l /dev/<device>
1
2
# resize2fs /dev/[DISK_ID][PARTITION_NUMBER]
resize2fs /dev/sdc

https://tech.sars.tw/posts/gcp-linux-enlarge-disk-size/

https://www.tecmint.com/parted-command-create-linux-partitions/

https://godleon.github.io/blog/Linux/Linux-extend-lvm-from-unused-space/

LVM說明
https://linux.vbird.org/linux_basic_train/centos8/unit14.php

用systemd製作服務

可以用symble link的方式,將服務檔放到/etc/systemd/system/目錄下,讓systemd管理服務。

更改service檔後,需執行以下指令,讓systemd重新載入設定檔:

1
2
3
sudo systemctl daemon-reload
sudo systemctl enable appname
sudo systemctl start appname

移除服務:

1
2
3
4
5
6
7
systemctl stop [servicename]
systemctl disable [servicename]
rm /your/service/locations/[servicename]
# and symlinks that might be related
rm /your/service/locations/[servicename]
systemctl daemon-reload
systemctl reset-failed

查看服務整的log

1
journalctl -u appname

參考:
製作fastapi服務
設定檔重載
symbolic link
移除服務

Python執行tensorrt-engine

載入Region_TRT plugin

必須要載入libnvinfer_plugin,可以用python的trt.init_libnvinfer_plugins載入,

1
2
TRT_LOGGER = trt.Logger(trt.Logger.ERROR)
trt.init_libnvinfer_plugins(TRT_LOGGER,"")

https://docs.nvidia.com/deeplearning/tensorrt/api/python_api/infer/Plugin/IPluginRegistry.html#tensorrt.init_libnvinfer_plugins

印出目前已經載入的plugin

PLUGIN_CREATORS = trt.get_plugin_registry().plugin_creator_list
for plugin_creator in PLUGIN_CREATORS:
print(plugin_creator.name)

參考並修改:https://developer.nvidia.com/zh-cn/blog/tensorrt-custom-layer-cn/

tensorrt Region layer 說明書

https://docs.nvidia.com/deeplearning/tensorrt/api/c_api/structnvinfer1_1_1plugin_1_1_region_parameters.html#ad2c6bba4f07221add9b6d9abf0a4e312

inference範例參考:
https://leimao.github.io/blog/TensorRT-Python-Inference/