v831 dd镜像制做及扩容脚本的使用

准备工作

linux操作系统电脑一台

Windows操作系统电脑一台

读卡器一枚

512M tf卡一张

PhoenixCard v4.26

balenaEtcher

Maix Ⅱ dock

resize.sh

resize_root.sh

烧录镜像

首先获取原始镜像下载站 - Sipeed,解压后使用PhoenixCard 烧录到tf卡中。

然后将tf卡插入linux操作系统电脑中。

导出镜像:sudo dd if=/dev/sdb of=dd.img status=progress

导出dd镜像后,使用fdisk修改分区信息。

~ fdisk dd.img    

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.
#删除分区5
Command (m for help): d 
Partition number (1-5, default 5): 

Partition 5 has been deleted.
#删除分区4
Command (m for help): d
Partition number (1-4, default 4): 4

Partition 4 has been deleted.
#新增分区4
Command (m for help): n
Partition number (4-8, default 4): 
#设置起始扇区
First sector (225792-983036, default 227328): 225792
#设置大小300M
Last sector, +/-sectors or +/-size{K,M,G,T,P} (225792-983036, default 983036): +300M

Created a new partition 4 of type 'Linux filesystem' and of size 299.8 MiB.
删除分区文件系统签名
Partition #4 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.

制作dd镜像,将reseze_root.sh,dd.img 放到同一个文件夹中,使用./resize_root.sh ./dd.img ./ v831.img将dd.img转化为v831.img.xz

(base) ~ ❯ ./resize_root.sh ./dd.img ./ v831.img
input_addr=./dd.img,output_addr=./, name is v831.img

you can run xx.sh <intputaddr> <outputaddr> <name> to specify them or use defult
Such as 
dd.sh ./dd.img /root test.img 
or
dd.sh ./dd.img
losetup: /dev/loop404: detach failed: No such device or address

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): -: unknown command

Command (m for help): 

Command (m for help): 
Expert command (m for help): Partition number (1-4, default 4): 
New name: 
Partition name changed from '' to 'rootfs'.

Expert command (m for help): Partition number (1-4, default 4): 
New UUID (in 8-4-4-4-12 format): 
Partition UUID changed from 0B8BFEAD-2829-554C-9E98-73EEBA7EB79B to A0085546-4166-744A-A353-FCA9272B8E48.

Expert command (m for help): 
Command (m for help): The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or partx(8).

e2fsck 1.45.7 (28-Jan-2021)
ext2fs_open2: Bad magic number in super-block
e2fsck: Superblock invalid, trying backup blocks...
Backing up journal inode block information.

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 (0, counted=8324).
Fix? yes

Free inodes count wrong (0, counted=1872).                                     
Fix? yes

Padding at end of inode bitmap is not set. Fix? yes


/dev/loop404p4: ***** FILE SYSTEM WAS MODIFIED *****
/dev/loop404p4: 4144/6016 files (0.0% non-contiguous), 42876/51200 blocks
resize2fs 1.45.7 (28-Jan-2021)
Resizing the filesystem on /dev/loop404p4 to 76736 (4k) blocks.
The filesystem on /dev/loop404p4 is now 76736 (4k) blocks long.

Compressing the mirror takes some time, and you can use <progress -m> at other terminals to see progress
all ok,use xz -dc v831.img.xz |sudo dd of=/dev/sdb bs=1M status=progress oflag=direct to create a tf Startup Disk
(base) ~ ❯ 

现在得到了v831.img.xz,将该文件移动到windows操作系统电脑上,通过balenaEtcher烧录到另外一张大一些的卡里

扩容磁盘大小

resize.sh导入到Maix Ⅱ dock中。

执行resize.sh,按照提示进行即可。

上一篇:unbuntu安装pycharm


下一篇:第k小的数值对