diff --git a/content/page/about/index.md b/content/page/about/index.md index 7a56bf3..d0369a7 100644 --- a/content/page/about/index.md +++ b/content/page/about/index.md @@ -1,6 +1,11 @@ --- title: 关于 -description: moonlightwatch,hearkenundermoon,轻聆月下,about,关于 +keywords: + - moonlightwatch + - hearkenundermoon + - 轻聆月下 + - about + - 关于 date: 2025-03-26 slug: about --- diff --git a/content/page/links/index.md b/content/page/links/index.md index f4d0979..6b3546f 100644 --- a/content/page/links/index.md +++ b/content/page/links/index.md @@ -2,14 +2,14 @@ title: 链接 slug: links links: - - title: GitHub - description: GitHub is the world's largest software development platform. - website: https://github.com - image: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png - - title: TypeScript - description: TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. - website: https://www.typescriptlang.org - image: ts-logo-128.jpg + - title: 星云软件工作室 + description: 星云软件工作室是在中华人民共和国注册的盈利性个体经济组织,主要业务涉及大数据与企业级私有云部署、物联网软件平台支持、应用软件及游戏开发。 + website: https://nebula-soft.com/ + image: https://nebula-soft.com/favicon.ico + # - title: TypeScript + # description: TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. + # website: https://www.typescriptlang.org + # image: ts-logo-128.jpg comments: false --- diff --git a/content/post/linux-swap/index.md b/content/post/linux-swap/index.md new file mode 100644 index 0000000..738b8a9 --- /dev/null +++ b/content/post/linux-swap/index.md @@ -0,0 +1,71 @@ +--- +title: Linux 创建交换文件 +description: 在Linux系统中创建交换文件并添加为交换分区 +date: 2025-03-26 +slug: linux-create-swapfile +image: swap_space.png +draft: true +keywords: + - linux + - swap +categories: + - +tags: + - linux + - operation +--- + + +# 一、创建swap文件 + +```bash +dd if=/dev/zero of=/swapfile1 bs=1024 count=524288 +``` + +创建 /swapfile1 ,大小为 512M。 计算方式是:`blocksize * count`,即 `1024 * 524288` + +创建文件也可以用 `fallocate` `命令,更加直观: + +```bash +fallocate -l 512M /swapfile1 +``` + +# 二、限制文件权限 + +仅给 root 用户读写权限即可 + +```bash +chown root:root /swapfile1 +chmod 0600 /swapfile1 +``` + +# 三、格式化文件 + +```bash +mkswap /swapfile1 +``` + + +# 四、启用swap文件 + +```bash +swapon /swapfile1 +``` + + +开机自动挂载,需要在 `/dev/fstab` 文件增加配置: + +```bash +/swapfile1 none swap sw 0 0 +``` + + +# 五、解除swap文件 + +```bash +swapoff /swapfile1 +``` + +如果不再需要swap文件,记得移除 `/dev/fstab` 文件里的swap文件配置。 + + diff --git a/content/post/linux-swap/swap_space.png b/content/post/linux-swap/swap_space.png new file mode 100644 index 0000000..aae322b Binary files /dev/null and b/content/post/linux-swap/swap_space.png differ