loopback block device for backups

BeZazz

New member
Here is a post I just made at another forum.
Brief overview of my issue.

Live server with not enough free space for backups except on /home partition. Place backups there and quota wont work.

What I currently do is run a script after cPanel does backups that copies the backups to 2 off site servers.


I would like to keep a copy of the backups on the original server and also have quota enabled.

Is it possible to create a loopback back device from some of the space on the /home partition?

Thanks
Is what I am thinking possible?

Thanks
 
The server is actually collocated. It is in the US and I am in Australia. While adding another drive isn’t out of the question I would much rather use the space that I already have.
 
Did you want to make a file (like a .img file) which is on the home partition, with a given size, and mounted in a location (for pure example, /home/backups)?

Straight up, I cant say I am really good at this stuff - but I did have a look at a website :

http://mykospark.net/2011/04/create-loopback-filesystem-in-linux/

Im aware that this just basically explains how to make a loopback filesystem in linux - but would this apply in your situation?

I'd personally be interested in knowing - while I dont operate cpanel, I use DA, this would be interesting to know.
 
Last edited:
Thanks for the reply mate.

I just came back to post what was done regarding this then saw the post above(thought I would have received an email)

On the other forum where I posted a user " YUPAPA " answered all my questions and provided everything I needed he/she basically spoon fed me which I am grateful for.

Bellow I will paste the code I used as provide to me with no changes.

You can do the following to create a 5G backup disk
dd if=/dev/zero of=/home/backupdisk.img bs=1M count=5000
losetup /dev/loop0 /home/backupdisk.img
mkfs.ext3 /dev/loop0
mkdir /backup
mount /dev/loop0 /backup

Use another loop device if loop0 is in use. losetup -a to list all occupied devices.

If you don't need the disk anymore:
umount /backup
losetup -d /dev/loop0
rm /home/backupdisk.img

fstab
Code:
/home/backupdisk.img          /backup                    ext3    defaults,loop   0 0

It all appears to be working for me :) but I am yet to reboot the server, so I can not be 100% sure the image will auto remount.
 
That looks fine to me, but the performance during backups would drop more significantly since you are writing to the same disk. If you can do add a 2nd drive.
 
Back
Top