clips 3

运维向 1

设置时区并开启 ntp 1

systemd 篇 alarm 好像并没有自动同步时间,要我们手动设置下(
依旧是 systemd 全家桶

timedatectl set-timezone Asia/Taipei
timedatectl set-ntp true
timedatectl show-timesync
timedatectl status

设置时区并开启 ntp 2

chrony 篇

接 systemd 篇 在一些场景中, chrony 可能是不太够用的,比如说我想本地搭建个 ntp 服务器,systemd 这样的简易 ntp 客户端是做不了的。
这里我们使用 chrony 进行更深一步设置。
安装就自己玩了, apt / pacman / yum 应该都有。
配置文件在 /etc/chrony.conf 注释其实很详细。
首先设定 server :

root@cn-mahiru /etc# cat /etc/chrony.conf 
server 114.118.7.161
server 114.118.7.163
server cn.ntp.org.cn

server 106.55.184.199
server ntp.tuna.tsinghua.edu.cn
server 203.107.6.88
server ntp1.aliyun.com
server ntp2.aliyun.com
server ntp3.aliyun.com
server ntp4.aliyun.com
server ntp5.aliyun.com
server ntp1.tencent.com
server ntp2.tencent.com
server ntp3.tencent.com
server ntp4.tencent.com
server ntp5.tencent.com

查看服务状态

大概随便看看,这里是备忘

开机时刻的启动任务

systemctl list-jobs

目前运行服务

systemctl list-units --type service

状态

systemctl status systemd-networkd
journalctl -u systemd-networkd
journalctl -fu systemd-networkd

修改服务

不知道为什么网传都是直接改文件,还要 daemon-reload 好麻烦

# 为原来服务增加个 override 也就是覆盖项
systemctl edit systemd-networkd
# 修改完整的文件
systemctl edit systemd-networkd --full
# 带 --force 为新建不存在的服务
systemctl edit systemd-networkd --full --force
# 查看服务文件
systemctl cat systemd-networkd

转换分区格式为 btrfs

参考 https://wiki.archlinuxcn.org/wiki/Btrfs btrfs 是什么就不用过多介绍了吧(
btrfs-progs 本身是有个转换程序 btrfs-convert 的,直接开跑就好。

首先看看目标硬盘有没有被挂载:

df -h
umount /dev/xxx1

然后开跑:

btrfs-convert /dev/xxx1

我 1T hdd 大概等了1个半小时,在这期间没有输出。

然后看看 fstab:

root@cn ~ [1]# cat /etc/fstab 
# 其它的略
/dev/sda1 /storage btrfs defaults 0 0

把 ext4 改成 btrfs

然后重启 systemd-daemon

systemctl daemon-reload
systemctl list-units --type mount # 看看挂载点的服务名字是什么
systemctl start storage.mount

确定数据都没问题的话,最后删除 ext4 快照

btrfs subvolume delete ext2_saved
btrfs balance start /storage

以下是可选步骤

然后 metadata dup 一下:

btrfs balance start -mconvert=DUP /挂载点