zerofree: failed to open filesystem /dev/sda5

I am running Parrot OS as a guest on Virtualbox 6.1.20. The host is Windows 10 Home. I am trying to reduce the size of the .vdi for Parrot after it has dynamically grown during updates. I have sites to do this but they all include using the command zerofree to trim the guest of unused disk space.

When I run zerofree I get the error in the Subject: failed to open filesystem /dev/sda5 which is where / is mounted. I attached the live CD System Rescue Disk in Virtualbox. I can see the partition when I do a fdisk -l but I still get the error above.

Zerofree works in Rescue Mode in Ubuntu so I am stumped as to what is going on with Parrot. Any help would be appreciated.

  • Parrot version in use (if you are not aware of it, open terminal and type cat /etc/os-release | grep VERSION):

Linux parrot 5.14.0-9parrot1-amd64 #1 SMP Debian 5.14.9-9parrot1 (2021-10-26) x86_64 GNU/Linux

  • Hypervisor used:

Not using Hypervisor.

  • Logs/Terminal output (use pastebin or similar services):

I don’t know what logs to attach. The terminal out put is this:
zerofree -v /dev/sda5
zerofree: failed to open filesystem /dev/sda5

  • Screenshots:

Because it’s for ext2, ext3, ext4 filesystem… But parrot by default is on btrfs filesystem

Ah. Okay. I did not do anything special when I installed Parrot so I must be using the brtfs filesystem. Is there an equivalent tool for the brtfs or another way to achieve the same “trimming” effect so I can use the VirtualBox command that does the compaction?

Thanks in advance.

A little googling led me to this alternative:

dd if=/dev/zero of=file
rm file

I am now wondering if I have to do this in maintenance mode and if so what is the password for root to get into that mode when I start parrot. I tried toor and some other similar options but none worked.

It might be that I don’t even have to be in maintenance mode for the above two commands to do what zerofree does. If I can get clarification on that, it would be great.

Default password is

Thanks. I needed to type slower. That worked.

I performed the above dd operation. All that did was maximize the vdi file to its fullest extent. Now I am in trouble as I am almost out of disk space on the host machine.

I tried:

sfill -l -l -z /

After running VBoxManage modifymedium disk --compact /

The .vdi file remains the same size even though df in the virtual machine shows only about half of it in use.

I tried fstrim but that gave me the following error:

fstrim: the discard operation is not supported

Is there any other alternative to zerofill for a btrfs file system that might work? I am not having much luck in my google search.

I have a related question as to why the host command in Windows might not be working. Is parrot’s OS encrypted by default?

I figured out a way to compact the vdi of my parrot OS guest on a Windows 10 host.

I attached a Knoppix live CD iso to the optical device in VirtualBox associated with parrot OS.

Knoppix started up.

As root I did the following:
apt update
apt-get install secure-delete
mount /dev/sda5 /mnt where /dev/sda5 is where the / partition is
sfill -l -l -z -v /mnt #this does an insecure single pass writing zeros to the unused space

It takes a while for this last step.

umount /mnt

Then I shutdown Knoppix and without starting the virtual machine up again I immediately ran
VBoxManage.exe modifymedium disk “C:path of vdi” --compact

I then disconnected the Knoppix ISO from the optical device in VirtualBox.

I read something about the BTRFS mounting partitions with compression so the first time I ran this I must of run the virtual machine before running the VBoxManage command and it compressed the zeros. Just guessing here.

Regardless my problem is solved. I hope others find this useful as there is not a lot of information about how to compact a BTRFS file system vdi out there in a single place.


Posts: 7

Joined: 9. Feb 2021, 22:51


If you mean HDD/SSD encryption, no, you can decide this at the time of installation via Calamares. Glad you solved the problem!