I am trying to run zerofree on virtualbox .vdi disk. I attached the vdi disk to the storage to another virtual machine - debian desktop. I started the machine and mounted the hard disk with this command: mount -o ro /dev/sdb1 /home/user/mnt. But then if i try to run zerofree /dev/sdb1/ i get zerofree: failed to open filesystem /home/user/mnt/

Why i am getting this error?

closed as off-topic by Christopher, RalfFriedl, JigglyNaga, user88036, Anthony Geoghegan Oct 12 '18 at 23:21

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Christopher, RalfFriedl, JigglyNaga, Community, Anthony Geoghegan
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Hello and welcome to the U&L stack exchange site! Please review the Help Center for information on how to best post on this site. You are receiving that error because the filesyste /home/user/mnt/ does not exist at the location you specified in your command. – kemotep Oct 11 '18 at 12:29
  • But it does exist: vbox@debian:~$ mount | grep sdb1 /dev/sdb1 on /home/user/mnt type ext4 (ro,relatime,data=ordered) – user1800997 Oct 11 '18 at 12:42
  • 1
    In your question you specify /deb/sdb1 and in your comment your checking /dev/sdb1 I assumed this was a typo but I want to be sure. You have the device mounted read only which you have to do with zerofree so I would check to see if are running the command with root(sudo) privileges and that you are specifying the device correctly and that it is mounted correctly. – kemotep Oct 11 '18 at 13:18
  • Yes, that was a typo. I tried something else and it worked. I tried this: sudo zerofree /dev/sdb1 instead of sudo zerofree /home/user/mnt/. – user1800997 Oct 11 '18 at 13:46
  • i can accept my answer after two days. – user1800997 Oct 11 '18 at 16:01

I found that this command works: sudo zerofree /dev/sdb1

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