X86: Extending Storage

Hi

I have replaced my router and added Samsaung SSD. But when I try to resize the storage I am getting error. I followed instructions as told here.

https://openwrt.org/docs/guide-user/installation/openwrt_x86

I am getting error when executing below line.

losetup -o ${OFFSET} /dev/loop1 /dev/sda2

My guess the OFFSET value tried to assign returns nothing ( OFFSET="$(losetup -n -O OFFSET /dev/loop0)" )

I appreciate your help on this.

Thanks
Badri M

Check the output:

lsblk -o +FSTYPE,UUID; losetup -l

And if ran manually ?

I am getting below output when executing the command.

root@OpenWrt:/etc# lsblk -o +FSTYPE,UUID; losetup -l
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT FSTYPE UUID
loop1    7:1    0 232.9G  0 loop
sda      8:0    0 232.9G  0 disk
├─sda1   8:1    0    16M  0 part /boot      ext4   84173db5-fa99-e35a-95c6-28613cc79ea9
└─sda2   8:2    0 232.9G  0 part /          ext4   ff313567-e9f1-5a5d-9895-3ba130b4a864
NAME       SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE DIO LOG-SEC
/dev/loop1         0  33792         0  0 /dev/sda2   0     512
root@OpenWrt:/etc#

I am getting empty line when executing manually

Thanks
Badri M

Try Expanding the squashfs file system - #4 by luisglass

or fire up gparted.

You need to follow the latter part of the instruction:
https://openwrt.org/docs/guide-user/installation/openwrt_x86#resizing_filesystem

I am getting below error when execute the resize2fs command.

root@OpenWrt:/etc#  resize2fs /dev/sda2
resize2fs 1.45.6 (20-Mar-2020)
Filesystem at /dev/sda2 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 15
Performing an on-line resize of /dev/sda2 to 61045422 (4k) blocks.
resize2fs: Invalid argument While trying to add group #1
root@OpenWrt:/etc#

Update: Above issue got fixed after router rebook. But when executing resize command connection getting reset and its taking lot of time. Any suggestions?

Thanks
Badri M

Don't ever run fsck on a mounted filesystem.
Otherwise you may need to reflash the firmware.

1 Like

I successfully resized the partition by following the instruction here

Thanks All.

Hello everyone,

I'm another user who have sucessfully installed OpenWrt 21.02-rc2 to a 64GB msata SSD on a x86 based Qotom computer. Everything works as expected, except it started showing differing sizes for /dev/sda2, depending on where I look:

cfdisk command output:

Screen Shot 2021-07-15 at 18.00.55

Luci System/Software output:

I have originally expanded the /dev/sda2 partition offline, by booting from an USB linux live-cd type operating system. From there I was able to successfully expand the second partition to occupy all the remaining disk space. It was done by deleting the original /dev/sda2 partition and recreating it as a primary ext4 partition that started at sector 33792 and ended at the last available sector (which is what you get if you simply press enter when prompted for the ending sector). I then run e2fsfck and resize2fs commands and got successful messages from both commands.

After rebooting for the first time, I was able to confirm from Luci System/Software, that the resize operation was indeed successful.

But, somehow, after I got my system fully configured and I had moved it to its definitive place inside a cupboard, yesterday I started noticing the Luci System/Software output was off, as if I had not expanded the partition.

So, I'm scratching my head without knowing what to do next.

I have already tried running resize2fs /dev/sda2 ONLINE from inside OpenWrt, but I keep getting the following:

root@Qotom:~# resize2fs /dev/sda2
resize2fs 1.45.6 (20-Mar-2020)
Filesystem at /dev/sda2 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 4
Performing an on-line resize of /dev/sda2 to 15626326 (4k) blocks.
resize2fs: Invalid argument While trying to add group #1

Does any of you wizards know what to do next?

Got it.

By checking the system log, I found the following messages:

Thu Jul 15 18:00:34 2021 kern.info kernel: [   32.373485] EXT4-fs (sda2): resizing filesystem from 32768 to 15626326 blocks
Thu Jul 15 18:00:34 2021 kern.warn kernel: [   32.382935] EXT4-fs warning (device sda2): reserve_backup_gdb:1035: reserved block 8 not at offset 7
Thu Jul 15 18:00:34 2021 kern.warn kernel: [   32.392560] EXT4-fs warning (device sda2): ext4_resize_fs:2122: error (-22) occurred during file system resize
Thu Jul 15 18:00:34 2021 kern.info kernel: [   32.403030] EXT4-fs (sda2): resized filesystem to 32768
Thu Jul 15 18:00:34 2021 kern.warn kernel: [   32.409721] EXT4-fs warning (device sda2): reserve_backup_gdb:1035: reserved block 8 not at offset 7

Which took me to the following link:

https://bugs.openwrt.org/index.php?do=details&task_id=2951

At the end of the link, there are a couple commands to try. In short, I had to download and install tune2fs package into OpenWrt and run a few commands:

root@Qotom:~# mount -o remount,ro / 
root@Qotom:~# cd /boot
root@Qotom:/boot# tune2fs -O^resize_inode /dev/sda2
tune2fs 1.45.6 (20-Mar-2020)

Please run e2fsck -f on the filesystem.

(and reboot afterwards!)
root@Qotom:/boot# e2fsck -f /dev/sda2
e2fsck 1.45.6 (20-Mar-2020)
Filesystem does not have resize_inode enabled, but s_reserved_gdt_blocks
is 7; should be zero.  Fix<y>? yes
Resize_inode not enabled, but the resize inode is non-zero.  Clear<y>? yes
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
Block bitmap differences:  -(2--8) -427
Fix<y>? yes
Free blocks count wrong for group #0 (26164, counted=26172).
Fix<y>? yes
Free blocks count wrong (26164, counted=26172).
Fix<y>? yes
Padding at end of inode bitmap is not set. Fix<y>? yes

rootfs: ***** FILE SYSTEM WAS MODIFIED *****
rootfs: ***** REBOOT SYSTEM *****
rootfs: 1963/6656 files (0.1% non-contiguous), 6596/32768 blocks
root@Qotom:/boot# fsck.ext4 /dev/sda2
e2fsck 1.45.6 (20-Mar-2020)
rootfs: clean, 1963/6656 files, 6596/32768 blocks
root@Qotom:/boot# reboot now
root@Qotom:/boot# Connection to 192.168.3.1 closed by remote host.
Connection to 192.168.3.1 closed.

After reboot, I ran

root@Qotom:~# resize2fs /dev/sda2
resize2fs 1.45.6 (20-Mar-2020)
Filesystem at /dev/sda2 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 4
The filesystem on /dev/sda2 is now 15626326 (4k) blocks long.

And now Luci System/Software show the following, as expected:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.