Plan 9 from Bell Labs’s /usr/web/sources/plan9/sys/lib/backup/backuparenas

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc
# backuparenas dev name ... - dump arena `name' from $fs to blu-ray disc.
#	assumes $set is set.
rfork ne
# tunable variables
fs=pie

if (test -e /sys/lib/backup/funcs)
	.   /sys/lib/backup/funcs

exits=''
fsroot=/n/$fs
if (! test -e $fsroot/!THIS_IS_^`{echo $fs | tr a-z A-Z}^_MAIN) {
	import $fs / $fsroot || exit
}
unmount /mnt/cd >[2]/dev/null
cdfs -d $1 || exit
shift

done=no
echo -n figuring out disc type...
for (i in `{seq 1 20})
	if (~ $done no) {
		m=`{ls -l /mnt/cd | grep bd-r-dl}
		if (~ $m '' ()) {
			echo -n .
			sleep 3
		}
		if not
			done=yes
	}
echo

ls -l /mnt/cd
grep next /mnt/cd/ctl
echo -n 'nwa ok? '
ok=`{read}
if (! ~ $ok [Yy]*)
	exit bad-nwa

cd $fsroot/dev/fs
shname = `{basename $arenas}
if (! test -r $shname){
	echo $0: $shname in `{pwd} not readable >[1=2]
	exit unreadable-arenas
}

for (name) {
	grep next /mnt/cd/ctl
	# use -o 8192 to avoid devmnt fragmentation if bd drive is imported
	venti/rdarena $shname $name |
		pump -i 65536 -o 8192 -k 100000 -d 5 >/mnt/cd/wd/$name
#		pump -i 65536 -o 1048576 -k 51200 -d 10 >/mnt/cd/wd/$name
	quitonfailure $status

#	ls -l /mnt/cd
	if (test -e '/env/fn#dumpdone' -a -e '/env/set')
		dumpdone $shname $name
}
echo 'remember to *not* remove /mnt/cd/wd' >[1=2]
# don't remove /mnt/cd/wd, since that would finalize the disc
# and bugger the permanent toc, at least on bd-r.
exit ''

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.