Changes

From Amahi Wiki
Jump to: navigation, search
465 bytes removed ,  03:23, 23 June 2020
* Using a "terminal" session, login in using the "root" user ID.
* The "device name" of the drive needs to be determined.
<blockquote> Enter the following command:
dmesg
</blockquote>
<blockquote>The following information is displayed:
<pre>[11122.304178] usb 2-4: new high-speed USB device number 5 using ehci_hcd
[11122.422152] usb 2-4: New USB device found, idVendor=0bc2, idProduct=3320
.
.
[11123.516813] sdb: sdb1</pre></blockquote>
* The "device name" is "sdb1".
* The USB drive needs to be "unmounted".
<blockquote>
umount /dev/sdb1
</blockquote>
* Format drive for ext3 filesystem and set drive label name as "usbdisk".
<blockquote>
mkfs -t ext3 -v -L usbdisk /dev/sdb1
</blockquote>
:'''Please Note: THIS WILL ERASE ALL DATA ON /dev/sdb1, MAKE SURE THIS IS THE CORRECT USB DRIVE AND NOT ANOTHER DRIVE.'''
<blockquote>The following information is displayed:
<pre>mke2fs 1.42.5 (29-Jul-2012)
fs_types for mke2fs.conf resolution: 'ext3'
.
.
Writing superblocks and filesystem accounting information: done</pre></blockquote>
* Whenever a drive is formatted in Linux, about 5% is reserved of the total space on the drive for the operating system to continue using the hard drive to operate, even if it gets full. This is totally unnecessary for a USB external hard drive if it stores only data and not to run an operating system.
<blockquote> Enter the following to remove the reserved space:
tune2fs -m 0 /dev/sdb1
</blockquote><blockquote>The following information is displayed:
tune2fs 1.42.5 (29-Jul-2012)
Setting reserved blocks percentage to 0% (0 blocks)
* In the previous section the device name found found via the "dmesg" command. The device name found was "sdb1".
* We set the set the external drive's "label". It was set to "usbdisk".
<blockquote> To find the label at anytime via the "root" user ID enter:
e2label /dev/sdb1
</blockquote><blockquote>The following information is displayed:
usbdisk
</blockquote>
Both methods of mounting will be controlled by the server's "fstab" configuration file. The fstab (a.k.a. file systems table) file is a system configuration file containing lists of available disks and disk partitions, and indicates how they are to be initialized or otherwise integrated into a system's file system. When the "mount" command is used, the fstab file is read to determine which options should be used when mounting a specified device.
* Navigate to the "etc" directory with the "cd" command and make a backup of the current fstab file.
<blockquote> cd /etc
cp /fstab /fstab_bak
</blockquote>
* Using a preferred file editor (i.e. vi, nano), open the fstab file.
<blockquote> fstab</blockquote>
* Near the bottom of the and after the other fstab entries, add the following:
<blockquote> LABEL=usbdisk /media/usbdisk ext3 defaults 0 0</blockquote>
* Now save the fstab file and exit the editor.
* Navigate to the /media directory and create a "usbdisk" directory. This is where the external drive will be mounted, this is called a "mount point".
<blockquote><pre> cd /media mkdir usbdisk</pre></blockquote>
* Make sure the external drive USB cable is connected to the server and is powered up.
* Navigate to the "etc" directory with the "cd" command and make a backup of the current fstab file.
<blockquote> cd /etc
cp /fstab /fstab_bak
</blockquote>
* Using a preferred file editor (i.e. vi, nano), open the fstab file.
<blockquote> nano fstab</blockquote>
* Near the bottom of the and after the other fstab entries, add the following:
<blockquote> LABEL=usbdisk /media/usbdrive ext3 rw,noauto,users,exec,noatime 0 0</blockquote>
* Now save the fstab file and exit the editor.
* Navigate to the /media directory and create a "usbdisk" directory. This is where the external drive will be mounted, this is called a "mount point".
<blockquote> cd /media mkdir usbdrive</blockquote>
* Make sure the external drive USB cable is connected to the server and is powered up.
* Reboot the server.
* Start a "terminal" session login as the "root" user ID.
* To manually mount the external drive issue the following command:
<blockquote> mount -L usbdisk</blockquote>
* The system reads the fstab, when it finds a line entry with the label "usbdrive", it mounts the drive the mount point, "/media/usbdisk".
* Start a "terminal" session login as the "root" user ID.
* Issue the following command to unmount the external drive:
<blockquote> umount /media/usbdrive</blockquote>
* Should an error occur indicating that the drive is busy and cannot be unmounted enter the command below. Then try the unmount command again.
<blockquote> fuser -km /media</blockquote>
===Installing rsnapshot===
===Email reporting===
* To email a report of backups:
<blockquote>{{Code| cp /usr/share/doc/rsnapshot*/utils/rsnapreport.pl /root chmod 744 rsnapreport.pl}}</blockquote>
'''*''' above indicates an rsnapshot version number
* Add the following to crontab for a weekly email report on rsnapshot:
<pre style="white-space: pre-wrap; word-break:keep-all;">0 */4 * * * /usr/bin/rsnapshot hourly 2>&1 | /root/rsnapreport.pl > /root/rsnapreport:00 22 * * 6 /usr/bin/rsnapshot du >> /root/rsnapreport | nail –r "somereturnadress@provider.com" -s"HDA backup report" -S smtp=smtp.yourprovider.com youremail@provider.com < /root/rsnapreport</pre>
'''Please Note:''' The above information maybe out of date due to technology changes. Please feel to update as required.
Create a //hda/backup share in the HDA webinterface
: chkconfig nfs --level 2345 on
add a read only NFS export:
: nano /etc/exports
add
: /media/usbdisk/.private/.snapshots/ 127.0.0.1(ro,no_root_squash)
Save file
Unfortunately mounting an NFS share in fstab did not work on my machine after a reboot, so I chose an alternative configuration that mounts the share later in the booting process:
: nano /etc/rc.local
Add
: mount -r -t nfs localhost:/media/usbdisk/.private/.snapshots/ /var/hda/files/backup/
save file
[[Category: Apps]]
12,424

edits