【转载】linux 环境下如何通过 fdisk 进行已有磁盘分区扩容

这篇文章基本是之前老东家公司上班时候一直用的linux磁盘扩容,采用fdisk,后边改成了parted进行扩容。 这里也顺便记录一下用fdisk扩容方法。

注意:未防止意外发生,请提前备份要操作的磁盘,避免操作失败导致数据丢失。

[root@localhost ~]# df -lh    //查看扩容分区所在的硬盘名称,这里以home对应的/dev/sdb1 为例。
 
文件系统              容量  已用 可用 已用% 挂载点
/dev/sda1             9.7G  2.6G  6.7G  28% /
tmpfs                 252M     0  252M   0% /dev/shm
/dev/sdb1             9.9G  172M  9.2G   2% /home
 
[root@localhost ~]# fdisk /dev/sdb    //输入fdisk /dev/sdb 请确认扩容分区对应的硬盘名称,以免误删其他分区!
 
The number of cylinders for this disk is set to 41610.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): d    //输入d删除分区
Selected partition 1     //显示要删除的分区号,因为只有一个分区,所以显示1
Command (m for help): n    //输入n新建分区
Command action
   e   extended
   p   primary partition (1-4)
p                                               //输入p,选择要操作的项目
Partition number (1-4): 1    //输入要新建的分区号,这里输入1
First cylinder (1-41610, default 1):    //选择要截止的磁盘位置,这里直接按回车,全部增加。
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-41610, default 41610):   //直接按回车。
Using default value 41610
Command (m for help): w    //输入w保存设置
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
查看全文

Docker 安装 Portainer

下载选定的Portainer镜像,这里我们选择下载量最多的官方镜像,如果未指定版本则默认为最新版本,latest版本

docker pull portainer/portainer-ce

运行镜像

本机模式

docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock --restart=always --name prtainer portainer/portainer-ce
查看全文