修改R329的Armbian镜像包
挂载镜像
加载到loop
sudo losetup -P /dev/loop404 ./Armbian_21.08.0-trunk_Maixsense_bullseye_edge_5.14.0.img
挂载到文件系统
sudo mkdir /tmp/r329 && cd /tmp/r329 && sudo mount /dev/loop404p1 ./
结果
(base) lithromantic➜/tmp/r329» ls [19:43:55]
bin dev home lost+found mnt proc run selinux sys usr
boot etc lib media opt root sbin srv tmp var
修改文件
sudo touch test &&sudo chmod 777 test &&sudo echo hello sipeed! > test
卸载镜像
cd .. && sudo umount /tmp/r329 &&sudo losetup -d /dev/loop404 &&sudo rm -rf r329
烧录镜像测试
root@maixsense:/# ls
bin dev home lost+found mnt proc run selinux sys tmp var
boot etc lib media opt root sbin srv test usr
root@maixsense:/# cat test
hello sipeed!
扩容镜像
创建空镜像
sudo dd if=/dev/zero of=./add.img bs=1M count=480
追加到磁盘末尾
cat add.img >> Armbian_21.08.0-trunk_Maixsense_bullseye_edge_5.14.0.img
加载到loop
sudo losetup -P /dev/loop404 ./Armbian_21.08.0-trunk_Maixsense_bullseye_edge_5.14.0.img
调整分区大小
(base) ubuntu➜ ~ ᐅ sudo fdisk /dev/loop404
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): d
Selected partition 1
Partition 1 has been deleted.
#新增分区
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1):
#设置扇区起始
First sector (2048-6930431, default 2048): 8192
Last sector, +/-sectors or +/-size{K,M,G,T,P} (8192-6930431, default 6930431):
Created a new partition 1 of type 'Linux' and of size 3.3 GiB.
Partition #1 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.
Calling ioctl() to re-read partition table.
Syncing disks.
修复分区
(base) ubuntu➜ ~ ᐅ sudo e2fsck -fyC 0 /dev/loop404p1
log
e2fsck 1.45.7 (28-Jan-2021)
ext2fs_open2: Bad magic number in super-block
e2fsck: Superblock invalid, trying backup blocks...
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Free blocks count wrong for group #0 (26835, counted=23970).
Fix? yes
Free blocks count wrong for group #1 (32585, counted=10).
Fix? yes
Free blocks count wrong for group #2 (32768, counted=0).
Fix? yes
Free blocks count wrong for group #3 (32585, counted=957).
Fix? yes
Free blocks count wrong for group #4 (32768, counted=0).
Fix? yes
Free blocks count wrong for group #5 (32585, counted=0).
Fix? yes
Free blocks count wrong for group #6 (32768, counted=0).
Fix? yes
Free blocks count wrong for group #7 (32585, counted=1368).
Fix? yes
Free blocks count wrong for group #8 (32768, counted=985).
Fix? yes
Free blocks count wrong for group #9 (32585, counted=0).
Fix? yes
Free blocks count wrong for group #10 (16384, counted=0).
Fix? yes
Free blocks count wrong for group #11 (32768, counted=0).
Fix? yes
Free blocks count wrong for group #12 (32768, counted=0).
Fix? yes
Free blocks count wrong for group #13 (32768, counted=2).
Fix? yes
Free blocks count wrong for group #14 (32768, counted=0).
Fix? yes
Free blocks count wrong for group #15 (32768, counted=15530).
Fix? yes
Free blocks count wrong for group #16 (30255, counted=27599).
Fix? yes
Free blocks count wrong for group #17 (32768, counted=934).
Fix? yes
Free blocks count wrong for group #18 (32768, counted=503).
Fix? yes
Free blocks count wrong for group #19 (32768, counted=0).
Fix? yes
Free blocks count wrong for group #20 (32768, counted=0).
Fix? yes
Free blocks count wrong for group #21 (32768, counted=19484).
Fix? yes
Free blocks count wrong (716655, counted=112846).
Fix? yes
Free inodes count wrong for group #0 (5701, counted=4).
Fix? yes
Directories count wrong for group #0 (2, counted=698).
Fix? yes
Free inodes count wrong for group #1 (5712, counted=0).
Fix? yes
Directories count wrong for group #1 (0, counted=217).
Fix? yes
Free inodes count wrong for group #2 (5712, counted=0).
Fix? yes
Directories count wrong for group #2 (0, counted=619).
Fix? yes
Free inodes count wrong for group #3 (5712, counted=0).
Fix? yes
Directories count wrong for group #3 (0, counted=449).
Fix? yes
Free inodes count wrong for group #4 (5712, counted=0).
Fix? yes
Directories count wrong for group #4 (0, counted=392).
Fix? yes
Free inodes count wrong for group #5 (5712, counted=2).
Fix? yes
Directories count wrong for group #5 (0, counted=184).
Fix? yes
Free inodes count wrong for group #6 (5712, counted=4597).
Fix? yes
Directories count wrong for group #6 (0, counted=40).
Fix? yes
Free inodes count wrong for group #16 (5712, counted=0).
Fix? yes
Directories count wrong for group #16 (0, counted=945).
Fix? yes
Free inodes count wrong for group #17 (5712, counted=0).
Fix? yes
Directories count wrong for group #17 (0, counted=923).
Fix? yes
Free inodes count wrong for group #18 (5712, counted=0).
Fix? yes
Directories count wrong for group #18 (0, counted=489).
Fix? yes
Free inodes count wrong for group #19 (5712, counted=0).
Fix? yes
Directories count wrong for group #19 (0, counted=197).
Fix? yes
Free inodes count wrong for group #20 (5712, counted=3518).
Fix? yes
Directories count wrong for group #20 (0, counted=38).
Fix? yes
Free inodes count wrong (131365, counted=70953).
Fix? yes
/dev/loop404p1: ***** FILE SYSTEM WAS MODIFIED *****
/dev/loop404p1: 60423/131376 files (0.3% non-contiguous), 6295
扩展分区大小
(base) ubuntu➜ ~ ᐅ sudo resize2fs -p /dev/loop404p1
resize2fs 1.45.7 (28-Jan-2021)
Resizing the filesystem on /dev/loop404p1 to 865280 (4k) blocks.
Begin pass 1 (max = 4)
Extending the inode table XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The filesystem on /dev/loop404p1 is now 865280 (4k) blocks long.
卸载镜像
sudo losetup -d /dev/loop404