tools for merging sfs's

Issues and / or general discussion relating to Puppy

Moderator: Forum moderators

Post Reply
williwaw
Posts: 1938
Joined: Tue Jul 14, 2020 11:24 pm
Has thanked: 170 times
Been thanked: 368 times

tools for merging sfs's

Post by williwaw »

I need to merge the directories from multiple sfs's into a single sfs.

I can mount the multiple source sfs's and copy out the files and folders with rox to a target directory, but not sure rox is the way to go.

the preferred tool?
Doesn't have to have a gui.

williams2
Posts: 1062
Joined: Sat Jul 25, 2020 5:45 pm
Been thanked: 305 times

Re: tools for merging sfs's

Post by williams2 »

If the sfs files are being used by the Puppy OS that you are using,
then the sfs files are alread mounted, in my OS in /initrd/.

My remaster script is something like this:

Code: Select all

# copy stuff
rsync -av /initrd/pup_a/ /tmp/a1
rsync -av --exclude=.wh.* /initrd/pup_rw/ /tmp/a1

# here I remove stuff, like this (cd first):
rm -rf .dbus .cache .thumbnails .XLOADED

# make a new adrv.sfs
mksquashfs a1 out.sfs

All your personal stuff will be in the new adrv.sfs.
Good for your own personal OS.
Not good if you intend to publish your own Puppy variant, for people to download and use.

User avatar
amethyst
Posts: 2414
Joined: Tue Dec 22, 2020 6:35 am
Has thanked: 57 times
Been thanked: 504 times

Re: tools for merging sfs's

Post by amethyst »

williwaw wrote: Sun Jun 05, 2022 8:18 pm

I need to merge the directories from multiple sfs's into a single sfs.

I can mount the multiple source sfs's and copy out the files and folders with rox to a target directory, but not sure rox is the way to go.

the preferred tool?
Doesn't have to have a gui.

Try my suite. See link in my signature.

User avatar
rockedge
Site Admin
Posts: 6539
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 2746 times
Been thanked: 2620 times
Contact:

Re: tools for merging sfs's

Post by rockedge »

I've used @amethyst's suite for merging SFS with good results.

If one is willing to tinker, this script (written by rufwoof) could be adapted to merge directory file systems into a single SFS.
This is a prototype tool for KLV and WDL systems.

Rename each directory to merge like this -> 30changes, 31changes, 32changes
run the script and it will merge all the XXchanges directories into 30changes.sfs

Just modify in the script the names and path to the directory holding the group of directories to merge to meet your needs

merge-changes.sh

Code: Select all

#!/bin/bash
# merge-changes.sh
# Merge multiple xxchanges.sfs into one (02changes.sfs and all prior NNchanges.sfs
# changes sfs files are removed once merged)

# format of what we're looking to achieve .. (note that c is the lowest (first)
# i.e. should correspond to 02changes.sfs, b is the next lowest (03changes.sfs)
# and a is the highest (04changes.sfs)) ...
#    mount -t overlay overlay -o lowerdir=/mnt/L/a:/mnt/L/b:/mnt/L/c /mnt/L/m
# As we're mounting read only (to create a sfs from) we don't need upper or work
# Note that we mount each NNchanges.sfs to a mount point named the same
# i.e. /mnt/L/NNchanges.sfs, which are all merged into /mnt/L/m ... and
# we use that /mnt/L/m to create the new 02changes.sfs 

cd </folder/holding/XXchanges>

mkdir /mnt/L 
mkdir /mnt/L/m
unset lower

for addlayer in `ls *changes.sfs | sort -Vr`; do # sorted in reverse order
	[ -z $lower ] && lower=/mnt/L/${addlayer} || lower="${lower}:/mnt/L/${addlayer}"
	mkdir -p "/mnt/L/$addlayer"
	mount $addlayer /mnt/L/$addlayer
done
sync
mount -t overlay overlay -o lowerdir=$lower /mnt/L/m
mksquashfs /mnt/L/m CHANGES.sfs -comp lz4 -Xhc
sync
umount /mnt/L/m
umount /mnt/L/*changes.sfs  # release all mounted sfs's
sync
rmdir /mnt/L/*changes.sfs
rm -rf /mnt/L
rm *changes.sfs
mv CHANGES.sfs 30changes.sfs
Post Reply

Return to “Users”