admin 管理员组文章数量: 887021
最近买了个魔百盒的盒子,老是出现空间不足的问题,毕竟ROM容量才8个G,刚好我也有这方面的需求的解决之后将方案整理,分享给大家。
当出现: Warning: Stopping docker.service, but it can still be activated by:docker.socket类似这中错误时,这是 Docker 在关闭状态下被访问自动唤醒机制,意味如果试图连接到 docker socket,而 docker 服务没有运行,系统将自动启动docker。执行下面这句即可 systemctl stop docker.socket 之后在U盘挂载的目录新建一个文件夹
之后编辑 /etc/docker/daemon.json 配置文件,如果没有这个文件,那么需要自己创建一个, 根据上面的迁移目录,基础配置如下:(首先看下有没有这个属性,有的话将后面引号里的改成上面新建的新挂载目录) |
下面的可以不用看:下面的方法没试验成功
刚刷完的盒子可用空间很小需要扩容根分区才可以使用
root@armbian:~# df -Th
Filesystem Type Size Used Avail Use% Mounted on
udev devtmpfs 845M 0 845M 0% /dev
tmpfs tmpfs 196M 3.3M 193M 2% /run
/dev/sda2 ext4 2.4G 1.3G 1.1G 55% /
tmpfs tmpfs 977M 0 977M 0% /dev/shm
tmpfs tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs tmpfs 977M 12K 977M 1% /tmp
/dev/sda1 vfat 252M 102M 150M 41% /boot
/dev/zram1 ext4 49M 2.3M 43M 5% /var/log
tmpfs tmpfs 196M 0 196M 0% /run/user/0
查看块设备
root@armbian:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 1 57.7G 0 disk
├─sda1 8:1 1 255M 0 part /boot
└─sda2 8:2 1 2.5G 0 part /
mmcblk2 179:0 0 7.3G 0 disk
mmcblk2boot0 179:32 0 4M 1 disk
mmcblk2boot1 179:64 0 4M 1 disk
zram0 254:0 0 977M 0 disk [SWAP]
zram1 254:1 0 50M 0 disk /var/log
开始扩容
fdisk /dev/sda
查看空闲空间
Command (m for help): F
Unpartitioned space /dev/sda: 54.98 GiB, 59039023616 bytes, 115310593 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
Start End Sectors Size
2048 8191 6144 3M
530432 532479 2048 1M
5775360 121077760 115302401 55G
查看根所使用的分区的开始和结束扇区并记录
Command (m for help): p
Disk /dev/sda: 57.73 GiB, 61991813632 bytes, 121077761 sectors
Disk model: DataTraveler 3.0
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xc92bbf76
Device Boot Start End Sectors Size Id Type
/dev/sda1 8192 530431 522240 255M c W95 FAT32 (LBA)
/dev/sda2 532480 5775359 5242880 2.5G 83 Linux
删除分区
Command (m for help): d
Partition number (1,2, default 2): 2
Partition 2 has been deleted.
创建分区
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2): 2
First sector (2048-121077760, default 2048): 532480
Last sector, +/-sectors or +/-size{K,M,G,T,P} (532480-121077760, default 121077760):
Created a new partition 2 of type 'Linux' and of size 57.5 GiB.
Partition #2 contains a ext4 signature.
Do you want to remove the signature? [Y]es/[N]o: Y
The signature will be removed by a write command.
保存退出
Command (m for help): w
The partition table has been altered.
Syncing disks.
这个时候查看分区大小还没变化
root@armbian:/# df -Th
Filesystem Type Size Used Avail Use% Mounted on
udev devtmpfs 845M 0 845M 0% /dev
tmpfs tmpfs 196M 5.7M 190M 3% /run
/dev/sda2 ext4 2.4G 1.3G 1.1G 55% /
tmpfs tmpfs 977M 0 977M 0% /dev/shm
tmpfs tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs tmpfs 977M 12K 977M 1% /tmp
/dev/sda1 vfat 252M 102M 150M 41% /boot
/dev/zram1 ext4 49M 3.1M 42M 7% /var/log
tmpfs tmpfs 196M 0 196M 0% /run/user/0
重新设置分区大小
resize2fs /dev/sda2
再次查看已经变成57G了
root@armbian:/# df -Th
Filesystem Type Size Used Avail Use% Mounted on
udev devtmpfs 845M 0 845M 0% /dev
tmpfs tmpfs 196M 8.2M 188M 5% /run
/dev/sda2 ext4 57G 1.3G 56G 3% /
tmpfs tmpfs 977M 0 977M 0% /dev/shm
tmpfs tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs tmpfs 977M 12K 977M 1% /tmp
/dev/sda1 vfat 252M 102M 150M 41% /boot
/dev/zram1 ext4 49M 3.2M 42M 8% /var/log
tmpfs tmpfs 196M 0 196M 0% /run/user/0
版权声明:本文标题:刷完Armbian的盒子后根目录空间太小解决方案 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.freenas.com.cn/jishu/1725889017h887850.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论