[COFF] Shell script advice: using 'dd' to write multiple media

Steffen Nurpmeso steffen at sdaoden.eu
Wed Jun 28 01:50:01 AEST 2023


Steve Jenkin wrote in
 <5C26BE4B-2E6C-4E02-9536-3EA774FB6B47 at canb.auug.org.au>:
 |> On 27 Jun 2023, at 09:44, Bakul Shah <bakul at iitbombay.org> wrote:
 |> f space is not an issue, you can use split(1) to divide
 |> the input in N pieces and then use a separate loop to copy
 |> them to the media. If you want to stream the distribution

I had

   act mkdir -p "$target"
   act btrfs send $parent "$this" '|' \
      zstd -zc -T0 $ZSTD_LEVEL '|' \
      '('cd "$target" '&&' \
        echo "$this" '>' .stamp '&&' \
        split -a 4 -b 2000000000 -d -')'
   ) || exit $?

for splitting BTRFS snapshots to VFAT filesystems.
You then did

   act cat "$ball"/"$mydir"/* '|' zstd -dc '|' btrfs receive .

to receive them.  (Where "act" is

  act() {
          if [ -n "$DEBUG" ]; then
                  echo eval "$@"
          else
                  eval "$@"
                  if [ $? -ne 0 ]; then
                          echo 'PANIC: '$*
                          exit 1
                  fi
          fi
  }

).  I dropped that "ball" support, all my backup media now uses
EXT4 or simply BTRFS directly.  (Thing was that Linux cannot drive
some external Seagate USB disks in a way that allows EXT4 or BTRFS
on them, the "final sync" or fails, will all kernels tried, and
some USB hints, too.  MacOS X could create HFS?? just like that.)
(That ".stamp" was

   if [ -f "$ball"/"$mydir"/.stamp ]; then
      snap=$(cat "$ball"/"$mydir"/.stamp)
  ...
   cd snapshots/"$mydir" || exit 11
   if [ -d "$snap" ]; then
      echo '=== '$mydir': snapshot '$snap' already exists'
      exit 0
   fi

.).

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


More information about the COFF mailing list