Hi,
Losetup does not show anything when I type
losetup -l, etc. I am trying to find the offset of the root partition so I can attempt to resize it.
Is there another way of finding the offset of a partition
Thanks,
Aaron
Hi,
Losetup does not show anything when I type
losetup -l, etc. I am trying to find the offset of the root partition so I can attempt to resize it.
Is there another way of finding the offset of a partition
Thanks,
Aaron
fdisk or cfdisk?
fdisk! I will try cfdisk.
Edit: Neither work!
What doesn't work?
Disk: /dev/mmcblk0
Size: 28.86 GiB, 30989615104 bytes, 60526592 sectors
Label: dos, identifier: 0x36a1832e
Device Boot Start End Sectors Size Id Type
>> Free space 2048 8191 6144 3M
/dev/mmcblk0p1 * 8192 139263 131072 64M c W95 FAT32 (LBA)
Free space 139264 147455 8192 4M
/dev/mmcblk0p2 147456 60526591 60379136 28.8G 83 Linux
fdisk: cannot open /dev/loop1: Not a tty
nor
cfdisk: cannot open /dev/loop1: Not a tty
Which device is this? And what is mounted?
ubus call system board; mount
ubus call system board; mount
{
"kernel": "5.10.161",
"hostname": "OpenWrt",
"system": "ARMv8 Processor rev 4",
"model": "Bananapi BPI-R64",
"board_name": "bananapi,bpi-r64",
"rootfs_type": "squashfs",
"release": {
"distribution": "OpenWrt",
"version": "22.03.3",
"revision": "r20028-43d71ad93e",
"target": "mediatek/mt7622",
"description": "OpenWrt 22.03.3 r20028-43d71ad93e"
}
}
/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
/dev/mmcblk1p66 on /overlay type f2fs (rw,lazytime,noatime,background_gc=on,discard,no_heap,user_xattr,inline_xattr,inline_data,inline_dentry,flush_merge,extent_cache,mode=adaptive,active_logs=6,alloc_mode=reuse,fsync_mode=posix)
overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work)
tmpfs on /dev type tmpfs (rw,nosuid,noexec,noatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,noatime,mode=600,ptmxmode=000)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)
none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,noatime,mode=700)
pstore on /sys/fs/pstore type pstore (rw,noatime)
Try with the correct argument cfdisk /dev/mmcblk1
That gives me the following
Disk: /dev/mmcblk1
Size: 29.72 GiB, 31914983424 bytes, 62333952 sectors
Label: gpt, identifier: 5452574F-2211-4433-5566-778899AABB00
Device Start End Sectors Size Type
/dev/mmcblk1p1 1024 2047 1024 512K Linux filesystem
Free space 2048 4095 2048 1M
/dev/mmcblk1p2 4096 8191 4096 2M EFI System
/dev/mmcblk1p3 8192 10239 2048 1M Linux filesystem
Free space 10240 12287 2048 1M
/dev/mmcblk1p4 12288 77823 65536 32M Linux filesystem
/dev/mmcblk1p5 77824 92159 14336 7M Linux filesystem
>> /dev/mmcblk1p6 92160 305151 212992 104M unknown
/dev/mmcblk1p7 305152 509951 204800 100M Linux filesystem
/dev/mmcblk1p128 34 1023 990 495K BIOS boot
Free space 509952 62333918 61823967 29.5G
Where is the offset?
The offset from the beginning of the disk? That is the start.
I need to locate the offset for the root partition (/dev/mmcblk1p6, I think)
I am wanting to expand the roots to use the remainder of the space on the sd card 29.6GB.
By the looks of it, you can only expand mmcblk1p7
Well, that is a waste of sd card space.
Try moving partition 128 to the end of the storage, using gparted, then see if you device still boots.
Try both moving partition 128 and copying and recreation mmcblk1p6 using gparted but then the device failed to boot both times.
Edit:
even using the disk utility it did not like partition 6 being resized! it too failed to boot after that.
Just tried this code and it appears that it could work although, I have no idea why the offset it not being returned?
It looks like your R64 setup does not use a loop device for the writable part of the overlay filesystem so using losetup
does not apply.
Systems using losetup
show a loop device in the mount
command output like:
/dev/loop0 on /overlay type f2fs (rw,noatime)
Your mount
command shows:
/dev/mmcblk1p66 on /overlay type f2fs (rw,lazytime,noatime,background_gc=on,discard,no_heap,user_xattr,inline_xattr,inline_data,inline_dentry,flush_merge,extent_cache,mode=adaptive,active_logs=6,alloc_mode=reuse,fsync_mode=posix)
It looks like you found help for resizing the rootfs_data
on an emmc installation in this other thread:
EDIT: rootfs_data
and not rootfs
.
So I should try resizing the Rootfs after installing emmc?
Oops! I shared rootfs
when it is really rootfs_data
. Sorry!
I will edit the previous post and correct it.
I won't suggest what you should or should not do. I just pointed out what looks like a solution to have access to more space on storage.
My recommendation is to not use emmc for frequently updated data like log files, database files, other frequently written files as on-board raw nand and nor flash implementations don't have wear leveling like the integrated controllers on sd cards and usb flash drives have. Once failed, the on-board flash storage tends to be unusable.
If the instruction in the other thread are not good for your use-case:
If you want to install more packages, my recommendation is to use the "Customize installed packages" option on the firmware selector site:
https://firmware-selector.openwrt.org/?version=22.03.3&target=mediatek%2Fmt7622&id=bananapi_bpi-r64
The writable area of /overlay/ is still created with 100 Megabytes of free space and you have to download/install an upgrade image anyways with each upgrade.
I tested a custom build for the R64 and it generates all six of the production image types, all under a minute :-).
Only the "Kernel" (recovery) image is not included. I think that is because it is not customized and is always available as the standard build.
If you want more space for logs or application data, I recommend mounting a partition on inexpensive and easily replaced storage meant for frequent writes like a usb disk, usb flash drive, or even a good quality sd-card.
Share what your end goal is, that is - what your use case is for having more storage and we can provide you with the appropriate recommendation and probably detailed help.