0

I backup my hard drive through sudo zfs send snapshot | sudo tee /my-mount-point/my-snapshot.zfs > /dev/null, and I want to make sure that I don't accidentally unmount (and turn off) /my-mount-point.

Now, had I cd into there, it wouldn't be a problem, as I would get umount: /my-mount-point: target is busy.. But with tee, it doesn't do that.

Moreover, when I try running lsof | grep "my-mount-point", I get nothing. If I cd into my-mount-point, lsof will show it. Otherwise, nothing.

Is there a way to get if something's writing to a file under my-mount-point?

3
  • As a side note, your command line is strange. Since you don't output the backup to stdout, you don't need tee, sudo zfs send snapshot > /my-mount-point/my-snapshot.zfs is enough, isn't it?
    – Amessihel
    Jun 30, 2020 at 19:27
  • @Amessihel not if /my-mount-pointt isn't user writable
    – unix
    Jun 30, 2020 at 21:40
  • Even with the sudo call, you're sure?
    – Amessihel
    Jun 30, 2020 at 21:45

1 Answer 1

0

Why not CD-ing into that directory before backing up your HD?

cd /my-mount-point/ &&
(sudo zfs send snapshot | 
 sudo tee my-snapshot.zfs > /dev/null) && cd

Sounds to be the easiest way to get a CWD under your mount point.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.