Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- snapshot="$1"
- if [ -z "$snapshot" ]; then
- echo "FreeBSD/ZFS snapshot handling bug"
- echo ""
- echo "Usage: $0 <zfs snapshot>"
- exit 1
- fi
- snapshot="$(zfs list -t snapshot -H -o name "$snapshot")"
- if [ -z "$snapshot" ]; then
- echo "Snapshot not found"
- exit 2
- fi
- dataset="${snapshot%@*}"
- sn="${snapshot#*@}"
- mountpoint=$(mount | grep "^$dataset[[:space:]]" | awk '{print $3}')
- if [ ! -d "$mountpoint" ]; then
- echo "Could not determine mount point for $dataset"
- exit 3
- fi
- echo "** dataset=$dataset snapname=$sn mounted=$mountpoint"
- cd "$mountpoint/.zfs/snapshot"
- yes "$sn" | xargs umount > /dev/null &
- yes "$sn" | xargs umount > /dev/null &
- yes "$mountpoint/.zfs/snapshot/$sn" | xargs umount > /dev/null &
- yes "$mountpoint/.zfs/snapshot/$sn" | xargs umount > /dev/null &
- yes "$sn" | xargs stat > /dev/null &
- yes "$sn" | xargs stat > /dev/null &
- yes "$sn/.." | xargs stat > /dev/null &
- yes "$sn/.." | xargs stat > /dev/null &
- yes "." | xargs ls -la > /dev/null &
- yes "." | xargs ls -la > /dev/null &
- cd "$mountpoint/.zfs"
- yes . | xargs ls -l > /dev/null &
- yes . | xargs ls -l > /dev/null &
- #yes "$snapshot" | xargs -n 1 zfs send -R > /dev/null &
Add Comment
Please, Sign In to add comment