{"id":20567799,"url":"https://github.com/isometry/oxbackup","last_synced_at":"2025-09-02T11:06:17.449Z","repository":{"id":68239122,"uuid":"290019210","full_name":"isometry/oxbackup","owner":"isometry","description":"Tape backup for UFS and ZFS filesystems under Solaris 10","archived":false,"fork":false,"pushed_at":"2020-08-24T19:23:37.000Z","size":438,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-24T13:42:51.305Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/isometry.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-24T19:19:38.000Z","updated_at":"2020-08-24T19:24:14.000Z","dependencies_parsed_at":"2023-02-24T03:45:23.477Z","dependency_job_id":null,"html_url":"https://github.com/isometry/oxbackup","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/isometry/oxbackup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isometry%2Foxbackup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isometry%2Foxbackup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isometry%2Foxbackup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isometry%2Foxbackup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/isometry","download_url":"https://codeload.github.com/isometry/oxbackup/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isometry%2Foxbackup/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273272560,"owners_count":25075985,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-02T02:00:09.530Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T04:48:32.944Z","updated_at":"2025-09-02T11:06:17.427Z","avatar_url":"https://github.com/isometry.png","language":"Shell","readme":"# The oxbackup script\n\nTape backup for UFS and ZFS filesystems under Solaris 10\n\n## UFS snapshots\n\nIf you want UFS filesystems to be snapshot, then you must create a backing store\nto house them.\n\nWith ZFS available, just create a filesystem at `/snap`.\n\n```\n# zfs create pool/snap\n# zfs set mountpoint=/snap pool/snap\n# chmod 700 /snap\n```\n\nLacking ZFS, a symlink from `/snap` to `/var/tmp` will suffice (but see the note below):\n\n```\n# ln -s /var/tmp /snap\n```\n\nTo disable UFS snapshots altogether, you could simply set the `SNAPSHOT_UFS`\nenvironment variable to 0:\n\n```\n# env SNAPSHOT_UFS=0 ...\n```\n\nIf no `/snap` is found, then the script will print a warning but continue without UFS snapshots.\n\n## Exclusions\n\nYou can configure exclusions and filesystems which you want backed up \"live\"\n(without being snapshot).\nThe fileformat for both these configuration files is one filesystem mointpoint\nper-line.\nIf you create a `/snap` zfs, then it should be excluded; if you backed `/snap` in\n`/var`, then `/var` should not be snapshot.\n\n```\n# vi etc/exclude\n  /snap\n# vi etc/nosnap\n  /var\n```\n\n## Scripts\n\nThe backup scripts supports configuration of arbitrary pre- and post-backup\nscripts via `etc/scripts`.\n\nIf `ntpd` runs on the system, then it must be stopped in order to snapshot the\nroot filesystem. Examples for Solaris 9/10 are included.\n\n## Scheduling\n\nFinally, add an appropriate entry to the `crontab`:\n\n```\n# crontab -e\n  30 2 * * 2-6 /sysadmin/backup/bin/oxbackup backup\n```\n\nWere you backing up to a remote tape, pass the appropriate arguments:\n\n```\n  30 2 * * 2-6 /sysadmin/backup/bin/oxbackup -f csdns:/dev/rmt/1cn backup\n```\n\n## Checking\n\nIn order to expose standard `checkback` functionality, add an alias to `~root/.cshrc`:\n\n```\n# vi ~root/.cshrc\n  alias checkback '/sysadmin/backup/bin/oxbackup check'\n```\n\n## Errors\n\nSometimes, the script will falsely report a failure on a zfs mountpoint when it encounters a filename containing UTF-8 characters, for example:\n\n```\n==\u003e BEGIN: dump of /crm1 via pax: 2007-07-19 01:57:51\n--\u003e running pax...\npax: invalid character in UTF-8 conversion of 'oracle_uat/tstcrmdb/9.2.0/network/admin/dg_prim_diag_lcrm_\u0026×tamp.out'\npax: file (oracle_uat/tstcrmdb/9.2.0/network/admin/dg_prim_diag_lcrm_\u0026×tamp.out): UTF-8 conversion failed.\n==\u003e ERROR: dump of /crm1 failed: 2007-07-19 03:32:57\n234612447+0 records in\n1862003+1 records out\n```\n\nThese can generally be safely ignored, though it may be wise to notify the owner of the offending file that it's not being backed up. If unsure, you can verify the amount of data written to tape by multiplying the `records out` by output blocksize, `obs=63k`. For example 1,862,003 * 63KB = 117,306,189 KB = 111.9 GB. Check the size of the filesystem by multiplying the zfs `used` by `compressratio`, in this case giving us ~108.1 GB:\n\n```\n# zfs get used,compressratio st1/crm1\nNAME             PROPERTY       VALUE                      SOURCE\nst1/crm1         used           41.4G                      -\nst1/crm1         compressratio  2.61x                      -\n```\n\n## Restores\n\nThe oxbackup script contains a wrapper around basic restore functionality, accessed via `bin/oxbackup restore [mountpoint]`.\n\nIf `mountpoint` is a UFS partition this will position the tape correctly before launching `ufsrestore`.\nFor a zfs `mountpoint` it will position the tape then prompt for a space-separated list of `fnmatch(3C)` patterns to restore (relative to `mountpoint`, no leading `./`).\n\nA typical restore from a zfs might look something like this:\n\n```\n# ./oxbackup toc\n--\u003e rewinding tape\nBackup of tcisdb1: 2007-07-19 01:10:02\n    1   ufs /dev/dsk/c0t0d0s0 /\n    2   ufs /dev/dsk/c0t0d0s3 /var\n    3   zfs pool/app /app\n    4   zfs st1/auth1 /auth1\n    5   zfs pool/brookes /brookes\n    6   zfs st1/cis /cis\n    7   zfs st1/cmis /cmis\n    8   zfs st1/crm1 /crm1\n    9   zfs pool/data /data\n   10   zfs st1/ecsis1 /ecsis1\n   11   zfs st1/edm1 /edm1\n   12   zfs st1/eis1 /eis1\n   13   zfs st1/fin1 /fin1\n   14   zfs pool/logs /logs\n   15   zfs st1/oxshare1 /oxshare1\n   16   zfs pool/sysadmin /sysadmin\n   17   zfs pool/sysadmin/home /sysadmin/home\n   18   zfs pool/users /users\n1+1 records in\n1+1 records out\n# cd /tmp/foo\n# ./oxbackup restore /crm1\n==\u003e initiating restore from /crm1\n--\u003e WARNING: restore will be to the current directory (/tmp/foo)!\n--\u003e rewinding tape\n1+1 records in\n1+1 records out\n--\u003e matched entry in table of contents: 8 zfs st1/crm1 /crm1\n--\u003e pax does not support interaction\nEnter file patterns to restore: oracle/lcrmdb\nUSTAR format archive extended\noracle/lcrmdb/9.2.0/inventory/Components21/oracle.swd.oui/2.2.0.19.0/installlog.xml\noracle/lcrmdb/9.2.0/inventory/ContentsXML/comps.xml\noracle/lcrmdb/9.2.0/inventory/ContentsXML/libs.xml\n1862003+1 records in\n234612447+0 records out\n483.47u 2004.12s 1:25:54.58 48.2%\n```\n\nWhen prompted with 'Enter file patterns to restore:', it is requesting the subfolders of the folder (so in the example it's crm1/oracle/lcrmdb that's being restored). \n\n## UFS Restores\n\n```\n[csdns:~]\u003e mkdir trestore\n[csdns:~]\u003e cd trestore\n[csdns:~/trestore]\u003e /sysadmin/backup/bin/oxbackup toc\n--\u003e [13:34:43] rewinding tape\n/dev/rmt/0cn: write protected or reserved.\n++\u003e [13:34:43] ERROR: accessing tape\nExit 1\n[csdns:~/trestore]\u003e pfexec tcsh\ninfo: TCSHRC: sourced from CSDNS\n[csdns:~/trestore]# /sysadmin/backup/bin/oxbackup toc\n--\u003e [13:35:17] rewinding tape\nBackup of dcisapp1 [2014-10-23 03:10:02]\n    1   ufs /dev/md/dsk/d10 /\n    2   ufs /dev/md/dsk/d30 /var\n    3   ufs /dev/md/dsk/d70 /cis\n    4   ufs /dev/md/dsk/d40 /brookes\n    5   ufs /dev/md/dsk/d50 /app\n    6   ufs /dev/md/dsk/d60 /users\n0+1 records in\n0+1 records out\n[csdns:~/trestore]# /sysadmin/backup/bin/oxbackup position 6\n[csdns:~/trestore]# ufsrestore iv\nVerify volume and initialize maps\nMedia block size is 126\nDump   date: 23 October 2014 05:10:03 BST\nDumped from: the epoch\nLevel 0 dump of an unlisted file system on dcisapp1:/dev/fssnap/0\nLabel: none\nExtract directories from tape\nInitialize symbol table.\nufsrestore \u003e pwd\n/\nufsrestore \u003e ls\n.:\n      2 *./                10  oraform/       19043  p0074784/\n      2 *../               13  oraoemag/     150714  p0074807/\n 175029  brookes/       72916  orassom/       30326  p0074855/\n 116209  dcrmapp/       19002  p0023009/     169003  p0075330/\n      3  lost+found/    25600  p0054111/      43064  p0075347/\n  86778  misbuild/      25601  p0054131/      80344  p0075634/\n  44817  miscron/       42185  p0054270/     338874  p0075715/\n  86779  misdploy/     152536  p0071665/      85246  p0076594/\n 128086  ora10clt/      19044  p0072338/     175980  p0076801/\n     14  ora92clt/          6  p0073279/     175037  p0076923/\n     15  oracrma3/      25605  p0073604/      72606  p0077178/\n 150402  oracron/           7  p0073611/     121305  p0077268/\n      8  oraecsm/       25602  p0073923/        755  quotas\n 102409  oraecsws/      25603  p0074093/         11  webecs1/\n      9  oraedmm/      152560  p0074397/         12  webedm1/\nufsrestore \u003e cd p0074093/\nufsrestore \u003e pwd\n/p0074093\nufsrestore \u003e ls\n./p0074093:\n  27155  #afiedt.buf#\n  25603  ./\n      2 *../\n  34380  .Xauthority\n  ...\n  42747  zztemp\nufsrestore \u003e add *\nMake node ./p0074093\n...\nMake node ./p0074093/xfer\nufsrestore \u003e marked\n./p0074093:\n  27155 *#afiedt.buf#\n  ...\n  42747 *zztemp\nufsrestore \u003e extract\nExtract requested files\nYou have not read any volumes yet.\nUnless you know which volume your file(s) are on you should start\nwith the last volume and work towards the first.\nSpecify next volume #:\nSpecify next volume #: 1\nextract file ./p0074093/news/xx.\n...\nextract file ./p0074093/srec.logx\nwrite error extracting inode 35142, name ./p0074093/srec.logx\nwrite: No space left on device\n5.81u 6.42s 14:02.19 1.4%\nExit 1\n[csdns:~/trestore]#\n```\n\n## Manual Restores - Single Tape Drive\n\nThe following outlines a manual restore, for example from a Solaris boot CD.\n\n1. Read the table of contents:\n```\n# mt rewind\n# dd if=/dev/rmt/0c\nBackup of tcisdb1: 2007-07-19 01:10:02\n    1   ufs /dev/dsk/c0t0d0s0 /\n    2   ufs /dev/dsk/c0t0d0s3 /var\n    3   zfs pool/app /app\n    4   zfs st1/auth1 /auth1\n    5   zfs pool/brookes /brookes\n    6   zfs st1/cis /cis\n    7   zfs st1/cmis /cmis\n    8   zfs st1/crm1 /crm1\n    9   zfs pool/data /data\n   10   zfs st1/ecsis1 /ecsis1\n   11   zfs st1/edm1 /edm1\n   12   zfs st1/eis1 /eis1\n   13   zfs st1/fin1 /fin1\n   14   zfs pool/logs /logs\n   15   zfs st1/oxshare1 /oxshare1\n   16   zfs pool/sysadmin /sysadmin\n   17   zfs pool/sysadmin/home /sysadmin/home\n   18   zfs pool/users /users\n```\n\n 2. Restore:\nBelow, the mt command is used to \"Rewind, fast forward to beginning of file X\". This operation has been seen to fail silently on csvleadm1's second tape drive. After running \n```\n# mt asf 1\n```\nIt is worth running the following to check that the drive has actually positioned the tape to the file number you have specified:\n```\n# mt status\nHP DAT-72 tape drive:\n   sense key(0x12)= EOF   residual= 0   retries= 0\n   file no= 1   block no= 0\n```\nIf you still get a zero ( 0 ) on the file no= entry then try a different tape drive\n\n 2a. UFS restore:\n\nThe first thing you will need to know is which file number on the tape holds the directories and files you want to restore. This is available from the output of the table of contents acquired using the command: \n```\n#dd if=/dev/rmt/0c\n```\n\nRestores can be started interactively, wich drops you to a ufsrestore\u003e shell. The function letter 'i' achieves this (see commands below). Note the 'mt asf 1' command moves the tape to file number 1 on the tape, having first rewound it. If you find you are in the wrong location on the tape, you can use 'mt fsf 1' to move forwards 1 EOF marker, without rewinding to the start first.\n```\n# mt asf 1\n# cd /restore_path\n# ufsrestore ivf /dev/rmt/0cn\n```\n\nNote that user directories can be in a variety of locations.\neg. For systems Administration:\n```\n/brookes/sysadmin\n/home/sysadmin\n```\n\nFor standard users:\n```\n/users\n```\n\nMake sure you know where the files should be located on the server before trying to locate them on the tape, it will save you time.\n\nFiles to be restored need to be marked using the 'add' command. They can be located on the tape using the 'ls' command. (Top level directories on the tape do not require a leading '/').\n```\nufsrestore \u003e ls\n.:\n      2 *./                13  oraoemag/      19043  p0074784/\n      2 *../            72916  orassom/      150714  p0074807/\n 116209  dcrmapp/       19002  p0023009/      30326  p0074855/\n      3  lost+found/    25600  p0054111/     144765  p0074930/\n  86778  misbuild/      25601  p0054131/     169003  p0075330/\n  44817  miscron/       25604  p0054270/      43064  p0075347/\n```\n\nMark a directory and all of its files for restore using 'add'. The output will display all the files marked for restore.\n```\nufsrestore\u003e add p0054270\nMake node ./p0054270/.subversion\nMake node ./p0054270/.subversion/auth\nMake node ./p0054270/.subversion/auth/svn.simple\n```\n\nTo initiate the restore of files use the 'extract' command. You will be prompted for the volume to read. The volume refers to the tape used to backup the filesystem, if the particular filesystem backup ran over more than one tape you may need to specify something other than 1 here.\n```\nufsrestore\u003e extract\nExtract requested files\nYou have not read any volumes yet.\nUnless you know which volume your file(s) are on you should start\nwith the last volume and work towards the first.\nSpecify next volume #: 1\n```\n\nAt the end of the restore you will be prompted wether or not to reset permissions on the restored directory. Generally you will not want to do this, so can respond 'N'.\n\n 2b. ZFS restore, files matching fnmatch `PATTERN` (nothing if you want to restore everything):\n```\n# mt asf 3\n# cd /restore_path\n# dd bs=1024k if=/dev/rmt/0cn | pax -r -pe PATTERN\n```\n\n## Manual Restores - Multiple Tape Drives\nAs an example, csvleadm1 is attached to two tape drives. One is for backups of itself, the other for csvledr1 which a physical server in Wheatly H127.\n\n 1. Identify the correct drive, by sticking a tape in, then ejecting it by specifying the path to the device\n```\n# mt -f /dev/rmt/0cn offline\n```\n Take a look to see if the drive you expected to eject has done so. If it has, record the device path used. If not, try:\n```\n# mt -f /dev/rmt/1cn offline\n```\n Keep going up the numbers until the the tape is eject from the drive you want to use.\n\n 2. Read the table of contents:\n```\n# mt -f /dev/rmt/1cn rewind\n# dd if=/dev/rmt/1c\nBackup of csvledr1 [2012-08-23 01:10:06]\n    1   zfs rpool/ROOT/S10u6-20090629 /\n    2   zfs rpool/ROOT/S10u6-20090629/var /var\n    3   zfs rpool/ROOT/S10u6-20090629/opt /opt\n    4   zfs rpool/COMMON/brookes /brookes\n    5   zfs rpool/COMMON/logs /logs\n    6   zfs rpool /rpool\n    7   zfs rpool/ROOT /rpool/ROOT\n    8   zfs st1/sync-csvledb1 /sync-csvledb1\n    9   zfs st1/sync-tvle-db1 /sync-tvle-db1\n   10   zfs rpool/COMMON/sysadmin /sysadmin\n   11   zfs rpool/COMMON/sysadmin/home /sysadmin/home\n   12   zfs rpool/COMMON/users /users\n1+1 records in\n1+1 records out\n```\n\n 3. Restore\nBelow, the mt command is used to \"Rewind, fast forward to beginning of file X\". This operation has been seen to fail silently on csvleadm1's second tape drive. After running \n```\n# mt -f /dev/rmt/1cn asf 1\n```\nIt is worth running the following to check that the drive has actually positioned the tape to the file number you have specified:\n```\n# mt -f /dev/rmt/1cn status\nHP DAT-72 tape drive:\n   sense key(0x12)= EOF   residual= 0   retries= 0\n   file no= 1   block no= 0\n```\nIf you still get a zero ( 0 ) on the file no= entry then try a different tape drive\n\n 3a. UFS restore:\n```\n# mt -f /dev/rmt/1c asf 1\n# cd /restore_path\n# ufsrestore ivf /dev/rmt/1cn\n```\n\n 3b. ZFS restore\n```\n# mt -f /dev/rmt/1c asf 5\n# cd /restore_path\n# dd bs=1024k if=/dev/rmt/1cn | pax -r -pe PATTERN\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisometry%2Foxbackup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fisometry%2Foxbackup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisometry%2Foxbackup/lists"}