Go Down

Topic: Expand the storage by SD card/USB flash/USB hard drive for Yun & compatible (Read 4118 times) previous topic - next topic

sonnyyu

1. Put Micro SD card into slot.

2. Run

Code: [Select]
wget -O simplesd.sh https://www.dropbox.com/s/jl4oytptxrb6q5u/simplesd.sh?dl=0 --no-check-certificate
/bin/ash simplesd.sh



WARNING
Your SD card will be formatted and you will lose the files it contains. Be sure you have backed it up before using it for expanding Yún's disk space.





sonnyyu

"simplesd.sh" Code:

Code: [Select]
opkg update
opkg install e2fsprogs fdisk
if fdisk -l |grep /dev/sda > /dev/null; then
    echo "Start"
else
    echo "/dev/sda not found!"
    exit 0
fi
dd if=/dev/zero of=/dev/sda bs=4096 count=10
(echo n; echo p; echo 1;  echo;  echo; echo w)  | fdisk /dev/sda
umount -f  /mnt/sda1
mkfs.ext4 /dev/sda1
mkdir -p /mnt/sda1
mount  /dev/sda1 /mnt/sda1
mkdir -p /tmp/cproot
mount --bind / /tmp/cproot
tar -C /tmp/cproot -cvf - . | tar -C /mnt/sda1 -xf -
umount /tmp/cproot
uci add fstab mount
uci set fstab.@mount[0].target=/
uci set fstab.@mount[0].device=/dev/sda1
uci set fstab.@mount[0].fstype=ext4
uci set fstab.@mount[0].enabled=1
uci set fstab.@mount[0].enabled_fsck=0
uci set fstab.@mount[0].options=rw,sync,noatime,nodiratime
uci commit
reboot





sonnyyu

#2
May 08, 2015, 04:19 am Last Edit: May 08, 2015, 04:25 am by sonnyyu
In case fresh OS is needed:


Run following before expand the storage memory.

Code: [Select]
reset-to-factory-anyway
reboot







sonnyyu

Revision script:

Code: [Select]
opkg update
opkg install bash


Code: [Select]
wget -O expand.sh https://www.dropbox.com/s/x2zhfqr4ssfetz1/expand.sh?dl=0 --no-check-certificate


for micro SD card:

Code: [Select]
/bin/bash expand.sh

or

Code: [Select]
/bin/bash expand.sh sda

for USB flash:

Code: [Select]
/bin/bash expand.sh sdb

for USB hard disk

Code: [Select]
/bin/bash expand.sh sdc




sonnyyu

"expand.sh" code:

Code: [Select]
if [ -n "$1" ]; then
device=$1
else
device="sda"
fi
driver=$device"1"
opkg update
opkg install e2fsprogs fdisk
if fdisk -l |grep /dev/$device > /dev/null; then
    echo "Start"
else
    echo "/dev/$device not found!"
    exit 0
fi
dd if=/dev/zero of=/dev/$device bs=4096 count=10
(echo n; echo p; echo 1;  echo;  echo; echo w)  | fdisk /dev/$device
umount -f  /mnt/$driver
mkfs.ext4 /dev/$driver
mkdir -p /mnt/$driver
mount  /dev/$driver  /mnt/$driver
mkdir -p /tmp/cproot
mount --bind / /tmp/cproot
tar -C /tmp/cproot -cvf - . | tar -C /mnt/$driver  -xf -
umount /tmp/cproot
uci add fstab mount
uci set fstab.@mount[0].target=/
uci set fstab.@mount[0].device=/dev/$driver
uci set fstab.@mount[0].fstype=ext4
uci set fstab.@mount[0].enabled=1
uci set fstab.@mount[0].enabled_fsck=0
uci set fstab.@mount[0].options=rw,sync,noatime,nodiratime
uci commit
reboot




sonnyyu

Remove SD card entry at  fstab:

Code: [Select]
nano removesd.sh

Code: [Select]
#!/bin/ash
/sbin/uci delete fstab.@mount[0]
/sbin/uci commit fstab
/sbin/uci show fstab


Code: [Select]
/bin/ash removesd.sh




sonnyyu

For  USB flash size >= 64GB here is revision code.


Code: [Select]
wget -O newexpand.sh https://www.dropbox.com/s/jnrwhrc0dhjynyp/newexpand.sh?dl=0 --no-check-certificate

Code: [Select]
/bin/bash newexpand.sh sdb




sonnyyu

When use External USB Hard Drive:



USB Y Cable for External Hard Drive is needed.









PCWorxLA

When use External USB Hard Drive:

USB Y Cable for External Hard Drive is needed.
Not necessarily (anymore). Most recent drives an perfectly be powered with a single (500mA) USB 2.0 port. The only catch might be if you are trying to power a USB 3.0 drive (with the two-part micro plug) from a regular USB 2.0 port and the drive draws more than 500mA, and in that case your Y-cable isn't an option from the start (and I am not aware of any 3.0 Y-cables)...

Of course as soon as I posted the above, I found that there are micro-USB 3.0 cables with a Y USB 2.0 set of plugs.

Ralf

sonnyyu

Not necessarily (anymore). Most recent drives an perfectly be powered with a single (500mA) USB 2.0 port. The only catch might be if you are trying to power a USB 3.0 drive (with the two-part micro plug) from a regular USB 2.0 port and the drive draws more than 500mA, and in that case your Y-cable isn't an option from the start (and I am not aware of any 3.0 Y-cables)...

Ralf
Yun compatible answer is Yes.
Yun, since its USB only output 4.5 V at USB V+, Y-cables is mandatory.




sonnyyu

Expand the storage by USB flash for Dragino:

Code: [Select]
opkg update
opkg install bash
opkg install wget


Code: [Select]
wget -O newexpand.sh https://www.dropbox.com/s/jnrwhrc0dhjynyp/newexpand.sh?dl=0 --no-check-certificate

Code: [Select]
/bin/bash newexpand.sh sda







sonnyyu


sonnyyu

Is there a difference in performance between USB Drive vs. SD Card?


From I  learned  for reading speed USB Drive beat SD Card, for writing speed is close.



PCWorxLA

Yun compatible answer is Yes.
Yun, since its USB only output 4.5 V at USB V+, Y-cables is mandatory.
But using a Y cable doesn't increase the possible voltage, it will only allow for a higher drawn amperage...

Ralf

sonnyyu

But using a Y cable doesn't increase the possible voltage, it will only allow for a higher drawn amperage...

Ralf
I don't think  Y cable  is going to offer load  balance here, It is more less USB Power Inject.

An other looking feel type USB Power Injector:













Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy