• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Input Tutorial: Create a loop device on /var/lib/psa/dumps as samba storage

B4c4rd1

Regular Pleskian
Hi Guys,

I have a new tutorial for you today. I will show you a samba share, how to create a loop device and then mount it and use this as internal backup space!

Advantages compared to a FTP storage:
  • Full access rights
  • Natural limitation of speed through your connection
  • No server lag during creation or restoration
  • Memory is used as normal as internal memory
  • really fast restore!
Difficulty: medium (does this tutorial only if you know what you are doing, false information can lead to data loss)
Testet on: Ubuntu 16.04 (further tests are welcome)

Now to the tutorial:

The tutorial assumes that you are using a FTP storage with samba support. For example, an FTP store by Hetzner.

Installing CIFS support:
Code:
apt install cifs-utils

# Create directories
Code:
mkdir /mnt/hetzner-backup-space

# Create cifs-credentials file
Code:
nano /mnt/backup-credentials.txt

# Insert the following
Code:
username=your_username
password=your_password

This file is used to protect your password if someone can read the fstab file.

Now you have to enter the following in the fstab:
Code:
//SAMBA_SERVER/backup /mnt/hetzner-backup-space cifs iocharset=utf8,rw,credentials=/mnt/backup-credentials.txt,cache=none,nobrl,file_mode=0660,dir_mode=0770,rsize=65536,wsize=130048,uid=0,gid=0 0 0

Now save the file and do the following to mount the samba storage:
Code:
mount -a

Now we create a loop device. To do this, we need an image file that we need to format. Execute the following command:

Code:
# create 100GB image, fast create for lage file sizes
dd if=/dev/zero of=/mnt/hetzner-backup-space/backup-fs.image bs=1024 count=0 seek=$[1024*1024*100]

# create an ext3 filesystem inside the image
mkfs.ext3 /mnt/hetzner-backup-space/backup-fs.image

Now we just need to include the formatted file as a loop device and link it to the /var/lib/psa/dumps folder:
Code:
mount -o loop /mnt/hetzner-backup-space/backup-fs.image /var/lib/psa/dumps

If you do not want to do this after each reboot, we have to add the following in the fstab * not yet tested!
Code:
# Insert after CIFS-Mount line
/mnt/hetzner-backup-space/backup-fs.image       /var/lib/psa/dumps       ext3       loop       0 0

Now you can use the samba storage as a your lokal storage.

As always, test the tutorial before in a virtual environment and to take notes.
 
Last edited:
More background knowledge: Why do I use a loop device and bind samba not directly?

Plesk creates in the dump folder during a update, backup files and uses the command chown. Chown does not work in a samba network folder. The process is interrupted and a error occur. The same happens with plesk repair.

In a loop device you can use all commands as well as the command chown. You can change the user, the group and so on.
 
Is this still the best way to do a Backup on NFS/ CIFS ? Or is there a better way now without Problems?
Maybe @IgorG has something?
 
Back
Top