Mounting /dev/mtdblock5 on /mnt failed: Invalid argument

root@router:~# block info
/dev/mtdblock3: UUID="97741d6c-e644db67-1c0916d0-cf1fa89f" VERSION="4.0" MOUNT="/rom" TYPE="squashfs"
/dev/mtdblock4: MOUNT="/overlay" TYPE="jffs2"
/dev/sda1: UUID="120bc142-71f0-a04d-b376-a84230983766" VERSION="1.0" TYPE="ext4"
root@router:~# mkdir /mnt/usbdrive
root@router:~# mount /dev/sda1 /mnt/usbdrive
root@router:~# mkdir -p /tmp/cproot
root@router:~# mount --bind / /tmp/cproot
root@router:~# tar -C /tmp/cproot -cvf - . | tar -C /mnt/usbdrive -xf -
./
./bin/

.. here i would copy paste all the prompt of the ssh showing all the directories copying to the drive but is too much for the limit, so i will say it worked , what do i have to do now?

also, i am very big thankfull for your kind help

great... looks like that worked.

Now the last bit (copy this in as one full block):

cat >> /etc/config/fstab << EOF
config 'mount'
	option target	/
	option device /dev/sda1
	option fstype	ext4
	option options	rw,sync
	option enabled	1
	option enabled_fsck	0
EOF

hit return, then

reboot

when it comes back, what is the output of:

df -h
1 Like

And just so it is all in one place, this is my recipe:

opkg update
opkg install block-mount kmod-usb-storage kmod-fs-ext4

# Mount the USB flash drive
mkdir /mnt/usbdrive
mount /dev/sda1 /mnt/usbdrive

# Execute extroot migration process
mkdir -p /tmp/cproot
mount --bind / /tmp/cproot
tar -C /tmp/cproot -cvf - . | tar -C /mnt/usbdrive -xf -
umount /tmp/cproot

# Add entry to fstab to set booting to USB drive 
cat >> /etc/config/fstab << EOF
config 'mount'
	option target	/
	option device /dev/sda1
	option fstype	ext4
	option options	rw,sync
	option enabled	1
	option enabled_fsck	0
EOF

# Reboot
reboot
1 Like
root@router:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 3.8M      3.8M         0 100% /rom
tmpfs                    28.0M    100.0K     27.9M   0% /tmp
/dev/mtdblock4            1.9M    748.0K      1.1M  39% /overlay
overlayfs:/overlay        1.9M    748.0K      1.1M  39% /
tmpfs                   512.0K         0    512.0K   0% /dev
root@router:~# block info
/dev/mtdblock3: UUID="97741d6c-e644db67-1c0916d0-cf1fa89f" VERSION="4.0" MOUNT="/rom" TYPE="squashfs"
/dev/mtdblock4: MOUNT="/overlay" TYPE="jffs2"
/dev/sda1: UUID="120bc142-71f0-a04d-b376-a84230983766" VERSION="1.0" TYPE="ext4"
root@router:~#

my friend, i think i found a bug cause looks like did not worked, ran the


cat >> /etc/config/fstab << EOF
config 'mount'
	option target	/
	option device /dev/sda1
	option fstype	ext4
	option options	rw,sync
	option enabled	1
	option enabled_fsck	0
EOF

in one copy paste, hit enter reboot then df -h and it does not shows the 28000m or 28gb or something similar, also, hit a block info so you could see if it still detects it or not, and as you can see here, it detects the drive but in the df -h does not

what is the output of

cat /etc/config/fstab
1 Like
 cat /etc/config/fstab

config 'global'
        option  anon_swap       '0'
        option  anon_mount      '0'
        option  auto_swap       '1'
        option  auto_mount      '1'
        option  delay_root      '5'
        option  check_fs        '0'

config 'mount'
option target/
option device /dev/sda1
option fstypeext4
option optionsrw,sync
option enabled1
option enabled_fsck0
root@router:~#

oh it shows the sda1 in option device, that did not when i tried the guide , we are good headed!!!

The tabs didn't work properly for some reason...
the file should look like this:

config 'global'
        option  anon_swap       '0'
        option  anon_mount      '0'
        option  auto_swap       '1'
        option  auto_mount      '1'
        option  delay_root      '5'
        option  check_fs        '0'

config 'mount'
        option target/
        option device /dev/sda1
        option fstypeext4
        option optionsrw,sync
        option enabled1
        option enabled_fsck0
1 Like

it looks like that, like in my last reply ,but still not working, maybe too much memory? but i do not think so because saw a guy who was boasting of 128gb of memory in the router , i am puzzled

i have followed all the steps rigurously and that is what puzzles me more, because is not working

i do not think is the usb, the usb is a kingstom data traveler 2 of 32gb, the block info detects it but some reason it does not wants to grab the usb as overlay

Let's try this again -- I see that there were still spaces missing in what I last posted:

config 'mount'
        option target /
        option device /dev/sda1
        option fstype ext4
        option options rw,sync
        option enabled 1
        option enabled_fsck 0
1 Like

mine is

cat /etc/config/fstab

config 'global'
        option  anon_swap       '0'
        option  anon_mount      '0'
        option  auto_swap       '1'
        option  auto_mount      '1'
        option  delay_root      '5'
        option  check_fs        '0'

config 'mount'
option target/
option device /dev/sda1
option fstypeext4
option optionsrw,sync
option enabled1
option enabled_fsck0
root@router:~#

These are still missing indents and spaces

config 'mount'
    option target /
    option device /dev/sda1
    option fstype ext4
    option options rw,sync
    option enabled 1
    option enabled_fsck 0
1 Like

now i get it, maybe my image is broken? is weird

or maybe because i use the "cat" command? i am sorry i am newbie and i just try hard to improve

no... it is more likely that there is something with the terminal program you are using that is dropping spaces or something in this very specific situation.

Edit the file with the vi editor that is built-in to OpenWrt.

1 Like

i am using cmd terminal of windows

i edited the file with vi and the tabs are wrong

corrected and saved , now looks like this



config 'global'
        option  anon_swap       '0'
        option  anon_mount      '0'
        option  auto_swap       '1'
        option  auto_mount      '1'
        option  delay_root      '5'
        option  check_fs        '0'

config 'mount'
        option target/
        option device /dev/sda1
        option fstypeext4
        option optionsrw,sync
        option enabled1
        option enabled_fsck0

should i reboot?

still missing spaces....
I'll put in _ where they should be so that it is clear, but be sure to actually use spaces

config 'mount'
        option target_/
        option device /dev/sda1
        option fstype_ext4
        option options_rw,sync
        option enabled_1
        option enabled_fsck_0
config 'mount'
        option target /
        option device /dev/sda1
        option fstypeext4
        option optionsrw,sync
        option enabled1
        option enabled_fsck0

done, sorry

Still missing them here, too.

This time with %

        option fstype%ext4
        option optionsr%w,sync
        option enabled%1
        option enabled_fsck%0

like this?


        option fstypeext '4'
        option options rw,sync
        option enabled '1'
        option enabled_fsck '0'

or i leave it like before just add the % where you told me?

This is what it should look like... study this carefully to make sure you've got the spaces correct in every location.

this is how it looks now


config 'global'
        option  anon_swap       '0'
        option  anon_mount      '0'
        option  auto_swap       '1'
        option  auto_mount      '1'
        option  delay_root      '5'
        option  check_fs        '0'

config 'mount'
        option target /
        option device /dev/sda1
        option fstype ext4
        option options rw,sync
        option enabled 1
        option enabled_fsck 0

thank you, it is weird that the file output like that i did not touched the file before maybe is a bug?