I have a DuoS and wish to extend the Linux partition to take advantage of the available space on the SD Card. Now perhaps that the wrong thing to and there is a better way to get a similar result.
I’ve tried with the Instructions for the Duo… and end up with an image that apparently does not boot.
Here is the file system.
root@milkv-duo]~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 752M 154M 556M 22% /
devtmpfs 159M 0 159M 0% /dev
tmpfs 159M 0 159M 0% /dev/shm
tmpfs 159M 124K 159M 1% /tmp
tmpfs 159M 40K 159M 1% /run
/dev/mmcblk0p1 128M 4.5M 124M 4% /boot
[root@milkv-duo]~# fdisk /dev/mmcblk0
Command (m for help): p
Disk /dev/mmcblk0: 14.84 GiB, 15931539456 bytes, 31116288 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: dos
Disk identifier: 0x00000000
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 * 1 262144 262144 128M c W95 FAT32 (LBA)
/dev/mmcblk0p2 262145 266240 4096 2M 0 Empty
/dev/mmcblk0p3 266241 1839104 1572864 768M 83 Linux
[root@milkv-duo]~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
mmcblk0 179:0 0 14.8G 0 disk
|-mmcblk0p1 179:1 0 128M 0 part /boot
|-mmcblk0p2 179:2 0 2M 0 part
`-mmcblk0p3 179:3 0 768M 0 part /
This is what I’ve tried… the board doesn’t come back from the reboot.
fdisk /dev/mmcblk0
d
3
n
p
3
[[[[ — 266241 ]]]]
+10G
w
reboot
resize2fs /dev/mmcblk0p3
Can anyone provide me with some guidance please.
1 Like
Ideally the filesystem should be unmounted when repartitioning and resizing. Meaning it cannot be done from the duo itself.
If you have a Linux computer resizing the image itself is easy. Otherwise you could attempt it in WSL.
You can also get a console on the duo via UART to see what is happening during boot.
Additionally, after resizing you can check for the validity of the filesystem using e2fsck
.
1 Like
Solved it.
When the doc says to make sure that that first sector number is the same… I mistakenly thought the default was the same as that first sector number… so the errors are my fault.
Posting details below for those that follow…
[root@milkv-duo]~# fdisk /dev/mmcblk0
Welcome to fdisk (util-linux 2.36.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/mmcblk0: 14.84 GiB, 15931539456 bytes, 31116288 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: dos
Disk identifier: 0x00000000
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 * 1 262144 262144 128M c W95 FAT32 (LBA)
/dev/mmcblk0p2 262145 266240 4096 2M 0 Empty
/dev/mmcblk0p3 266241 1839104 1572864 768M 83 Linux
Command (m for help): d
Partition number (1-3, default 3): 3
Partition 3 has been deleted.
Command (m for help): n
Partition type
p primary (2 primary, 0 extended, 2 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (3,4, default 3): 3
First sector (266241-31116287, default 268288): 266241
Last sector, +/-sectors or +/-size{K,M,G,T,P} (266241-31116287, default 31116287): +10G
Created a new partition 3 of type 'Linux' and of size 10 GiB.
Partition #3 contains a ext4 signature.
Do you want to remove the signature? [Y]es/[N]o: N
If it does not say that the partitions contains a signature - something has gone wrong
Command (m for help): w
The partition table has been altered.
Syncing disks.
[root@milkv-duo]~# fdisk -l
Disk /dev/mmcblk0: 14.84 GiB, 15931539456 bytes, 31116288 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: dos
Disk identifier: 0x00000000
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 * 1 262144 262144 128M c W95 FAT32 (LBA)
/dev/mmcblk0p2 262145 266240 4096 2M 0 Empty
/dev/mmcblk0p3 266241 21237759 20971519 10G 83 Linux
When rebooting - give it a couple of minutes
[root@milkv-duo]~# resize2fs /dev/mmcblk0p3
resize2fs 1.46.2 (28-Feb-2021)
Filesystem at /dev/mmcblk0p3 is mounted on /; on-line resizing required
old_desc_blocks = 3, new_desc_blocks = 40
The filesystem on /dev/mmcblk0p3 is now 10485756 (1k) blocks long.
[root@milkv-duo]~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 10G 148M 9.4G 2% /
devtmpfs 159M 0 159M 0% /dev
tmpfs 159M 0 159M 0% /dev/shm
tmpfs 159M 124K 159M 1% /tmp
tmpfs 159M 40K 159M 1% /run
/dev/mmcblk0p1 128M 4.5M 124M 4% /boot
Thank you for the assist
2 Likes
That worked perfectly. When I got to the new size question, I took the default which used the rest of the space on the device. Thanks for the explicit directions