4

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?

5
  • 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
    Commented Oct 11, 2018 at 12:29
  • But it does exist: vbox@debian:~$ mount | grep sdb1 /dev/sdb1 on /home/user/mnt type ext4 (ro,relatime,data=ordered) Commented Oct 11, 2018 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
    Commented Oct 11, 2018 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/. Commented Oct 11, 2018 at 13:46
  • i can accept my answer after two days. Commented Oct 11, 2018 at 16:01

1 Answer 1

6

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

Not the answer you're looking for? Browse other questions tagged .