Hello,
I'm trying to implement backups on a FreeBSD system of the data it stores (user files, databases, etc.) using an LTO-9 magnetic tape drive...
From what I've seen, there are two ways to use this drive: the traditional way with the mt and tar utilities, or the newer LTFS (the tape functions like a hard drive).
Testing environment:
A. Example whit the utilities mt and tar
mt – magnetic tape manipulating program
tar – manipulate tape archives
Load the auto rewind tape on FreeBSD: /dev/sa0
Erase the tape
View the status
Make a backup
View backup
Restore the backup
View the restore backup
Eject the tape
B. Example with LTFS (Linear Tape File System)
Required only the first time (install module, load module, start with system, insert tape, create file system, eject tape)
To use the tape (create the mounting point and mount the tape)
View tape mounted
Example of a backup using the rsync utility
To view the backup
To umount the tape and eject
After my somewhat lengthy introduction (apologies for that), I have a few questions:
In your experience, which do you think is better? Way A or way B?
In mode A, how do you perform subsequent backups without overwriting the previously made backup?
I've detected some issues in Mode B (LTFS and RSYNC). The tape seems to have problems with large file sizes or deep folders, which is why RSYNC reports that it couldn't assign attributes to some files. As a result, when RSYNC is run again, it repeatedly deletes and rewrites the same files.
Thank you for your time and recommendations!
I'm trying to implement backups on a FreeBSD system of the data it stores (user files, databases, etc.) using an LTO-9 magnetic tape drive...
From what I've seen, there are two ways to use this drive: the traditional way with the mt and tar utilities, or the newer LTFS (the tape functions like a hard drive).
Testing environment:
# mkdir /tmp/test1
# echo 'Hello World!' > /tmp/test1/file1.txt
# echo 'Hello World!' > /tmp/test1/file2.txt
# echo 'Hello World!' > /tmp/test1/file3.txt
# mkdir /tmp/test2
# echo 'Hello World!' > /tmp/test2/file1.txt
# echo 'Hello World!' > /tmp/test2/file2.txt
# echo 'Hello World!' > /tmp/test2/file3.txt
A. Example whit the utilities mt and tar
mt – magnetic tape manipulating program
tar – manipulate tape archives
Load the auto rewind tape on FreeBSD: /dev/sa0
# mt -f /dev/sa0 load
Erase the tape
# mt -f /dev/sa0 erase
View the status
# mt -f /dev/sa0 status
Make a backup
# tar -czf /dev/sa0 /tmp/test1 /tmp/test2
View backup
# tar -tzf /dev/sa0
Code:
tmp/test1/
tmp/test1/file1.txt
tmp/test1/file2.txt
tmp/test1/file3.txt
tmp/test2/
tmp/test2/file1.txt
tmp/test2/file2.txt
tmp/test2/file3.txt
Restore the backup
# mkdir /tmp/restore
# cd /tmp/restore
# tar -xzf /dev/sa0 tmp/test1 tmp/test2
View the restore backup
# find /tmp/restore | sort -n
Code:
/tmp/restore
/tmp/restore/tmp
/tmp/restore/tmp/test1
/tmp/restore/tmp/test1/file1.txt
/tmp/restore/tmp/test1/file2.txt
/tmp/restore/tmp/test1/file3.txt
/tmp/restore/tmp/test2
/tmp/restore/tmp/test2/file1.txt
/tmp/restore/tmp/test2/file2.txt
/tmp/restore/tmp/test2/file3.txt
Eject the tape
# mt -f /dev/sa0 offline
B. Example with LTFS (Linear Tape File System)
Required only the first time (install module, load module, start with system, insert tape, create file system, eject tape)
# pkg install -y ltfs
# kldload fusefs
# echo '# LTFS (Linear Tape File System)' >> /etc/rc.conf
# sysrc kld_list+=fusefs
# mt -f /dev/sa0 load
# mkltfs -d /dev/sa0 -f
# mt -f /dev/sa0 offline
To use the tape (create the mounting point and mount the tape)
# mkdir /mnt/ltfs
# ltfs -o devname=/dev/sa0 /mnt/ltfs
View tape mounted
# df -h | grep -E 'Filesystem|ltfs'
Code:
Filesystem Size Used Avail Capacity Mounted on
ltfs:/dev/sa0 16T 10M 16T 0% /mnt/ltfs
Example of a backup using the rsync utility
# rsync -av --delete /tmp/test1 /mnt/ltfs
# rsync -av --delete /tmp/test2 /mnt/ltfs
To view the backup
# ls /mnt/ltfs
Code:
test1 test2
To umount the tape and eject
# umount /mnt/ltfs
# mt -f /dev/sa0 offline
After my somewhat lengthy introduction (apologies for that), I have a few questions:
In your experience, which do you think is better? Way A or way B?
In mode A, how do you perform subsequent backups without overwriting the previously made backup?
I've detected some issues in Mode B (LTFS and RSYNC). The tape seems to have problems with large file sizes or deep folders, which is why RSYNC reports that it couldn't assign attributes to some files. As a result, when RSYNC is run again, it repeatedly deletes and rewrites the same files.
Thank you for your time and recommendations!