[Solved] Backup in another pc in the same network

Hi everybody again,
I know this could be a very strange question:
Do you think it’s possible to schedule a diet-pi’s daily backup on a drive installed in another PC in the same network?
I’m using a diet-pi as a personal cloud and I noticed it’s possible to schedule a periodical backup of the system but I saw it can be done only on a drive mounted on the board. Is this correct?
Any suggestion is much appreciated :wink:

this could be done if the 2nd system is running a NFS server. Just mount the NFS share on DietPi and should be able to backup on another system.

My 2nd system runs a ubuntu desktop. Can it be compatible with NFS server?

Usually it should be possible to run NFS server on Ubuntu

hopefully this might help
https://phoenixnap.com/kb/ubuntu-nfs-server

1 Like

thanks WarHawk for the suggestions.
I fallow the instructions until the tutorial says: “Edit NFS Export File to Grant Server Access to Clients”

At this point, giving in the terminal the command

sudo vi /etc/exports

, it opened the file but I wasn’t able to modify it and wasn’t able to close it without closing the terminal.

When I try to open that file in another terminal window it shows me this warning:

E325: ATTENTION
Found a swap file by the name "/etc/.exports.swp"
          owned by: root   dated: mar gen 18 15:28:38 2022
         file name: /etc/exports
          modified: YES
         user name: root   host name: NASCasaGhezzi
        process ID: 16408
While opening file "/etc/exports"
             dated: mer mag 12 21:30:06 2021

(1) Another program may be editing the same file.  If this is the case,
    be careful not to end up with two different instances of the same
    file when making changes.  Quit, or continue with caution.
(2) An edit session for this file crashed.
    If this is the case, use ":recover" or "vim -r /etc/exports"
    to recover the changes (see ":help recovery").
    If you did this already, delete the swap file "/etc/.exports.swp"
    to avoid this message.
"/etc/exports" 10 lines, 389 characters
Press ENTER or type command to continue

How can I fix it?

Try:

rm /etc/.exports.swp

Probably Vim is still opened as dead process, check htop and in case kill it.

Generally /etc/exports should be editable. Not sure whether it’s an issue with filesystem access or Vim. Try:

sudo nano /etc/exports

Looks like is not possible to delete it.
It says I’m not allowed :thinking:

are you root user or using sudo?

mmm Not sure. I think sudo.
this is the Output:

ghezzia@NASCasaGhezzi:~$ rm /etc/.exports.swp
rm: rimuovere il file regolare protetto dalla scrittura '/etc/.exports.swp'? Y
rm: impossibile rimuovere '/etc/.exports.swp': Permesso negato

How can I run as root?

Try following

sudo rm /etc/.exports.swp

It worked. I delated the swp file but still when I try to run

sudo vi /etc/exports

It opens the file but it doesn’t let me modify it.
Also, I can’t find any command to exit the file and go back. I should exit the terminal leaving the file pending…

I guess you need to pess i to enter the Insert mode. Now you can type in your text.

You you know how to use vi/Vim, right? Hitting exit, then typing :q and hitting return should do it. If you are not comfortable with Vim (which indeed requires some learning), I recommend to use nano:
sudo nano /etc/exports
It is a bit simpler to manage, navigate and edit via arrow buttons etc, exit via CTRL+X, where you are asked whether to save changes.

If that does not work, what are the modes of the file?

ls -l /etc/exports

EDIT: Here is a nice beginners guide for Vim. When learning it, it indeed speeds up console text editing :smiley:: https://thevaluable.dev/vim-commands-beginner/

OK, using nano, it worked perfectly.
I follow all the steps suggested till the end, but the last command sudo ufw status gives me this output:

$ sudo ufw status
Stato: inattivo

That means inactive.
but I’m not sure I need to use the ufw…
Assuming everything is correct and I don’t need ufw, should I continue with the following steps described, to set up the client in the dietpi?

Usually ufw is not needed if the system is not internet facing. On DietPi you could use dietpi-drive_manager to connect to NFS network drive

$ is user, # on command prompt is root

Either type sudo su, then user password (careful with this because you can REALLY screw up a system if you aren’t careful)

Or type

sudo command

and it will run it

As long as your dietpi machine is behind your firewall/router and you haven’t opened WAN facing ports to that particular machine/IP, you don’t need to activate UFW or any firewall for that device (unless you are really paranoid about someone hacking into your network)

Good call ghezzia and Joulinar

Let me try to explain what I’ve done:
On dietpi (installed on a pi zero) I installed ownclud in order to create my owncloud.
Since I activate also a DDNS to reach the cloud also outside my network, we installed also pi-hole to manage and try to bypass my router (vodafone) which is not able to recognize my DDNS inside my network.
Does it mean the dietpi is opened WAN facing ports to that particular machine/IP?
What you mean with

$ is user, # on command prompt is root

Either type sudo su, then user password (careful with this because you can REALLY screw up a system if you aren’t careful)

Or type
CODE: SELECT ALL

sudo command
and it will run it

?

yes in your case DietPi is reachable on port 80/443. This is the port forwarding you activated on your router.

this means that activating UFW is recommended for me, isn’t it?