No Shares management from Dashboard

Re: No Shares management from Dashboard

Postby carloph » Thu Apr 19, 2018 11:49 am

Content of /md0/sbin/snapmerge

Code: Select all
root@fvdw-sta-kirkwood:/ # cat /md0/sbin/snapmerge
#!/bin/sh
#vim:filetype=sh

if [ "$#" -lt "2" ]
then
cat 1>&2 <<HERE
$0 merges Unionfs snapshots onto the base.
$0 base snap0 [ snap1 ... ]

If you want to merge two or more consecutive snapshots to create a new
snapshot, as if snap1, snap0 are two branches that are mounted over base, you
can not directly call snapmerge because whiteouts are not handled.  Instead,
you should create a new Unionfs that merges an empty directory snap10 and base
(with base=ro).  Then you can run snapmerge /mnt/unionfs snap0 snap1.  snap10
will contain the merged snapshot, with only the proper number of whiteouts.
HERE
        exit 1
fi

BASE=$1

shift

WD=`pwd`
if [ ! `echo $BASE | cut -b1` = "/" ] ; then
        BASE="$WD/$BASE"
fi

while [ ! -z "$1" ]
do
        SNAP=$1
        if [ ! -d $SNAP ] ; then
                echo "$0: $SNAP not a directory" 1>&2
                exit 1
        fi

        cd $SNAP || exit 1

        echo "Merging $SNAP onto $BASE."

        # Directories
        find . -type d | tail +2 |  sed -e 's/\.\///' |
        while read N
        do
                mkdir -p $BASE/$N
                chmod $BASE/$N --reference=$N
                touch $BASE/$N --reference=$N
        done

        # Copy Files
        find . -not \( -regex '.*/\.wh\.[^/]*' -type f \) -not -type d |  sed -e 's/\.\///' |
        while read N
        do
                cp -a $N $BASE/$N > /dev/null 2>&1
        done

        # Handle Whiteouts
        find . \( -regex '.*/\.wh\.[^/]*' -type f \) | sed -e 's/\.\///;s/\.wh\.//' |
        while read N
        do
                rm -rf $BASE/$N > /dev/null 2>&1
        done

        cd $WD
        shift
done

cd $WD

exit 0
carloph
Donator VIP
Donator VIP
 
Posts: 45
Joined: Tue Sep 09, 2014 2:01 pm

Re: No Shares management from Dashboard

Postby Mijzelf » Thu Apr 19, 2018 6:57 pm

carloph wrote:Before attempting to add telnetd, I did not understand how to search for other snaps ....
There are no others
Code: Select all
root@fvdw-sta-kirkwood:/ # ls -l /md2/snaps/
total 4
drwxr-xr-x   23 root     root          4096 Feb 20 16:03 00
So either you never updated the firmware, and the first snap contains only user settings and logs, or Lacie changed the firmware a bit. That snapmerge script seems to merge snaps (duh!). So maybe now there is only a single snap.
That makes sense. The firmware updates used to be incremental, so having all updates in different snaps didn't cost a lot of diskspace. But the newer update capsules are huge, and seem to contain an (almost) complete rootfs. By merging the snaps you delete all unnecessary files.
Jocko wrote:@Mijzelf
As root password is unknown, maybe telnetd.i should contain the same trick to overwrite the root password by the admin password ?
Maybe. I was thinking to start telnetd, just to see if it's not killed. And using the admin account you can look around on the assembled rootfs.

As far as I remember there is some nasty code in unicorn, which resets the root password in /etc/shadow. Somewhere in the nas-central forum someone found a conf file where the master root password is stored.
Another option is to delay the change of the root password, or simply add another user with uid 0.
Mijzelf
 
Posts: 254
Joined: Wed Nov 21, 2012 9:12 am

Previous

Return to Lacie 5big Network vs2

Who is online

Users browsing this forum: Google [Bot] and 5 guests