Save.dat / changes confusion

Technical issues/questions of an intermediate or advanced nature.
Bogomips
Full of knowledge
Full of knowledge
Posts: 2564
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: Save.dat / changes confusion

Post#31 by Bogomips » 09 Aug 2016, 23:16

Point being made is no need to run a script to check up. Just a simple ls -sh / du -h would suffice to check occupancy of file, and makes it easy for user to keep tabs on file. Downloading 5 videos, and being taken by the hand by the shutdown script could be seen as an added luxury.
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB

User avatar
Ed_P
Contributor
Contributor
Posts: 8343
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: Save.dat / changes confusion

Post#32 by Ed_P » 09 Aug 2016, 23:49

Bogomips wrote: luxury.
:shock: Helping a user of your system to not loose all their files could hardly be called a luxury. Do you consider security updates a luxury? Driver support for new hardware? Obviously we disagree. But I now have a system that will help me so it's a moot point. :)
Ed

Bogomips
Full of knowledge
Full of knowledge
Posts: 2564
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: Save.dat / changes confusion

Post#33 by Bogomips » 10 Aug 2016, 00:29

It's all a matter of relativity. Looking at it from the point of view of the mountain of work facing brokenman to get out this release all shipshape, there are more essential issues to be resolved like the blueing out of the cinnamon screen, vlc crashing cinnamon, etc.
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: Save.dat / changes confusion

Post#34 by brokenman » 10 Aug 2016, 01:05

I understand the point being made here. Porteus has gone without a save.dat space checker until now. It can continue a little longer until more pressing issues are ironed out. It is on my TODO list which has a priority order. I think the word luxury here meant that once the house is built firmly we can add the luxuries.

Thanks for the valuable input here guys.
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
Ed_P
Contributor
Contributor
Posts: 8343
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: Save.dat / changes confusion

Post#35 by Ed_P » 10 Aug 2016, 01:23

Bogomips wrote:Point being made is no need to run a script to check up. Just a simple ls -sh / du -h would suffice to check occupancy of file, and makes it easy for user to keep tabs on file.
I must be missing something. It's not that easy from what I see using those commands.

Code: Select all

guest@porteus:~$ ls -sh /mnt/sda5/porteus3.0/changes/porteussave.dat
512M /mnt/sda5/porteus3.0/changes/porteussave.dat*

guest@porteus:~$ du -h /mnt/sda5/porteus3.0/changes/porteussave.dat
512M	/mnt/sda5/porteus3.0/changes/porteussave.dat

guest@porteus:~$ ls -sh /mnt/live/memory/changes
total 0
0 dev/  0 etc/  0 home/  0 mnt/  0 root/  0 tmp/  0 usr/  0 var/

guest@porteus:~$ du -h /mnt/live/memory/changes
du: cannot read directory ‘/mnt/live/memory/changes/root’: Permission denied
0	/mnt/live/memory/changes/root
0	/mnt/live/memory/changes/tmp/.wine-1000/server-10-12db
0	/mnt/live/memory/changes/tmp/.wine-1000
54M	/mnt/live/memory/changes/tmp/google-chrome/Cache
54M	/mnt/live/memory/changes/tmp/google-chrome
0	/mnt/live/memory/changes/tmp/.X11-unix
54M	/mnt/live/memory/changes/tmp
0	/mnt/live/memory/changes/var/cache/cups/rss
8.0K	/mnt/live/memory/changes/var/cache/cups
du: cannot read directory ‘/mnt/live/memory/changes/var/cache/ldconfig’: Permission denied
0	/mnt/live/memory/changes/var/cache/ldconfig
8.0K	/mnt/live/memory/changes/var/cache
du: cannot read directory ‘/mnt/live/memory/changes/var/db/sudo’: Permission denied
 :
 :
 :
 :
8.0K	/mnt/live/memory/changes/home/guest/.config/google-chrome/Default/Local Storage
28K	/mnt/live/memory/changes/home/guest/.config/google-chrome/Default/GPUCache
4.5M	/mnt/live/memory/changes/home/guest/.config/google-chrome/Default
27M	/mnt/live/memory/changes/home/guest/.config/google-chrome
27M	/mnt/live/memory/changes/home/guest/.config
43M	/mnt/live/memory/changes/home/guest
43M	/mnt/live/memory/changes/home
103M	/mnt/live/memory/changes
guest@porteus:~$ 

guest@porteus:~$ ls -sh /mnt/live/memory/images/changes
total 8.0K
4.0K etc/     0 home/     0 opt/  4.0K root/     0 usr/     0 var/
guest@porteus:~$ 

guest@porteus:~$ du -h /mnt/live/memory/images/changes
 :
 :
 :
0	/mnt/live/memory/images/changes/home/guest/.cache/keyring-LI3E4M
0	/mnt/live/memory/images/changes/home/guest/.cache/keyring-ba6wgg
0	/mnt/live/memory/images/changes/home/guest/.cache/keyring-mroWKz
0	/mnt/live/memory/images/changes/home/guest/.cache/keyring-OFnuAT
0	/mnt/live/memory/images/changes/home/guest/.cache/keyring-HpeGzz
0	/mnt/live/memory/images/changes/home/guest/.cache/keyring-XERJ8r
0	/mnt/live/memory/images/changes/home/guest/.cache/keyring-tlE6Yc
0	/mnt/live/memory/images/changes/home/guest/.cache/keyring-NhXdeJ
0	/mnt/live/memory/images/changes/home/guest/.cache/keyring-tBUnvV
0	/mnt/live/memory/images/changes/home/guest/.cache/keyring-rkIcUA
0	/mnt/live/memory/images/changes/home/guest/.cache/keyring-DgKgEP
0
 :
 :
 :
368K	/mnt/live/memory/images/changes/home/guest/.local/share/icons/hicolor
368K	/mnt/live/memory/images/changes/home/guest/.local/share/icons
8.0K	/mnt/live/memory/images/changes/home/guest/.local/share/mime/image
20K	/mnt/live/memory/images/changes/home/guest/.local/share/mime/application
4.0K	/mnt/live/memory/images/changes/home/guest/.local/share/mime/text
44K	/mnt/live/memory/images/changes/home/guest/.local/share/mime/packages
4.0K	/mnt/live/memory/images/changes/home/guest/.local/share/mime/message
112K	/mnt/live/memory/images/changes/home/guest/.local/share/mime
0	/mnt/live/memory/images/changes/home/guest/.local/share/desktop-directories
0	/mnt/live/memory/images/changes/home/guest/.local/share/Trash/info
0	/mnt/live/memory/images/changes/home/guest/.local/share/Trash/files
0	/mnt/live/memory/images/changes/home/guest/.local/share/Trash
524K	/mnt/live/memory/images/changes/home/guest/.local/share
524K	/mnt/live/memory/images/changes/home/guest/.local
8.0K	/mnt/live/memory/images/changes/home/guest/.config/autostart
4.0K	/mnt/live/memory/images/changes/home/guest/.config/lxterminal
4.0K	/mnt/live/memory/images/changes/home/guest/.config/keepassx
4.0K	/mnt/live/memory/images/changes/home/guest/.config/leafpad
76K	/mnt/live/memory/images/changes/home/guest/.config/spacefm
 :
 :
 :
4.0K	/mnt/live/memory/images/changes/var/log/packages
du: cannot read directory ‘/mnt/live/memory/images/changes/var/log/setup/tmp’: Permission denied
0	/mnt/live/memory/images/changes/var/log/setup/tmp
0	/mnt/live/memory/images/changes/var/log/setup
4.8M	/mnt/live/memory/images/changes/var/log
216K	/mnt/live/memory/images/changes/var/usm/slackwarepatches
644K	/mnt/live/memory/images/changes/var/usm/ponce
580K	/mnt/live/memory/images/changes/var/usm/slacky
1.3M	/mnt/live/memory/images/changes/var/usm/slackware
700K	/mnt/live/memory/images/changes/var/usm/salix
448K	/mnt/live/memory/images/changes/var/usm/alien
9.2M	/mnt/live/memory/images/changes/var/usm/slackonly
2.8M	/mnt/live/memory/images/changes/var/usm/sbo
224K	/mnt/live/memory/images/changes/var/usm/local
16M	/mnt/live/memory/images/changes/var/usm
37M	/mnt/live/memory/images/changes/var
215M	/mnt/live/memory/images/changes
A whole lot clearer with our script.

Code: Select all

guest@porteus:~$ savedatspaceck.sh
save.dat file 52% full.  Used: 260M  Free: 249M
guest@porteus:~$ 

-update-
brokenman posted while I was composing.
Last edited by Ed_P on 10 Aug 2016, 01:36, edited 1 time in total.
Ed

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: Save.dat / changes confusion

Post#36 by brokenman » 10 Aug 2016, 01:33

As an example

ls -sh /mnt/sda5/porteus3.0/changes/porteussave.dat
du -sh /mnt/live/memory/changes

BTW: I would advise when coding arithmetic to work in bytes.
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
Ed_P
Contributor
Contributor
Posts: 8343
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: Save.dat / changes confusion

Post#37 by Ed_P » 10 Aug 2016, 01:45

Code: Select all

guest@porteus:~$ ls -sh /mnt/sda5/porteus3.0/changes/porteussave.dat
512M /mnt/sda5/porteus3.0/changes/porteussave.dat*
guest@porteus:~$ du -sh /mnt/live/memory/changes
du: cannot read directory ‘/mnt/live/memory/changes/root’: Permission denied
du: cannot read directory ‘/mnt/live/memory/changes/var/cache/ldconfig’: Permission denied
du: cannot read directory ‘/mnt/live/memory/changes/var/db/sudo’: Permission denied
du: cannot read directory ‘/mnt/live/memory/changes/var/spool/cups’: Permission denied
du: cannot read directory ‘/mnt/live/memory/changes/var/run/cups/certs’: Permission denied
du: cannot read directory ‘/mnt/live/memory/changes/etc/cups/ssl’: Permission denied
du: cannot read directory ‘/mnt/live/memory/changes/.wh..wh.orph’: Permission denied
du: cannot read directory ‘/mnt/live/memory/changes/.wh..wh.plnk’: Permission denied
103M	/mnt/live/memory/changes
guest@porteus:~$ su
Password: 
root@porteus:/home/guest# du -sh /mnt/live/memory/changes
103M	/mnt/live/memory/changes
root@porteus:/home/guest# 
Ed

Bogomips
Full of knowledge
Full of knowledge
Posts: 2564
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: Save.dat / changes confusion

Post#38 by Bogomips » 10 Aug 2016, 12:43

Ed_P wrote:
Bogomips wrote:Point being made is no need to run a script to check up. Just a simple ls -sh / du -h would suffice to check occupancy of file, and makes it easy for user to keep tabs on file.
Ed_P wrote:I must be missing something. It's not that easy from what I see using those commands.
Missing the appropriate file. :)

No need to rely on the system. Make own save file. :wink: And since we like talking script (no check for filespace or errors, just example for XFS) mksavefile.sh:

Code: Select all

savefile()
{
	dd if=/dev/null of=$1 bs=1M seek=${2:-512};        # Size in MB
	ls -lh $1
	/sbin/mkfs.xfs -b size=${3:-1024} -l internal $1;  # Block Size to Use
	file  $1
	ls -sh $1; du -h $1
	mkdir f; sudo mount $1 f
	df  -h  f
	du -sh  f
	sudo umount f
}
savefile $"
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB

User avatar
Ed_P
Contributor
Contributor
Posts: 8343
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: Save.dat / changes confusion

Post#39 by Ed_P » 10 Aug 2016, 17:17

We are talking apples & oranges imo. Space concerns for the standard porteus save.dat file verses space usage of non-standard porteus files that can used as save.dat. yes?
Ed

User avatar
Ed_P
Contributor
Contributor
Posts: 8343
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: Save.dat / changes confusion

Post#40 by Ed_P » 11 Aug 2016, 03:59

Bogomips wrote:No need to rely on the system. Make own save file. :wink: And since we like talking script (no check for filespace or errors, just example for XFS) mksavefile.sh:

Code: Select all

savefile()
{
	dd if=/dev/null of=$1 bs=1M seek=${2:-512};        # Size in MB
	ls -lh $1
	/sbin/mkfs.xfs -b size=${3:-1024} -l internal $1;  # Block Size to Use
	file  $1
	ls -sh $1; du -h $1
	mkdir f; sudo mount $1 f
	df  -h  f
	du -sh  f
	sudo umount f
}
savefile $"
In that the standard Porteus Savefile Manager creates 512 MB files in .xfs format how is this file different? :Search:
Ed

Bogomips
Full of knowledge
Full of knowledge
Posts: 2564
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: Save.dat / changes confusion

Post#41 by Bogomips » 11 Aug 2016, 11:42

Ed_P wrote:Porteus Savefile Manager creates 512 MB files in .xfs format how is this file different? :Search:
From the limited testing done so far, it looks like it could be different in that it always shows the amount of used space, but you never know until tested in real life situation. :unknown: Anyway it is there for anyone to try. 8)

Code: Select all

#!/bin/bash
# 11.08.2016
# sh mksavfile.sh	<[/Path/to/]savefile>	[ <Size of file in MB>  [ Block size for XFS ] ]
# sh mksavfile.sh	savefile.dat
# sh mksavfile.sh	MyPort/mysave.dat	256
# sh mksavfile.sh	savechanges			400		2048
savefile()
{
	dd if=/dev/null of=$1 bs=1M seek=${2:-512};        # Size in MB
	ls -lh $1
	/sbin/mkfs.xfs -b size=${3:-1024} -l internal $1;  # Block Size to Use
	file  $1
	ls -sh $1; du -h $1
	mkdir f; sudo mount $1 f
	df  -h  f
	du -sh  f
	sudo umount f
}
savefile $"
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB

Jack
Contributor
Contributor
Posts: 1857
Joined: 09 Aug 2013, 14:25
Distribution: Porteus and Nemesis
Location: USA

Re: Save.dat / changes confusion

Post#42 by Jack » 11 Aug 2016, 14:36

I try it and here it output. What do I need to do?

Code: Select all

root@porteus:/home/guest/Downloads# sh mksavfile.sh savefile.dat
mksavfile.sh: line 19: unexpected EOF while looking for matching `"'
mksavfile.sh: line 20: syntax error: unexpected end of file
root@porteus:/home/guest/Downloads# sh mksavfile.sh savefile.dat 256
mksavfile.sh: line 19: unexpected EOF while looking for matching `"'
mksavfile.sh: line 20: syntax error: unexpected end of file
root@porteus:/home/guest/Downloads#  
Here is the file I made mksavfile.sh and the code I use.

Code: Select all

#!/bin/bash
# 11.08.2016
# sh mksavfile.sh   <[/Path/to/]savefile>   [ <Size of file in MB>  [ Block size for XFS ] ]
# sh mksavfile.sh   savefile.dat
# sh mksavfile.sh   MyPort/mysave.dat   256
# sh mksavfile.sh   savechanges         400      2048
savefile()
{
   dd if=/dev/null of=$1 bs=1M seek=${2:-512};        # Size in MB
   ls -lh $1
   /sbin/mkfs.xfs -b size=${3:-1024} -l internal $1;  # Block Size to Use
   file  $1
   ls -sh $1; du -h $1
   mkdir f; sudo mount $1 f
   df  -h  f
   du -sh  f
   sudo umount f
}
savefile $"
I just like Slackware because I think it teach you about Linux to build packages where Ubuntu is like Windows you just install programs you want.

User avatar
Ed_P
Contributor
Contributor
Posts: 8343
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: Save.dat / changes confusion

Post#43 by Ed_P » 11 Aug 2016, 16:58

An initialized save.dat file created by the Porteus Savefile Manager. Unused at this point.

Code: Select all

guest@porteus:~$ file -s /mnt/sda5/porteus3.2/porteussave.dat/mnt/sda5/porteus3.2/porteussave.dat: SGI XFS filesystem data (blksz 4096, inosz 512, v2 dirs)
guest@porteus:~$ ls -sh /mnt/sda5/porteus3.2/porteussave.dat
256M /mnt/sda5/porteus3.2/porteussave.dat*
guest@porteus:~$ du -h /mnt/sda5/porteus3.2/porteussave.dat
256M	/mnt/sda5/porteus3.2/porteussave.dat
guest@porteus:~$ 
Ed

Bogomips
Full of knowledge
Full of knowledge
Posts: 2564
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: Save.dat / changes confusion

Post#44 by Bogomips » 11 Aug 2016, 19:28

The Difference:

Code: Select all

guest@porteus:~$ savefile /mnt/sda1/tmp/K3B_Space/savedchanges  256  4096
0+0 records in
0+0 records out
0 bytes copied, 0.000484226 s, 0.0 kB/s
-rw-r--r-- 1 guest users 256M Aug 11 21:10 /mnt/sda1/tmp/K3B_Space/savedchanges
meta-data=/mnt/sda1/tmp/K3B_Space/savedchanges isize=512    agcount=4, agsize=16384 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=0
data     =                       bsize=4096   blocks=65536, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=855, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
/mnt/sda1/tmp/K3B_Space/savedchanges: SGI XFS filesystem data (blksz 4096, inosz 512, v2 dirs)
3.9M /mnt/sda1/tmp/K3B_Space/savedchanges
3.9M	/mnt/sda1/tmp/K3B_Space/savedchanges
Filesystem      Size  Used Avail Use% Mounted on
/dev/loop11     253M   13M  240M   6% /home/guest/f
0	f
@Jack
Thanks for helping out. You are helping debug our scripts, and you are doing nothing wrong! :) The function works, but don't know why script is not functioning. There could be a character hidden somewhere which is gumming up the works! Will try and correct it.
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB

User avatar
Ed_P
Contributor
Contributor
Posts: 8343
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: Save.dat / changes confusion

Post#45 by Ed_P » 11 Aug 2016, 19:53

Bogomips wrote:

Code: Select all

savefile $"
The single quote character at the end the cause of the error?
Ed

Post Reply