How to copy the save.dat between 2 keys

Post here if you are a new Porteus member and you're looking for some help.
datruche
Black ninja
Black ninja
Posts: 95
Joined: 20 Sep 2015, 21:02
Distribution: Arch, Porteus-Nemesis 3.5
Location: London > . < Paris

How to copy the save.dat between 2 keys

Post#1 by datruche » 20 Dec 2015, 14:04

Hello lads, guys!

Let's say one wants to copy a customized Porteus 3.1 from his key to another (copy, friend's or any case)
Particularily a user's $HOME that is nice and all, and some added/built modules.
Same case if a user wants to push some changes he did on e.g. test-stick to his spouse-stick.

From http://www.porteus.org/tutorials/19-recovery.html
To access the files in a .dat file container, you can use the mloop command, e.g.:

Code: Select all

mloop /mnt/sdb1/porteus/oldsave.dat
oldsave.dat container will be mounted at /mnt/loop/ and you can copy your files from that location to another temporary location, such as /tmp/oldsave/, then unmount the old container:

Code: Select all

uloop
Well I tried that and `mloop /path/to/present/changes.dat` mounts to /mnt/loop (all fine till that point). Which is 100% empty.
On the opposite, `mloop /other/stick/path/to/changes.dat`mounts to /mnt/loop and shows the existing porteus files saved on that .dat.
To achieve my goal, with the destination changes.dat still mounted I
* copied/replaced the dotfiles/dirs from /home/USER to /mnt/loop/home/USER/, and
* copied the new modules to /mnt/spouse-stick/path/to/porteus/{modules,optional}, (both are Porteus-3.1-i486), eventualy replacing the older e.g. 04-firefox.xzm (v31) with the newer one (v38)

Is it OK to do like this? If closing apps like Firefox before synchronizing e.g. ~/.mozilla to the other, mounted changes.dat?
If so, shouldn't the FAQ clarifies that: if using a .dat file, it has to be unused ? And add a part like « How to copy or synchronize your changes from a running live Porteus to another changes.dat/USB stick with Porteus?

Also I tried to use the Porteus tool to enlarge a .dat file
ANd while it says "Your changes will be saved" (if I remember it well), upon editing that stick porteus.cfg to point to the new, bigger changes.dat none of my customization were preserved.

Oh and a last question.
Quoting Georges from [SOLVED] Can't Save Changes on a Live USB
George wrote:
brokenman wrote:You porteus.cfg file looks good. Your cheatcode looks good. Lets try one more time from the beginning and if changes aren't working we will move onto creating a linux file system partition if that is an option.

Please create your porteussave.dat and change the name to mysave.dat (just to remove confusion) and place it on the root of your USB device. That means on the USB device you should have the folder boot, porteus and a file called mysave.dat
Be sure that you have only one install of porteus on the USB, and that no hard drive porteus install might be getting picked up.

Here are the changes= cheatcodes you should try.

changes=/dev/sdb1/mysave.dat
changes=/mnt/sdb1/mysave.dat
changes=UUID:E8FB-6830/mysave.dat

If you see the message during boot about creating the .dat file then the changes= code did not work.
I followed these instructions and still couldn't make it to save changes. After I reboot I'm back to where I started, even though I can see the mysave.dat file in the USB root.
All the `changes.dat` path in y porteus.cfg are relative to the *root* of the sticks e.g.

Code: Select all

changes=/multi/porteus/changes.dat
and I've always found the changes back upon rebooting (but when forgetting I started with`toram` :}).
So what's the point in bothering the newbies with UUID and else exactly? Note: I've been using Porteus 3.1 on a few sticks for a couple of months, with up to a few sticks plugged in (after boot!).

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

Re: How to copy the save.dat between 2 keys

Post#2 by Ed_P » 20 Dec 2015, 18:33

Do you have a hard drive available to write to?
Ed

datruche
Black ninja
Black ninja
Posts: 95
Joined: 20 Sep 2015, 21:02
Distribution: Arch, Porteus-Nemesis 3.5
Location: London > . < Paris

Re: How to copy the save.dat between 2 keys

Post#3 by datruche » 20 Dec 2015, 23:17

Yeah sure!

Also booted into stick #2; $HOMEs' content are updated; modules are updated but not the system (missing icons on XFCE panel, passwd..). Obviously :oops: without sync'in the whole source .dat file to the #2.

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

Re: How to copy the save.dat between 2 keys

Post#4 by Ed_P » 21 Dec 2015, 00:24

datruche wrote:Yeah sure!
Well then, if you :
add the copy2ram cheatcode to the Always Fresh boot menu option,
boot the system you wish to copy the save.dat file from in Always Fresh mode,
you can then use the file manager to copy the save.dat file to the hard drive,
remove the flash drive,
insert the #2 flash drive,
rename the save.dat file on the #2 flash drive to .old or .bkup,
then write the save.dat file from the hard drive to the #2 flash drive.

If each flash drive is configured to use the same desktop, when you reboot the #2 flash drive it should work ok. If the #2 flash drive has it's own bookmarks, network settings, etc, they will be replaced with those in the copied save.dat.

HTH
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: How to copy the save.dat between 2 keys

Post#5 by Bogomips » 21 Dec 2015, 00:41

@Ed_P

Think you can save one sequence by using the copy2ram boot option as AF is part of the make up, if my memory serves me right. :wink:
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

datruche
Black ninja
Black ninja
Posts: 95
Joined: 20 Sep 2015, 21:02
Distribution: Arch, Porteus-Nemesis 3.5
Location: London > . < Paris

Re: How to copy the save.dat between 2 keys

Post#6 by datruche » 21 Dec 2015, 01:05

Thanks Ed_P
OK! And I forgot to say I'd like to resize the .dat (enlarge it). Is there a way to do that?

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

Re: How to copy the save.dat between 2 keys

Post#7 by Ed_P » 21 Dec 2015, 05:16

Bogomips wrote:Think you can save one sequence by using the copy2ram boot option as AF is part of the make up,
Yup, the Copy to RAM menu option looks like it would work. Thanks Bogomips. :beer:

Code: Select all

LABEL fresh
MENU LABEL Always Fresh
KERNEL vmlinuz
APPEND initrd=initrd.xz nomagic base_only norootcopy 
TEXT HELP
    Normally Porteus saves all changes
    to the /porteus/changes/ directory
    on the boot media (if writable)
    and restores them next boot.
    Use this option to start a fresh
    system, changes are not read from
    or written to any device
ENDTEXT

LABEL copy2ram
MENU LABEL Copy To RAM
KERNEL vmlinuz
APPEND initrd=initrd.xz copy2ram 
TEXT HELP
    Run Porteus the same as above,
    but first copy all data to RAM
    to get a huge speed increase
    (needs >512MB)
ENDTEXT
datruche wrote:I'd like to resize the .dat (enlarge it). Is there a way to do that?
Yes, use the same tool you used to create it.
Ed

datruche
Black ninja
Black ninja
Posts: 95
Joined: 20 Sep 2015, 21:02
Distribution: Arch, Porteus-Nemesis 3.5
Location: London > . < Paris

Re: How to copy the save.dat between 2 keys

Post#8 by datruche » 21 Dec 2015, 21:58

Sorry I still have trouble resizing the dat file while preserving the changes on a live session.
Ed_P wrote:
Bogomips wrote:Think you can save one sequence by using the copy2ram boot option as AF is part of the make up,
Sorry "sequence" and "AF" are Zulu language to me :ROFL:
Ed_P wrote:
datruche wrote:I'd like to resize the .dat (enlarge it). Is there a way to do that?
Yes, use the same tool you used to create it.
datruche wrote:I tried to use the Porteus tool to enlarge a .dat file
ANd while it says "Your changes will be saved" (if I remember it well), upon editing that stick's porteus.cfg to point to the new and bigger changes.dat, none of my customization were preserved.
Recall: mloop the in used changes.dat resulted in an empty content.

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

Re: How to copy the save.dat between 2 keys

Post#9 by brokenman » 21 Dec 2015, 22:23

Sorry I still have trouble resizing the dat file while preserving the changes on a live session.
You should boot into 'Always fresh' or 'copy2ram' mode so no changes are being actively saved to the savefile you want to expand.

# Mount your old save file
mkdir /mnt/loop
mount -o loop /path/to/old/save.dat /mnt/loop

# Create a new one
dd if=/dev/zero of=/tmp/newsavefile.dat bs=1024 count=10000 <--- 10000 creates a 10MB save file
mkfs.ext4 /tmp/newsavefile.dat

# Mount your new save file
mkdir /mnt/loop2
mount -o loop /tmp/newsavefile.dat /mnt/loop2

# Copy over the data
cp -a /mnt/loop/* /mnt/loop2/

# Unmount everything
umount /mnt/loop && umount /mnt/loop2
How do i become super user?
Wear your underpants on the outside and put on a cape.

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

Re: How to copy the save.dat between 2 keys

Post#10 by Ed_P » 21 Dec 2015, 22:28

datruche wrote:Sorry I still have trouble resizing the dat file while preserving the changes on a live session.
Ed_P wrote:
Bogomips wrote:Think you can save one sequence by using the copy2ram boot option as AF is part of the make up,
Sorry "sequence" and "AF" are Zulu language to me :ROFL:
"Sequence" think "step" as in the list of things I said to do.
"AF" shorthand for Always Fresh.
Ed_P wrote:
datruche wrote:I'd like to resize the .dat (enlarge it). Is there a way to do that?
Yes, use the same tool you used to create it.
In AF mode;
click on the Porteus Menu,
click on System Tools,
click on Porteus save file Manager.
When the Savefile Manager window opens click on the 2nd option from the top.
When the Resize existing savefile window opens enter the name of the existing save.dat file you want to expand into the Existing file box.

I'll let you figure out the New location and New size boxes.

Then edit the Porteus.cfg menu to point to the expanded save.dat file.
datruche wrote:I tried to use the Porteus tool to enlarge a .dat file
ANd while it says "Your changes will be saved" (if I remember it well), upon editing that stick's porteus.cfg to point to the new and bigger changes.dat, none of my customization were preserved.
And you followed the steps/sequence listed above? A new save.dat file will indeed be new, and empty. To expand an existing save.dat file you need to use the 2nd option.
Ed

datruche
Black ninja
Black ninja
Posts: 95
Joined: 20 Sep 2015, 21:02
Distribution: Arch, Porteus-Nemesis 3.5
Location: London > . < Paris

Re: How to copy the save.dat between 2 keys

Post#11 by datruche » 21 Dec 2015, 23:01

> In AF mode.

OK that's what I missed in your appreciated help; there was much fuss arround that bit of info to pay attention to and I missed it.

@françois, @brokenmann That step (ok, sequence ;)) is nowhere to be seen in "Resize existing savefile", which is confusing. And "existing changes won't be ARE lost if not in Always Fresh.

Out ouf curiosity, what makes the following sequence(*) fail, technicaly?
In default Live mode

Code: Select all

cp /path/to/changes-inuse.dat /another/place/oldchanges.dat
sync
mount /another/place/oldchanges.dat /mnt/loop -o loop

mount: wrong fs type, bad option, bad superblock on /dev/loop14,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so
(*) better use that string while it's fresh, ah!

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

Re: How to copy the save.dat between 2 keys

Post#12 by Ed_P » 22 Dec 2015, 00:15

datruche wrote:@françois,
We are cousins but I'm not him. :lol:
That step (ok, sequence ;)) is nowhere to be seen in "Resize existing savefile", which is confusing.
Could be stated a bit clearer but even in Windows manipulating a file in use can be awkward.
Out ouf curiosity, what makes the following sequence(*) fail, technicaly?
In default Live mode

Code: Select all

cp /path/to/changes-inuse.dat /another/place/oldchanges.dat
If the file is in use see the above comment.
Ed

datruche
Black ninja
Black ninja
Posts: 95
Joined: 20 Sep 2015, 21:02
Distribution: Arch, Porteus-Nemesis 3.5
Location: London > . < Paris

Re: How to copy the save.dat between 2 keys

Post#13 by datruche » 22 Dec 2015, 02:37

Ed you're in the Porteus team too?

Yeah, LVM snapshots (and their windows equivalent) powa!
To put it clear, atm the Porteus "Resize Save File" window lies (but if launched in AF mode).

*.dat file, if you read the sequence posted above, has been copied to another drive, fs sync'ed, and still its copy cant be mounted? I'm wondering what's the technical bit that's causing this.

EDIT: last phrase for clarity.

Post Reply