Scratch File Tool

Filemanagers, partitioning tools, etc.
Message
Author
emil
Posts: 633
Joined: Tue 10 Nov 2009, 08:36
Location: Austria
Contact:

scratchfiles

#16 Post by emil »

Hello all, scottman, amigo!

thank you all for for the great and informative replies!
A few questions come to my mind:

1) What is the main advantage to have different scratchfiles? If I need diskspace of 5G is it not sufficient to blow up the already existing puppy-savefile?

2) Is it possible to lock down the NTFS partition (i.e is it possible to have the scratchfile and savefile working, but the rest locked)?

I did some research on this topic, chmod does not work on NTFS drives in Puppy. It is probably because the basic support for file permissions is not included by default in the ntfs-3g drivers. I read about it here:
http://b.andre.pagesperso-orange.fr/permissions.html

Maybe there is another possibility or workaround I am not aware of, but if not its not a big problem.

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

Re: scratchfiles

#17 Post by sc0ttman »

emil wrote:1) What is the main advantage to have different scratchfiles? If I need diskspace of 5G is it not sufficient to blow up the already existing puppy-savefile?
Well, a very large pupsave file will do a similar job, but here is the benefit, for me at least...
With a scratch file, I was able to have a ext3 filesystem/partition sitting on any drive I wanted..

This was much needed, until I dug out an old 4gb ATA disk from the loft.

I was using the scratch file to store a lot of files and pets I was making (vlc-gtk, others), that required file permissions to be set correctly, so could not be stored on FAT or NTFS..

(as you mention, chmod doesn't work on ntfs, but it works inside a scratch file, on an ntfs drive...)

Also, I was able to mount this scratch file in any puppy I was using, as it was not tied to any particular install..
That was the main advantage of using a scratch file and not my save file.

Essentially, if someone needs an linux (ext2) working area that can be accessed whenever, they can either format a whole drive, or create a scratch file.
emil wrote:2) Is it possible to lock down the NTFS partition (i.e is it possible to have the scratchfile and savefile working, but the rest locked)?
You can mount any partition as read-only, so you could mount your NTFS partition as read-only once booted into Puppy...

This should still allow you to save to your save file, even if it is on the read-only NTFS drive..

Not sure how scratch files will work in this case, haven't tested it - I need to read and write to my drives...
But there's only 1 way to find out! :)

Sorry I can't give you any specific technical info about this!
I'm no expert myself!
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

emil
Posts: 633
Joined: Tue 10 Nov 2009, 08:36
Location: Austria
Contact:

thanks

#18 Post by emil »

Hi scott,
I'm no expert myself!
well, it's all relative ...

Helped me a lot. At least I think those scratchfiles can be very usefull, especially on windows only computers.

About the NTFS - have to try that, it its still possible to save into the savefile while whole partition is mounted read-only?! sounds like voodoo.

:cool: big *thumbs up* emil

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#19 Post by amigo »

I'm not sure how ntfs-3g will act if you try to write to a 'scratch' file while the partition itself is mounted read-only -sounds ike it won't work. But, I think this will:
mount the partition read-write, then use losetup to assign the scratch file to a device. Then use the '-o remount ro' option to mount to remount the partition as read-only (or maybe even unmount it) -the device created with losetup will still exist and be usable.

emil
Posts: 633
Joined: Tue 10 Nov 2009, 08:36
Location: Austria
Contact:

hmm...

#20 Post by emil »

Hi amigo,

thank you. That might be an important piece in my puzzle :D.

I try a short summary of the paradox: How to run puppy from a NTFS disk, "but don't touch it"

1) There is the windows installer from noryb
http://www.murga-linux.com/puppy/viewto ... 4&start=30
it could be modified, so that there is an option to use "normal" or "protected" mode ("paranoid" mode would sound good too).

"normal" mode would be like now,

"protected mode" would do a defragmentation, chkdsk and then 2 blank files would be created from windows , e.g cmd like so

Code: Select all

fsutil file createnew C:\installdir\savefile 1024000000 
fsutil file createnew C;\installdir\scratchfile.img 5G
then at first startup of puppy look if we are sitting in an NTFS partition,
If using "protected" mode, then format the 2 blank files to ext2 or ext3 like so

Code: Select all

mke2fs -g -m 0 -F /mnt/sda1/installdir/savefile
then use the losetup like so:

Code: Select all

losetup /dev/loop0 scratchfile.img
mount /dev/loop0 /home/you/dir
then unmount the NTFS partitions.

Have to try that (when time alows).
emil

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#21 Post by greengeek »

Hi Scottman, I am trying to understand this better - would you say that the main purpose of a scratch file is to create a "virtual space" on a FAT or NTFS drive (which cannot normally retain Linux permissions) within which the permissions (and symlinks?) CAN be maintained correctly?

Are there other benefits you have found?
cheers!

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#22 Post by amigo »

Yeah, that's right. What he called a scratch file is simply a file which is mounted via the kernels loopback device -created explicitly with 'losetup' or with 'mount -t loop). This works with any file system. The file (formatted with a filesystem) resides on the 'host' filesystem as a a single item -the direntry function doesn't know anything about the content.
This all work fine on NTFS -even without ntfs-3g. The native read-write mode of the kernels ntfs driver could even handle this. The difficult thing is getting the file created on the NTFS in a sane way -which means that it will pass checkdisk. Of course, creating the file under windows would be best -but not really what we want. The kernel-native RW ntfs driver will not work nicely for this, ntfs-3g would be better for creating the new file on NTFS -and for mounting the device for later access to and mounting of the file with the loopback device. The file can be formatted to whatever you like.

Post Reply