Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 18 Dec 2017, 11:11
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Filesystem
simple GUI ramdisk script
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [16 Posts]   Goto page: 1, 2 Next
Author Message
Pizzasgood


Joined: 04 May 2005
Posts: 6266
Location: Knoxville, TN, USA

PostPosted: Tue 27 Dec 2011, 18:56    Post subject:  simple GUI ramdisk script  

This is just a simple little GUI program for creating a ramdisk. Somebody requested that I throw one together, so here it is. I didn't bother making a .pet package or a menu or desktop icon for it. It's just a gzipped script.

Usage:
    1) Click it.
    2) Input the size of the ramdisk you want, then press "Okay".
    3) It mounts the ramdisk and opens a window inside it, as well as a dialog with an "Unmount" button.
    *** This is when you do whatever you want to do inside the ramdisk
    4) When finished, click the "Unmount" button on the dialog it popped up, and it will be umounted. All data within it will go *poof*.


If you don't want the unmount dialog to hang around, click the 'x' on the title bar to close it. If you do this you'll have to manually unmount the ramdisk when you're finished. This is done by either moving up a notch in ROX-Filer and having ROX-Filer umount it (via right-click option), or by using the following command:
Code:
umount /mnt/ramdisk


Of course, you could just leave the ramdisk there and not unmount it, but it will use however much ram it's using until you either unmount it, delete everything inside it, or reboot. (Note that tmpfs is smart enough to not just allocate the ram you give it immediately. The size you set is used as the upper limit, but it only allocates as much ram as it needs at any given point. So, even if you create a 1gb ramdisk, if there is only 10mb of stuff in it, only about 10mb of ram will be used.)
ramdisk_gui.gz
Description  gui for making ramdisks
gz

 Download 
Filename  ramdisk_gui.gz 
Filesize  551 Bytes 
Downloaded  1110 Time(s) 

_________________
Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib

Back to top
View user's profile Send private message Visit poster's website 
Q5sys


Joined: 11 Dec 2008
Posts: 1124

PostPosted: Wed 28 Dec 2011, 03:07    Post subject:  

sweet thanks for this!
_________________



Back to top
View user's profile Send private message Visit poster's website 
puppyluvr


Joined: 06 Jan 2008
Posts: 3454
Location: Chickasha Oklahoma

PostPosted: Wed 28 Dec 2011, 04:03    Post subject:  

Very Happy Helo,
Just had to change permissions to run it....
Cool idea...

_________________
Close the Windows, and open your eyes, to a whole new world
I am Lead Dog of the
Puppy Linux Users Group on Facebook
Join us!

Puppy since 2.15CE...
Back to top
View user's profile Send private message Visit poster's website 
Q5sys


Joined: 11 Dec 2008
Posts: 1124

PostPosted: Wed 03 Oct 2012, 20:54    Post subject:  

EDIT: This does not apply to slacko533

For all those wanting to use this on a frugal install... you need to change line 4 of the script from
Code:
MOUNTPOINT="/mnt/ramdisk"

to
Code:
MOUNTPOINT="/tmp/ramdisk"


to explain why... I'll copy/paste part of the IRC convo here:
http://puppy-linux.org/screenshot.png


<q5sys> now let me explain.
<q5sys> I have a 1.4gb safe file on this system. I have 16gb ram. I run VMs all the time. and I do so completely from ram. so I'll create a ramdisk and load a 4 to 8gb VM file into it and then run it from there. I do delete it before shutdown
<q5sys> but it still has to sit in memory so I can use it
<q5sys> http://puppy-linux.org/screenshot.png
<q5sys> thats using the script pizza posted with ramdisks saved in /mnt
<q5sys> and LOOK. the graphical map of the safe file shows /mnt/ramdisk sitting in there
<q5sys> I tried to copy /mnt/home over to my ramdisk just to fill it uo
<q5sys> I made a 4gb ramdisk and tried to copy 1900mb of files into it
<q5sys> but as you can see from the rox window with /mnt/ramdisk in it... only 438mb copied
mama21mama 0/
<q5sys> why? becuase that was all the freespace I had left in /initrd/pup_rw.
<q5sys> now yes I'll delete that ramdisk before i shut down...
<q5sys> but while Im using my system.... my /initrd/pup_rw is filled and cant accept anymore data. which means that at least while Im currently using my system... my savefile is full (until I delete the ramdisk)
<q5sys> like I've said about 4 times now... on a frugral install changes to /mnt are saved to /initrd/pup_rw
<slue_gniffer> how much ram do you have?
<q5sys> /initrd /pup_rw is the contents of your save file that have been changed since last boot.
<q5sys> slue_gniffer: I have 16gb ram
<tlc> WHy The F would anyone use such a huge save file?
<tlc> er ram disk
Rupp shrugs
tlc SO did Atlas
<q5sys> tlc... to run a VM completely from RAM
<tlc> Why would you do that?
<q5sys> so its not having to read the hard disk to run.
<q5sys> it makes it faster.
<bignono1> wb Brown_Mouse
<q5sys> I've got the ram... I might as well use it for something useful
<q5sys> puppy will never use that much on its own. lol

_________________



Back to top
View user's profile Send private message Visit poster's website 
Smithy


Joined: 12 Dec 2011
Posts: 800

PostPosted: Sun 08 Mar 2015, 06:36    Post subject:  

Made a little ramdisk pet from info.
The Puppy Ram system is a bit of a mystery and personally hate going in /tmp, it's always full of junk and stuff.

Edit sfs was always running out of ram in its operation and frequently ommited to offer the partition option. I assumed it was lack of system ram. Wrong!
This one is solid and in combination with Uxtract and Packit, does the job nicely.
Ramdisk.pet
Description 
pet

 Download 
Filename  Ramdisk.pet 
Filesize  3.11 KB 
Downloaded  244 Time(s) 
Back to top
View user's profile Send private message 
SFR


Joined: 26 Oct 2011
Posts: 1648

PostPosted: Sun 08 Mar 2015, 08:40    Post subject:  

Hey Smithy

RE: UExtract

I just stumbled across your post and tested a case when there's not enough available space to extract an SFS.
It turned out that unsquashfs (used by UExtract) exits with code 0 (i.e. "All is OK"), even if there was insufficient free space available and some files weren't extracted, so, in effect, UExtract also reports successful extraction.
I've applied a workaround - if there's 0 free bytes on a destination device after extraction, an error is automatically assumed.

If the ramdisk wasn't big enough then there's a chance you've experienced this flaw, so it would be safer if you upgrade to v3.9.

Thanks &
Greetings!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send private message 
Smithy


Joined: 12 Dec 2011
Posts: 800

PostPosted: Sun 08 Mar 2015, 17:22    Post subject:  

Thanks for the heads up on that SFR, I will upgrade it to that version.
Certainly is a good visual app that lets you know what it is doing.
Back to top
View user's profile Send private message 
Smithy


Joined: 12 Dec 2011
Posts: 800

PostPosted: Sat 14 Oct 2017, 12:57    Post subject:  

Hmm, this ramdisk is now broken in newer puppies.

For example I make a 3500mb ramdisk, UExtract something into it and the puppy ram just gets sucked out and puppy crashes with no ram left.

This doesn't happen in Dpup. It will squash up again with no problem (4gb ram)
Is the initrd/mount area not a viable spot for ramdisks now?

If someone could point to a suitable place now where it doesn't suck up and crash the puppy that would be good. Tried temp/ tempfs, same problem.
Just sucking up that ram.
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 11296
Location: Gatineau (Qc), Canada

PostPosted: Sat 14 Oct 2017, 15:05    Post subject:  

Smithy wrote:
Hmm, this ramdisk is now broken in newer puppies.

For example I make a 3500mb ramdisk, UExtract something into it and the puppy ram just gets sucked out and puppy crashes with no ram left.

This doesn't happen in Dpup. It will squash up again with no problem (4gb ram)
Is the initrd/mount area not a viable spot for ramdisks now?

If someone could point to a suitable place now where it doesn't suck up and crash the puppy that would be good. Tried temp/ tempfs, same problem.
Just sucking up that ram.

Hi Smithy.

Do you mean the old DPup-4.82 or the new DpupStretch-7? TIA.

Have you tried to see what's wrong with the script?

BFN.

~~~~~~~~~~~~~
Edit, 15 min. later.

I tried Pizza'sGood original script (2011) and it works fine on this
DpupStretch-7fr (2017).

I was able to
-- create a 1G ramdisk
-- unpack a MynotEX deb archive to it with SFR's UExtract, and
-- read its PDF doc from it.
-- PG's ramdisk script also sustained a refresh ram action like this:
Code:
sync ; echo 3 > /proc/sys/vm/drop_caches;wait

So everything is fine here with PG's original script.
I can't see where your problem is, sorry.

Please see summary in attached pic. Sorry for the head tilting, but otherwise
the info would have been unreadable.

BFN.
PGs-ramdisk-OK.jpg
 Description   
 Filesize   212.96 KB
 Viewed   159 Time(s)

PGs-ramdisk-OK.jpg


_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 11296
Location: Gatineau (Qc), Canada

PostPosted: Sat 14 Oct 2017, 15:51    Post subject:  

Anyway, thanks for bringing PG's script back to the surface, Smithy.

I'll keep trying it for a couple of days, and if it continues behaving ok, I'll leave
it in my /root/Startup sequence.

BFN.

_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 11296
Location: Gatineau (Qc), Canada

PostPosted: Sat 14 Oct 2017, 16:50    Post subject:  

Hello again, people.

Since we're going to symlink this script in /root/Startup, we need to check
if the ramdisk already exists and do nothing if it exists when we recycle X.

This is what I am proposing:
Code:
#!/bin/sh
#This is a simple GUI to mount a ramdisk on $MOUNTPOINT.
#
# by Pizza'sGood, 27 Dec. 2011.
# Source : http://murga-linux.com/puppy/viewtopic.php?p=592060&sort=lastpost#592060
# Downloaded and edited Oct. 14 2017 by musher0.
####
ChecK="`df | awk '$NF ~ /ramdisk/'`" # musher0, 17-10-14
if [ "$ChecK" = "" ];then # musher0, 17-10-14

   MOUNTPOINT="/mnt/ramdisk"

#Prompt the user for a size
   SIZE="$(Xdialog --title "Ramdisk" --spinbox "How many megabytes do you\nwant the ramdisk to use?" 0 0 1 2147483647 200 MB 2>&1)"
   if [ $? -ne 0 ]; then
      Xdialog --title "Ramdisk" --infobox "Aborted" 0 0 5000
      echo "Aborted";exit
   fi

#make sure the mountpoint exists
   mkdir -p "$MOUNTPOINT"
#mount the ramdisk
   mount -t tmpfs -o size=${SIZE}m tmpfs "$MOUNTPOINT"
#pop open a window to the ramdisk
   which rox >/dev/null 2>&1 && rox "$MOUNTPOINT"

#Let the user know where it was mounted, and wait for him/her to tell us to unmount it.
   Xdialog --title "Ramdisk" --ok-label "Unmount" --msgbox "The $SIZE MB ramdisk has been created and mounted on\n$MOUNTPOINT\n\nWhen finished, click 'Unmount' to unmount it,\nor 'x' out of this window and do it manually." 0 0

   if [ $? -eq 0 ]; then
#close any windows open to the ramdisk
      which rox >/dev/null 2>&1 && rox -D "$MOUNTPOINT"
#unmount the ramdisk
      umount "$MOUNTPOINT"
   fi

else # This section by musher0, 17-10-14

   Xdialog --title "Exists" --ok-label "Exit" --msgbox "A ramdisk already exists." 0 0

fi # End of section by musher0, 17-10-14
##########
# Add-ins by musher0
# Various one-liners to do checks on this ramdisk.
# 1a) # echo -e "Location\tUsed\tAvail.\t%\tName";df -h | awk '$NF ~ /ramdisk/ { print $1"\t\t"$3"\t"$4"\t"$5"\t"$6}'
# OR
# 1b) echo;df | head -1;df | grep ramdisk
# The above lines will tell you the size and occupancy.
#
##
# 2) df | head -1;df | grep ram
#
# 3) df | awk '$2=="1024000" && $NF ~ /ramdisk/'
# These two just tell you if there is a "ramdisk".
####
Please test. TIA.

BFN.

_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
Smithy


Joined: 12 Dec 2011
Posts: 800

PostPosted: Sat 14 Oct 2017, 17:08    Post subject:  

Hello Musher,
Could you try a 3500mb ramdisk if you have 4gb ram and then try extracting something substantial to the init/mount ramdisk made by the script?

Possibly the puppy stretch sfs ? Then tell me what happens with the ram indicator
on the taskbar.

BTW I don't think I monkeyed around with pizza'sgoods script, just added it as a pet with a desktop icon so it was easy to use. Much praise, it was he who made Retrovol.

Last edited by Smithy on Sun 15 Oct 2017, 09:12; edited 1 time in total
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 11296
Location: Gatineau (Qc), Canada

PostPosted: Sat 14 Oct 2017, 17:32    Post subject:  

Hi Smithy.

Yeah, Pizza'sGood was an outstanding dev, I wonder why he's not around
anymore. I hope everything's ok with him.

~~~~~~~~~~~~~~
About your test, I wish I could do it but I cannot, sorry.

I cannot create a 3.5 Gb on my rig because...
-- my kernel is a non-PAE kernel, and maximum RAM available with a non-
PAE kernel is 2.85 Gb's (maybe 2,9 Gb)
-- although I do have 4 Gb's of RAM, technically on this computer
~~~~~~~~~~~~~~

That said, I upped the size of the ramdisk to 1.5 Gb. Then I copied the
Chromium and aOO-4 sfs's to it and unpacked them with SFR's UExtract.
Successfully!!! Smile (Please see pic.)

IHTH.
~~~~~~~~~~~~~~

Finally, here's a companion script to PG's ramdisk_gui. This little script will
show you the occupancy of the ramdisk.
Code:
#!/bin/sh
# ramdisk_check.sh # Companion script to Pizza'sGood ramdisk_gui script.
#
# Requires the real less utility by Greenwood software.
# The busybox less won't cut it.
#
# Oct. 14 2017, musher0.
####
echo -e ".
`df | head -1`
\e[33m`df | grep ramdisk`\e[0m
." > /tmp/ramdisk_check

# variables
FONT="fn xft:LiberationMono:pixelsize=15:autohint=true:antialias=true"
FadE="fade 70 -fadecolor "#94A495""
COLR="bg sienna4 -fg cornsilk -bd firebrick4 -b 4 -cr white"
########### couleurs ############## bordure  ##### curseur #
TRNSP="tr -tint snow -sh 42"
###########  transparence
# couleurs avec effets de transparence
Title="                     Ramdisk_Check                          "
Geom="g 65x5-250-250"

rxvt -$FONT -$COLR -$TRNSP -$Geom -T "$Title" -$FadE +sb -sr +st +tcw -bc -e less -~ -R -P "$Title" /tmp/ramdisk_check

I hope it's useful to someone.

BFN.
Test-for-Smithy.jpg
 Description   After copying and unsquashing chromium and apache OpenOffice sfs's
 Filesize   80.52 KB
 Viewed   117 Time(s)

Test-for-Smithy.jpg

CompanionScript.jpg
 Description   Previously
 Filesize   44.39 KB
 Viewed   122 Time(s)

CompanionScript.jpg


_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
Smithy


Joined: 12 Dec 2011
Posts: 800

PostPosted: Sun 15 Oct 2017, 09:10    Post subject:  

Hi musher,

You can make the ramdisk whatever size you like, that just sets the upper limit.
It doesn't actually use anything until you put stuff in it.
And I always believed it is kind of outside the puppy file system.

I'm just wondering if it is the pae kernels that are having trouble with this ramdisk.

I am using dpup wheezy but with a pupjibaro wheezy kernel.
I have no idea if that is pae or not, but it works fine.
And I know that it works fine with the original 3.5.2. kernel (non-pae).

And you are using a non pae and I'll bet that extra 1gb is happily available to the ramdisk.
Anyways when you did the transfer, what was the indicator on the ram?
Had it gone down a bit?
When I do a 2.5gb or so ramdisk and transfer a big 1600mb (extracted) sfs the actual ram indicator still says 1.9G tmpfs, free space =1.9G.
The ramdisk is evidently living in its own ram space and not fck** up the pup ram.

Maybe it's time to edit the fstab/shm initrc or something and just force the puppy to use all the memory when it boots, not just the conservative half..
How to do that though?
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 11296
Location: Gatineau (Qc), Canada

PostPosted: Sun 15 Oct 2017, 11:05    Post subject:  

Smithy wrote:
Hi musher,

You can make the ramdisk whatever size you like, that just sets the upper limit.
It doesn't actually use anything until you put stuff in it.
And I always believed it is kind of outside the puppy file system.

I'm just wondering if it is the pae kernels that are having trouble with this ramdisk.

I am using dpup wheezy but with a pupjibaro wheezy kernel.
I have no idea if that is pae or not, but it works fine.
And I know that it works fine with the original 3.5.2. kernel (non-pae).

And you are using a non pae and I'll bet that extra 1gb is happily available to the ramdisk.
Anyways when you did the transfer, what was the indicator on the ram?
Had it gone down a bit?
When I do a 2.5gb or so ramdisk and transfer a big 1600mb (extracted) sfs the actual ram indicator still says 1.9G tmpfs, free space =1.9G.
The ramdisk is evidently living in its own ram space and not fck** up the pup ram.

Maybe it's time to edit the fstab/shm initrc or something and just force the puppy to use all the memory when it boots, not just the conservative half..
How to do that though?

Hi Smithy.

I don't think I know Linux enough to answer all your questions.

About the indicator on the RAM: this is what I get with the < free > utility:
Quote:
[~]>free -m
---- total used free shared buffers
Mem: 2907 709 2198 0 18
-/+ buffers: 690 2217
(in Mg's), after creation of a 1.45 Gb ramdisk.
If I right-click on /mnt/ramdisk, and then click on "properties", it says that
the ramdisk total size is 1,45Gb.

It would be nice to have the ramdisk outside the RAM Puppy uses, but It
can't because the Puppy Linux non-PAE kernel controls 2.9 Gb's maximum.
Yes there is 1.1 Gb of RAM left if your rig has 4 Gb's RAM in total but that
1.1 Gb is out of reach for the non-PAE kernel.

Only with a PAE kernel can you use the full 4 Gb's of RAM (or more).

You can see the "occupancy" on the ramdisk after the transfer and unpack
operations in the smaller picture above. Yes it had gone down.

~~~~~~~~~~
About registering the ramdisk in fstab, I wish I could help you, but I simply
don't know if one can register a ramdisk in fstab. More info is required,
I think.

IHTH.

BFN.

_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 2 [16 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Filesystem
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0772s ][ Queries: 13 (0.0113s) ][ GZIP on ]