coreos 增加新硬盘并更改docker存储位置

栏目: 服务器 · 发布时间: 7年前

内容简介:刚入手的coreos机器的第一件事就是更改docker image存储位置,以免image下的越来越多将系统盘撑爆。 所以需要新增加一块数据盘,专门用来存储docker image数据。如果看到helloworld镜像输出,并且/hdd1/docker出现docker metadata目录则说明修改成功

刚入手的coreos机器的第一件事就是更改docker image存储位置,以免image下的越来越多将系统盘撑爆。 所以需要新增加一块数据盘,专门用来存储docker image数据。

  • 格式化新硬盘
fdisk -l 确认新硬盘是否挂到机器上面,同时看一下新硬盘名称
假设 /dev/vdb是新硬盘.

   运行 fdisk /dev/vdb:对数据盘进行分区。
   输入 n 并按回车键:创建一个新分区。
   输入 p 并按回车键:选择主分区。因为创建的是一个单分区数据盘,所以只需要创建主分区。
   说明:如果要创建 4 个以上的分区,您应该创建至少一个扩展分区,即选择 e。
输入分区编号并按回车键。因为这里仅创建一个分区,可以输入 1。
输入第一个可用的扇区编号:按回车键采用默认值 1。
输入最后一个扇区编号:因为这里仅创建一个分区,所以按回车键采用默认值。
输入 wq 并按回车键,开始分区。
[root@iXXXXXXX ~]# fdisk /dev/vdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel  
Building a new DOS disklabel with disk identifier 0x5f46a8a2.  
Changes will remain in memory only, until you decide to write them.  
After that, of course, the previous content won't be recoverable.  
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)  
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to  
  switch off the mode (command 'c') and change display units to
  sectors (command 'u').
Command (m for help): n  
Command action  
e   extended  
p   primary partition (1-4)  
p  
Partition number (1-4): 1  
First cylinder (1-41610, default 1): 1  
Last cylinder, +cylinders or +size{K,M,G} (1-41610, default 41610):  
Using default value 41610  
Command (m for help): wq  
The partition table has been altered!  
Calling ioctl() to re-read partition table.  
Syncing disks.
  • 确认分区成功
fdisk -l 如果出现:  
Device Boot      Start         End      Blocks   Id  System  
/dev/vdb1               1       41610    20971408+  83  Linux
表示成功
  • 创建文件系统
mkfs.ext4 /dev/vdb1
  • 挂载文件系统
mkdir /hdd1  
mount /dev/vdb1 /hdd1
touch /etc/docker/daemon.json

`
{
    "graph": "/hdd1/docker",
    "storage-driver": "overlay"
}
`
  • 重启&验证
systemctl restart docker 

docker run -it --rm hello-world

如果看到helloworld镜像输出,并且/hdd1/docker出现docker metadata目录则说明修改成功


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

A Philosophy of Software Design

A Philosophy of Software Design

John Ousterhout / Yaknyam Press / 2018-4-6 / GBP 14.21

This book addresses the topic of software design: how to decompose complex software systems into modules (such as classes and methods) that can be implemented relatively independently. The book first ......一起来看看 《A Philosophy of Software Design》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具