Page 1 of 2

[SOLVED] How to find out the space used in save.dat file

Posted: 22 Jun 2015, 11:31
by anandisrocking007
Hi everyone i guess the topic tells it all i have made a save.dat file but lets say i saved to much it and it became full or i made a made a magic folder and linked it to a folder in porteus can you show me a way to findout how much space i have used in the save.dat file would appreciate an answer..... :D

Re: How to find out the space used in save.dat file

Posted: 22 Jun 2015, 11:34
by Seva
i dont know, it use ext4 formatted drive, and i think its better for porteus than fat32

Re: How to find out the space used in save.dat file

Posted: 22 Jun 2015, 11:45
by anandisrocking007
Thats true but once the the datfile gets full then it would cause problem

Re: How to find out the space used in save.dat file

Posted: 22 Jun 2015, 11:55
by Seva
when using ext4 there is no .dat containers, everything becomes better

Re: How to find out the space used in save.dat file

Posted: 22 Jun 2015, 12:01
by Bogomips
Been a while since I used persistence, but if my memory serves me correctly, you need to find out the size of the image in the save,dat file.

Re: How to find out the space used in save.dat file

Posted: 22 Jun 2015, 12:22
by donald
@ anandisrocking007
as root:
mloop /path/savefile.dat

Filemanager > /mnt/loop

I don't know if one can do this when the savefile is in use.
(I don't have one)

when finished type uloop

Re: How to find out the space used in save.dat file

Posted: 22 Jun 2015, 12:24
by anandisrocking007
Bogomips wrote:Been a while since I used persistence, but if my memory serves me correctly, you need to find out the size of the image in the save,dat file.
Well can you help me with that i have heard you have to type some commands in the terminal any idea what those are would help a lot as for the ext4 i would prefer to keep it windows readable and it would not heart if i learnt something along the way...... :good:

Re: How to find out the space used in save.dat file

Posted: 22 Jun 2015, 12:29
by anandisrocking007
donald wrote:@ anandisrocking007
as root:
mloop /path/savefile.dat

Filemanager > /mnt/loop

I don't know if one can do this when the savefile is in use.
(I don't have one)

when finished type uloop
Been there done that but it mounts it does not tells the exact amount of data used also i was thinking of asking this in another thread it seems i can use the mloop command to read iso file,dat file which have been used as magic folder but it seems that i can not use this for the persistant sav.dat file it comes up empty for some reason and but i know there are settings saved in it

Re: How to find out the space used in save.dat file

Posted: 22 Jun 2015, 12:50
by Ed_P
anandisrocking007 wrote:Hi everyone i guess the topic tells it all i have made a save.dat file but lets say i saved to much it and it became full or i made a made a magic folder and linked it to a folder in porteus can you show me a way to findout how much space i have used in the save.dat file would appreciate an answer..... :D
I understand. Been there, done that. Save this script to your /home/guest/ folder:

savedatspaceused.sh

Code: Select all

#!/bin/sh
#  http://forum.porteus.org/viewtopic.php?f=81&t=1941&start=15#p13272
#  http://forum.porteus.org/viewtopic.php?f=117&t=3205&p=25099#p25097

# Color definitions
txtbld=$(tput bold)               # Bold
txtred=${txtbld}$(tput setaf 1)   # Red
rst=$(tput sgr0)                  # Reset

function redpswd() {
  echo -e "$1" $txtred  
}

if [ `whoami` != "root" ]; then
    redpswd "Enter root's password"
    su -c "sh $0 $1"
    exit
fi
echo $rst

if [ -a /mnt/live/memory/images/changes ]; then
   SPACEDATDIR=/mnt/live/memory/images/changes 
fi

echo
echo du -sh
du -sh ${SPACEDATDIR}     # Show the amount used   
echo df -h
df -h  ${SPACEDATDIR}     # Show filesystem summary
echo
du -sh ${SPACEDATDIR}/etc
du -sh ${SPACEDATDIR}/home
du -sh ${SPACEDATDIR}/opt
du -sh ${SPACEDATDIR}/root
du -sh ${SPACEDATDIR}/usr
du -sh ${SPACEDATDIR}/var
echo
In a terminal window enter: sh ./savedatspaceused.sh

You should see what you're seeking.

Re: How to find out the space used in save.dat file

Posted: 22 Jun 2015, 18:48
by donald
@ anandisrocking007
sorry,my bad
you have to reboot into the "allways fresh" mode to make it work.(mloop the save.dat)

hmm..doesn't a df -h /mnt/live/memory/changes/
(normal boot) show the save file values.?

Re: How to find out the space used in save.dat file

Posted: 22 Jun 2015, 20:19
by Bogomips

Code: Select all

guest@porteus:~$ df -h /mnt/live/memory/changes/ 
Filesystem      Size  Used Avail Use% Mounted on
-               265M  4.0M  261M   2% /mnt/live/memory/changes
guest@porteus:~$ df -h .
Filesystem      Size  Used Avail Use% Mounted on
aufs            265M  4.0M  261M   2% /
cpy2ram and not using changes, Get same values.

Re: How to find out the space used in save.dat file

Posted: 23 Jun 2015, 03:03
by donald
@Bogomips
normal boot with save.dat (save changes)

guest@porteus:~$ df -h /mnt/live/memory/changes/
Filesystem Size Used Avail Use% Mounted on
- 509M 37M 472M 8% /mnt/live/memory/changes

root@porteus:/home/guest# du -sh /mnt/live/memory/changes/
11M /mnt/live/memory/changes/

copy2ram without save.dat (also allways fresh)

guest@porteus:~$ df -h /mnt/live/memory/changes/
Filesystem Size Used Avail Use% Mounted on
- 606M 408K 605M 1% /mnt/live/memory/changes

root@porteus:/home/guest# du -sh /mnt/live/memory/changes/
408K /mnt/live/memory/changes/

mloop /mnt/sdb1/porteus/save.dat

guest@porteus:~$ df -h /mnt/loop/
Filesystem Size Used Avail Use% Mounted on
/dev/loop5 509M 37M 473M 8% /mnt/loop

root@porteus:/home/guest# du -sh /mnt/loop/
11M /mnt/loop/

Re: How to find out the space used in save.dat file

Posted: 23 Jun 2015, 04:38
by anandisrocking007
Ed_P wrote:
anandisrocking007 wrote:Hi everyone i guess the topic tells it all i have made a save.dat file but lets say i saved to much it and it became full or i made a made a magic folder and linked it to a folder in porteus can you show me a way to findout how much space i have used in the save.dat file would appreciate an answer..... :D
I understand. Been there, done that. Save this script to your /home/guest/ folder:

savedatspaceused.sh

Code: Select all

#!/bin/sh
#  http://forum.porteus.org/viewtopic.php?f=81&t=1941&start=15#p13272
#  http://forum.porteus.org/viewtopic.php?f=117&t=3205&p=25099#p25097

# Color definitions
txtbld=$(tput bold)               # Bold
txtred=${txtbld}$(tput setaf 1)   # Red
rst=$(tput sgr0)                  # Reset

function redpswd() {
  echo -e "$1" $txtred  
}

if [ `whoami` != "root" ]; then
    redpswd "Enter root's password"
    su -c "sh $0 $1"
    exit
fi
echo $rst

if [ -a /mnt/live/memory/images/changes ]; then
   SPACEDATDIR=/mnt/live/memory/images/changes 
fi

echo
echo du -sh
du -sh ${SPACEDATDIR}     # Show the amount used   
echo df -h
df -h  ${SPACEDATDIR}     # Show filesystem summary
echo
du -sh ${SPACEDATDIR}/etc
du -sh ${SPACEDATDIR}/home
du -sh ${SPACEDATDIR}/opt
du -sh ${SPACEDATDIR}/root
du -sh ${SPACEDATDIR}/usr
du -sh ${SPACEDATDIR}/var
echo
In a terminal window enter: sh ./savedatspaceused.sh

You should see what you're seeking.
@ Ed_P thanks a lot your script is awesome and it told precicely what i wanted to know :lol:
Here is the result of the script
Image

Re: How to find out the space used in save.dat file

Posted: 23 Jun 2015, 04:43
by anandisrocking007
donald wrote:@ anandisrocking007
sorry,my bad
you have to reboot into the "allways fresh" mode to make it work.(mloop the save.dat)

hmm..doesn't a df -h /mnt/live/memory/changes/
(normal boot) show the save file values.?
Thanks a lot in telling me that you can only loop the save.dat file in freshor copy2ram mode i thought i was doing something wrong they should add this line in the the porteus tutorial. But the df -h /mnt/live/memory/changes/ does not show the value i think it shows the amount of memory used in ram or so
Bogomips wrote:

Code: Select all

guest@porteus:~$ df -h /mnt/live/memory/changes/ 
Filesystem      Size  Used Avail Use% Mounted on
-               265M  4.0M  261M   2% /mnt/live/memory/changes
guest@porteus:~$ df -h .
Filesystem      Size  Used Avail Use% Mounted on
aufs            265M  4.0M  261M   2% /
cpy2ram and not using changes, Get same values.
Nope thats not it checked it Ed_P 's script gives the right value
donald wrote:@Bogomips
normal boot with save.dat (save changes)

guest@porteus:~$ df -h /mnt/live/memory/changes/
Filesystem Size Used Avail Use% Mounted on
- 509M 37M 472M 8% /mnt/live/memory/changes

root@porteus:/home/guest# du -sh /mnt/live/memory/changes/
11M /mnt/live/memory/changes/

copy2ram without save.dat (also allways fresh)

guest@porteus:~$ df -h /mnt/live/memory/changes/
Filesystem Size Used Avail Use% Mounted on
- 606M 408K 605M 1% /mnt/live/memory/changes

root@porteus:/home/guest# du -sh /mnt/live/memory/changes/
408K /mnt/live/memory/changes/

mloop /mnt/sdb1/porteus/save.dat

guest@porteus:~$ df -h /mnt/loop/
Filesystem Size Used Avail Use% Mounted on
/dev/loop5 509M 37M 473M 8% /mnt/loop

root@porteus:/home/guest# du -sh /mnt/loop/
11M /mnt/loop/
yours only this command say the size of the save.dat file filled
mloop /mnt/sdb1/porteus/save.dat

guest@porteus:~$ df -h /mnt/loop/
Filesystem Size Used Avail Use% Mounted on
/dev/loop5 509M 37M 473M 8% /mnt/loop

Overall thanks a lot you guys for the reply now found out that 90% of my save.dat was being eaten by the google chrome cache i guess the best way is Ed_p 's Script

Re: How to find out the space used in save.dat file

Posted: 23 Jun 2015, 04:46
by Seva
ext4