doorxp

Blog

Openwrt opkg install 空间不够, 扩空间

注意固件,不同的略有不同

https://downloads.openwrt.org/releases/21.02.1/targets/x86/64/openwrt-21.02.1-x86-64-generic-ext4-combined-efi.img.gz

generic-ext4-combined-efi.img.gz

Resizing Ext4 rootfs

Resize Ext4 rootfs for ext4-combined.img.gz:


1.工具准备


opkg update
opkg install fdisk losetup resize2fs f2fs-tools lsblk


lsblk 查看分区信息, 不必须安装

resize2fs 改变分区表后,文件系统还看不到,用于调整文件系统

losetup  用resize2fs之前要挂着分区到/dev/loop0

fdisk 调整分区信息



2.使用fdisk调整分区


root@OpenWrt:~# fdisk -l
GPT PMBR size mismatch (246846 != 250069679) will be corrected by write.
The backup GPT table is not on the end of the device.
Disk /dev/sda: 119.24 GiB, 128035676160 bytes, 250069680 sectors
Disk model: XINRICH SSD 128G
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: gpt
Disk identifier: C58D873D-8AB8-7349-EA70-2AB0E496B700
Device      Start    End Sectors  Size Type
/dev/sda1     512  33279   32768   16M EFI System
/dev/sda2   33792 246783  212992  104M Microsoft basic data
/dev/sda128    34    511     478  239K BIOS boot
Partition table entries are not in disk order.


看回显,/dev/sda: 119.24 GiB, 而/dev/sda2只有104M, 接下来修改分区信息


root@OpenWrt:~# fdisk /dev/sda
Welcome to fdisk (util-linux 2.36.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): i
Partition number (1,2,128, default 128):2
 Device: /dev/sda2
          Start: 33792
            End: 246783
        Sectors: 212992
           Size: 104M
           Type: Microsoft basic data
      Type-UUID: EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
           UUID: C58D873D-8AB8-7349-EA70-2AB0E496B702
Command (m for help): p
Disk /dev/sda: 119.24 GiB, 128035676160 bytes, 15138816 sectors
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: gpt
Disk identifier: C58D873D-8AB8-7349-EA70-2AB0E496B700
Device     Boot Start    End Sectors  Size Id Type
/dev/sda1     512  33279   32768   16M EFI System
/dev/sda2   33792 246783  212992  104M Microsoft basic data
/dev/sda128    34    511     478  239K BIOS boot
Command (m for help): d
Partition number (1,2, default 2): 
Partition 2 has been deleted.
Command (m for help): n
Partition number (2-4, default 2): 
First sector (33280-250069646, default 34816): 33792
Last sector, +sectors or +size{K,M,G,T,P} (33792-250069646, default 250069646): 
Created a new partition 2 of type 'Linux' and of size 7.2 GiB.
Partition #2 contains a ext4 signature.
Do you want to remove the signature? [Y]es/[N]o: n
Command (m for help): w
The partition table has been altered.
Syncing disks.


#到此分区表已经调整完成,但是文件系统还看不到大小改变,不能用,先不管,我们先修正分区UUID,和分区类型UUID


root@OpenWrt:~# fdisk /dev/sda
Command (m for help):t
Partition number (1,2,128, default 128):2
Partition type or alias (type L to list all):EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
#回车提示修改分区类型UUID成功,接下来修正分区UUID
Command (m for help):x
Command (m for help):u
Partition number (1,2,128, default 128): 2
New UUID (in 8-4-4-4-12 format):C58D873D-8AB8-7349-EA70-2AB0E496B702
Command (m for help): w
The partition table has been altered.
Syncing disks.


#以上操作,让系统启动时,看到的系统配置还是以前的配置

#接下来,调整文件系统,调整好后我们就可以看到和使用


losetup /dev/loop0 /dev/sda2
fsck.ext4 -y /dev/loop0
resize2fs /dev/loop0
reboot


发表评论:

«   2024年1月   »
1234567
891011121314
15161718192021
22232425262728
293031
控制面板
您好,欢迎到访网站!
  查看权限
网站分类
搜索
最新留言

    Powered By Z-BlogPHP 1.5.1 Zero

    Copyright doorxp.com Rights Reserved.