DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2008-06-11 15:59:45

vedeja
Member
Registered: 2008-02-21
Posts: 161

Increase RAM

Has anyone considered the possibility to add memory in terms of a USB stick? I don't know if it makes sense, let alone if it is even doable. Just to raise the question.

I have found some interesting stuff about somthing called SwapBoost - ReadyBoost for Linux. Perhaps someone could explore it.
Here is the swapboost.sh baschscript:

Code:

#!/bin/bash
###########
# This is a bash version of Windows Vista's "ReadyBoost".  This doesn't have a
# limitation on the hardware, or a minimum size requirement either.  I wrote
# this kind of as a proof of concept that, yes, we could do this too.
# Someone remind me again why in the *hell* anyone would want to pay for Vista?
###########

if [[ $EUID -ne "0" ]]
then
    echo
    echo "#############################################"
    echo "# You must be root / sudo to run SwapBoost! #"
    echo "#############################################"
    echo
exit 1
fi

device=$(mount | tail -n1 | awk '{ print $1 }')
mount=$(mount | tail -n1 | awk '{ print $3; }')
freespace=$(df | tail -n1 | awk '{ print $4; }')

function usage {
    echo "usage: $0 [OPTION] [DEVICE]"
    echo "Create (or destroy) additional swap space on removable USB media"
    echo
    echo "-n, --new            create a new swap file a USB device"
    echo
    echo "-d, --delete            delete a USB swap file"
    echo
    echo "-h, --help            display this help information"
    echo
    echo "Example:"
    echo " $0 -n"
    echo "    The above will create a swap file on the latest USB"
    echo " $0 -d"
    echo "    The above will delete a swap file on the latest USB"
    echo
    echo "Originally created by Christer Edwards <christer.edwards@ubuntu.com>"
    echo "Released into the public domain"
    echo
}

function destroy {
if [[ -f $mount/swap ]]
then
    swapoff $mount/swap
    sleep 5
    rm $mount/swap
    sleep 5
    umount $mount
    echo
    echo "swap file cleaned up. ($freespace) available for use."

    else

    echo
    echo "You don't seem to have a swap file created on that device"
    exit 1
fi
}

function create {
if [[ -f $mount/swap ]]
then
    echo
    echo "You already have swap created on that device."
    echo
    swapon $mount/swap
    exit 1
fi

read -p "Would you like to create additional swap space on $device? ($mount) (y/n) " CREATE
CREATE=$(echo $CREATE | tr 'A-Z' 'a-z')
if [[ $CREATE == 'y' ]] || [[ $CREATE == 'yes' ]]
then

read -p "Would you like to use the maximum available space? ($freespace) (y/n)" SPACE
    if [[ $SPACE == 'y' ]] || [[ $SPACE == 'yes' ]]
    then
    
    dd if=/dev/zero of=$mount/swap bs=1K count=$freespace
    sleep 5
    mkswap $mount/swap
    sleep 5
    swapon $mount/swap
    sleep 5

    echo
    echo "You now have $freespace additional space available as swap"

    else

    echo
    echo "Planned for upcoming release.  Currently only full size accepted"

    fi
    exit 1

else
    echo
    echo "Exiting SwapBoost"
    exit 1
fi
}

while getopts ":ndh" OPTS ; do
    case $OPTS in
        n)    create     ;;
        d)    destroy    ;;
        \? | h)    usage    ;;
    esac
done

Last edited by vedeja (2008-06-11 16:12:36)


¤ 2 x 500 GB Samsung Spinpoint ¤ FFP 0.5 ¤ Custom fanscript ¤
¤ Lighttpd 1.4.19 ¤ Transmission 1.50 ¤ FW 1.07 ¤

Offline

 

#2 2008-06-11 17:44:33

fordem
Member
Registered: 2007-01-26
Posts: 1938

Re: Increase RAM

Now that would be an interesting use of the USB port - add 2GB of memory and use it for caching and boost the performance.

Offline

 

#3 2008-06-11 17:50:02

index monkey
Member
From: UK
Registered: 2007-06-14
Posts: 112

Re: Increase RAM

isnt the usb port usb1 speed, thus not really fast enough for the purpose?
sweet idea though!


DNS-323, HW B1, 2 x 2TB WD green, fw 1.08, fun_plug 0.5, transmission, automatic, nzbget newsreader & rsync time machine backup.

Offline

 

#4 2008-06-11 18:00:25

SilentException
Member
From: Island of Krk, Croatia
Registered: 2008-05-04
Posts: 148

Re: Increase RAM

hm i dont see the big idea here. few of us have already discussed this a while ago when installing fun_plug on usb stick (http://dns323.kood.org/forum/p14794-200 … tml#p14794)

it is easily done without the script..

dd if=/dev/zero of=/mnt/USB/swap_file bs=1M count=512
#makes 512mb swap file

mkswap /mnt/USB/swap_file
#swap fs

swapoff /dev/hda1
swapoff /dev/hdb1
#disable d-link swap (for priority)

swapon /mnt/USB/swap_file
#enable our swap

swapon /dev/hda1
swapon /dev/hdb1
#enable d-link swap (now will have lower priority than our usb swap)


and this is the proper way to do it btw.. if you don't set the priority right, hdd swap will be used before usb (and as the hdd swap is 1gb. it will never get used...) wink

Last edited by SilentException (2008-06-11 18:02:22)


D-Link DNS-323 v1.05 fun_plug-ed + many mods,  2 x 320GB Seagate Barracuda 7200.10 RAID0, Cat6 Gigabit Network, 9k Jumbo Frames, Average (WRITE): 19,32 MB/sec, Average (READ): 28,6 MB/sec

Offline

 

#5 2008-06-11 18:10:53

fordem
Member
Registered: 2007-01-26
Posts: 1938

Re: Increase RAM

index monkey wrote:

isnt the usb port usb1 speed, thus not really fast enough for the purpose?
sweet idea though!

No the USB port is USB 2.0 - I won't guarantee 480 mbps, but it does deliver more than USB 1.1, 12 mbps

Offline

 

#6 2008-06-11 18:17:23

fordem
Member
Registered: 2007-01-26
Posts: 1938

Re: Increase RAM

SilentException wrote:

hm i dont see the big idea here. few of us have already discussed this a while ago when installing fun_plug on usb stick (http://dns323.kood.org/forum/p14794-200 … tml#p14794)

it is easily done without the script..

<<SNIP>>

and this is the proper way to do it btw.. if you don't set the priority right, hdd swap will be used before usb (and as the hdd swap is 1gb. it will never get used...) wink

I am a little confused here - swap file & RAM are two different things - yes I recognise that the swap file is used as an extension of physical memory, but as I understand things (and I have a limited understanding where linux is concerned) linux will (or can be made to) use any "surplus" memory for disk caching - however - a swap file would not (should not) be used in this fashion since there would be no advantage to  caching disk access to a swapfile on a disk.

Am I missing something somewhere?

Offline

 

#7 2008-06-11 18:17:56

SilentException
Member
From: Island of Krk, Croatia
Registered: 2008-05-04
Posts: 148

Re: Increase RAM

even with usb 2.0, sequential reading and writing will be much slower than on hdd swap. but random access times will be much better smile and that's what is more important here

i have 128mb swap file turned on on usb stick, it's barely used (i tend to keep low memory usage). the biggest advantage so far is that the hdd's do not spin up when using hdd swap smile


fordem wrote:

I am a little confused here - swap file & RAM are two different things - yes I recognise that the swap file is used as an extension of physical memory, but as I understand things (and I have a limited understanding where linux is concerned) linux will (or can be made to) use any "surplus" memory for disk caching - however - a swap file would not (should not) be used in this fashion since there would be no advantage to  caching disk access to a swapfile on a disk.

Am I missing something somewhere?

the script in teh first post does create swap file..

Last edited by SilentException (2008-06-11 18:19:16)


D-Link DNS-323 v1.05 fun_plug-ed + many mods,  2 x 320GB Seagate Barracuda 7200.10 RAID0, Cat6 Gigabit Network, 9k Jumbo Frames, Average (WRITE): 19,32 MB/sec, Average (READ): 28,6 MB/sec

Offline

 

#8 2008-06-11 18:32:51

fordem
Member
Registered: 2007-01-26
Posts: 1938

Re: Increase RAM

I see where you're coming from now - the original post does pretty much the same thing as what's discussed in the other thread - create a swap file, but using that for caching disk reads/writes is not likely to provide any performance enhancement.

Ahh - well.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB