User Login      + Register  

Table_of_Contents

1      Storage

1.1                Installing an Additional Hard Disk

1.1.1      Determine Linux Name for New Disk

1.1.2      Partition and Format New Disk

1.1.3      Mount New Disk

1.2                Backup System Partitions to Another Disk

1.3                Backup And Restore

2       

List of Figures

Figure 1:       Add Mount Entry for Disk

Figure 2:       OpenWrt Backup

1      Storage

1.1                Installing an Additional Hard Disk

Power off SecureOffice, physically install the new disk (mSATA, SATA) and boot SecureOffice.

1.1.1      Determine Linux Name for New Disk

It is assumed you are at a Linux command prompt on SecureOffice, either directly or using PuTTY.

During boot, Linux enumerates block devices (disks) and assigns them names: "sda, sdb, sdc", etc. The Linux device name of the new disk needs to be identified.

Enter "dmesg | grep sdX" repeatedly, where X increments from "b", "c", "d", etc. until you identify the correct disk.

You are looking for a portion of output (from dmesg) of the following form, corresponding to the new disk, where XXX is the disk size in GB:

"sd 2:0:0:0: [sdb] 976773168 512-byte logical blocks: (XXX GB/YYY GiB)"

If the size of the new disk is unique (only one on installation system with XXX equal to the new disk size), this is likely the correct disk (sdb, sdc, etc). Note that "sda" cannot be the correct disk, since that contains the OS of SecureOffice.

As a sanity check, to confirm the new disk candidate is correct, the disk partitions can be inspected using the "fdisk" command.

Enter "fdisk /dev/disk" where "disk" is the candidate identified above (sdb, sdc, etc).

  • Enter "p" at the fdisk prompt to display partitions. You will see the partitions for the disk.
  • No partitions indicates an unformatted disk.
  • Some partitions indicates a formatted disk.
  • Enter "q" at the fdisk prompt to exit fdisk.

If still uncertain regarding correct disk choice (candidate disk has partitions you are unsure of), another sanity check is to inspect the disk contents.

  • Enter "mount | grep /dev/disk", where "disk" is the candidate (sdb, sdc, etc.) to determine if the disk is mounted and where.
  • If the disk is mounted, you will see output of form "/dev/sdXY on" "some path", where X is the drive letter (a,b,c) corresponding to the candidate disk and Y is partition numbers.
  • If the disk is not mounted (not listed by mount command above), you can mount it to inspect the contents for each partition. Enter "mkdir /tmp/diskY; mount /dev/disk /tmp/diskY", where "disk" is the candidate disk (sdb, sdc, etc.), for each partition number (Y) identified by the fdisk command above.
  • To inspect the disk partition contents, enter "ls some path" for each mounted partition above. You will see the files on the partition. Insure (for each partition) they are files you are willing to lose.

The disk identified will be re-partitioned and formatted in the next step, wiping out all data on the chosen disk. Be absolutely certain the disk chosen is the correct disk. Otherwise, at best, you will lose all data on the disk, at worse, wipe out the SecureOffice operating system. Recovery from this disaster is left as an exercise for the reader.

1.1.2      Partition and Format New Disk

It is assumed that the new disk will contain data such as virtual machines, fileserver files such as media or documents. One partition is sufficient for this. Any existing partitions will be deleted. If multiple partitions or using an existing partition is desired, Google is your friend. Using a SecureOffice command prompt:

  • enter "fdisk /dev/sdX", where sdX corresponds to the previously identified new disk.
  • enter "p" to display existing partitions. If any partitions exist, repeatedly press "d" until none are left.
  • Enter "n' to create a new partition. Enter "p" to make it a primary partition. Enter "1" for partition number. Press "enter" to use defaults for first and last sector numbers.
  • The new partition is created and is of type Linux and uses the entire disk for partition 1.
  • enter "q" to exit fdisk.
  • enter "mkfs.ext4 /dev/sdX1" where sdX corresponds to the previously identified new disk and "1" is the partition number. This will format the new disk with the ext4 filesystem.

1.1.3      Mount New Disk

The new disk needs a mountpoint (directory) on the SecureOffice filesystem, which must be created. It is assumed that you want this disk to be mounted automatically at boot. These instructions assume you want to mount the new disk at "/home/NewDisk". Feel free to change the path to suit your tastes.

enter "mkdir -p "/home/NewDisk" to create the mount point.

enter "blkid" to determine the UUID corresponding to your new disk. You will see a response similar to: "/dev/sdX1: UUID="5ec55ff2-6e79-46ea-9228-36e0dc11a88f" TYPE="ext4" PARTUUID="63ef2a2c-01"", where sdX1 corresponds to the new disk. The UUID will be used for automatic mounting (at boot) of your new disk by adding an entry in the "/etc/config/fstab" file.

enter "nano /etc/config/fstab" and add an entry at the end for your new disk, like the figure below.

config global automount

option from_fstab '1'

option anon_mount '1'

option delay_root '5'

option check_fs '1'

 

config global autoswap

option from_fstab '1'

option anon_swap '0'

 

config 'swap'

option uuid '8a779204-4d4f-45cc-8564-9ff0670209ff'

option enabled '1'

 

config mount

option target '/home/data'

option options 'rw'

option uuid 'ea4f8d78-96b3-4fa8-b051-54abe4f5c91b'

 

config mount

option target '/home/NewDisk'

option options 'rw'

option uuid '5ec55ff2-6e79-46ea-9228-36e0dc11a88f'

Figure 1: Add Mount Entry for Disk

The last entry above defines the mount point and UUID determined above. Exit the nano editor.

enter "block mount" to mount your new disk at "/home/NewDisk"

1.2                Backup System Partitions to Another Disk

This achieves the following objectives:

  • Have a backup of SecureOffice to boot from for emergency recovery purposes (use grub menu at boot to select it).
  • Have a backup of SecureOffice to copy to a replacement system disk if the primary disk fails.
  • Replace the primary (system and data) disk with a larger disk.

There are two options for replacing the system disk:

  • Re-install SecureOffice and restore configuration from backup. This is discussed elsewhere in Install SecureOffice on Boot Device and backup and restore.
  • Copy smaller system disk partitions to new, larger disk. It is assumed that the original disk with current partitions is available.

To copy SecureOffice to a new disk:

  • Power off, install new disk, reboot
  • Save any important data from the boot disk data partition (/dev/sda4) elsewhere such as removable media.
  • Identify the boot disk (to be replaced) and new disk (replacement) by following the identify disk instructions.

To copy entire disk (full disk replacement):

  • Enter (command prompt) "dd if=/dev/sdX of=/dev/sdY bs=10M" where sdX is the existing disk and sdY is the new disk. This will copy partitions 1,2,3,4 (boot, rootfs, swap, data) from the old to new system disk. It will take some time.

To copy only system partitions (to have a backup boot, or save time by not copying larger data partition):

  • Enter (command prompt) "dd if=/dev/sdX of=/dev/sdY count=820 bs=10M" where sdX is the existing boot disk and sdY is the new disk. This will copy partitions 1,2,3 (boot, rootfs, swap) from the old to new system disk.

If the replacement disk is not the same size as the existing disk, the new disk data partition size is incorrect (because the partition layout was copied) and needs to be adjusted:

  • Enter (command prompt) "fdisk /dev/sdY" (sdY is target disk)
  • Enter "p" (to display partitions)
  • Enter "d". (to delete partition)
  • Enter "4" (to delete partition 4 / data)
  • Enter "n" (to create new partition)
  • Enter "p" (to select primary partition)
  • Enter "4" (select partition 4)
  • Press "enter" twice to select default start and end sectors (end of partition 3 to end of disk)
  • Enter "p" (to display new partition table)
  • Press "w" to save changes and exit fdisk.
  • If a backup of the previous data partition exists, copy the files to the new data partition.

Power down SecureOffice, remove the old system disk, power on. It may be necessary to reconfigure the boot device if boot fails.

Note: replacing the system disk constitutes a hardware change and trial licensing (cannot change hardware) will fail. Fully (paid) licenses can be refreshed (System->Licensing->Manage Licenses), enter "Register", "Install" for each licensed product.

1.3                Backup And Restore

Once you are satisfied with SecureOffice installed packages and configuration, it is prudent to keep regular backups for disaster recovery and system upgrade purposes.

It is not yet possible to update SecureOffice (Flash new firmware) using Backup/Restore. The current way to upgrade SecureOffice is to backup the existing system, re-install SecureOffice and restore from backup.

SecureOffice uses a modified (from original OpenWrt) backup / restore script which restores all settings, including databases from all (including securepbx, vmplayer, zoneminder, nxserver, home-assistant) installed applications. If any of the packages in the previous list were installed at backup, they will be re-installed upon restore.

During restore, it is possible to automatically install other packages if they have been specified as "EXTRA_PACKAGES" in the "/sbin/backup.sh" backup/restore script. This means, if you want extra packages to be re-installed at restore, every time you install a package, add it to "EXTRA_PACKAGES" in the backup/restore script.

SecureOffice backup / restore is (Luci GUI) accessed at the (System->Backup / Flash Firmware) menu, as shown below.

Figure 2: OpenWrt Backup

To perform a backup, select "Generate Archive". You will be prompted for a location (on your PC) to save the backup archive. Select a directory location. Backup is done.

Prior to restoring, insure that any extra packages to install are specified as "EXTRA_PACKAGES" in the "/sbin/backup.sh" backup/restore script.

To perform a restore, select "Browse". Select the file (on your PC) containing a previous backup. Select "Upload Archive". During restore, Status is displayed. When status becomes "Restore Complete", then "Idle", a manual reboot is necessary to incorporate any config changes.

If, after some time (may take a while for package installation), status is not "Restore Complete", then "Idle", something has failed. Examine "/var/log/backup.log" to fix any issues.

2       

Technologies Used:

Design by: XOOPS UI/UX Team