sgan81 / apfs-fuse

FUSE driver for APFS (Apple File System)
GNU General Public License v2.0
1.74k stars 164 forks source link

`du` Disk Usage utility shows all files as 0 bytes #180

Open ElectricRCAircraftGuy opened 1 year ago

ElectricRCAircraftGuy commented 1 year ago

Normally, when you run du at the command line, it shows all files and their size on the far left. When mounted with apfs-fuse, however, my Macbook apfs filesystem shows all files as 0 bytes. Looking at them in the thunar file manager, however, shows their correct size in the properties menu.

ElectricRCAircraftGuy commented 1 year ago

Update: this is when running on the Parted Magic Linux OS. This may be a Parted Magic problem. du shows all 0 bytes even when checking the Parted Magic running operating system root at du /.

RJVB commented 1 year ago

This is probably an indication that the files are "HFS-compressed". That means that their content is in an xattr if it can be compressed to fit in there, or else in the resource fork (another xattr nowadays).

It would be a big bummer though if apfs-fuse doesn't know how to handle these files!

ElectricRCAircraftGuy commented 1 year ago

Problem still persists with du and apfs-fuse

Alright, the problem does seem to be with apfs-fuse! I just re-mounted the same disk using an Ubuntu 20.04 live USB, on which I manually built and ran apfs-fuse, and the problem still persists. On this system, both ncdu and du work fine in any folder except the mounted APFS drive.

And in case anyone is wondering:

Side note: how to build apfs-fuse on a fresh Ubuntu 20.04 live USB

# See: https://askubuntu.com/a/227788/327339
sudo add-apt-repository universe

sudo apt install ncdu

# see my comment: https://github.com/sgan81/apfs-fuse/issues/101#issuecomment-1547206616
sudo apt install fuse libfuse3-dev bzip2 libbz2-dev cmake gcc g++ git libattr1-dev zlib1g-dev

git clone https://github.com/sgan81/apfs-fuse.git
cd apfs-fuse
git submodule update --init --recursive
mkdir build
cd build
cmake ..
time make

./apfs-fuse -h

# mount
mkdir -p ~/mount/macbook
sudo ./apfs-fuse /dev/sda2 ~/mount/macbook/
# unmount
sudo umount ~/mount/macbook

And to view the mounted files as root via the default Ubuntu nautilus file manager:

sudo nautilus /home/ubuntu/mount/macbook/

Or through the prettier nemo one:

sudo add-apt-repository universe
sudo apt update
sudo apt install nemo
sudo nemo /home/ubuntu/mount/macbook/

References:

  1. https://askubuntu.com/a/227788/327339
  2. [my answer] https://askubuntu.com/a/1173861/327339
  3. https://github.com/sgan81/apfs-fuse/issues/101#issuecomment-1547206616
  4. [my answer] Unix & Linux: Mount doesn't give write permission to user
ElectricRCAircraftGuy commented 1 year ago

Confirmed. The problem is definitely apfs-fuse, not Parted Magic. I just posted this to the private (for paying members only, $15 for Parted Magic) Parted Magic forum, here: https://partedmagic.com/forums/viewtopic.php?p=8943#p8943

Alright, I confirmed that the 0 bytes were only displaying inside my APFS mount at ~/mount/macbook/. When I ran du /, it so rapidly entered that location, that all I could see were zeros. du in Parted Magic does indeed work fine, then. But inside the APFS-mounted drive, it's all zeros.

Note: for testing on Parted Magic, I just built apfs-fuse on my Ubuntu 20.04 desktop, then copied the whole built folders/files/binary over to Parted Magic on a thumb drive. It ran. Since I'm seeing the problem with the Ubuntu 20.04 live USB too, though, on which I manually built apfs-fuse, I'm sure the problem lies with apfs-fuse, not my hack.

ElectricRCAircraftGuy commented 1 year ago

By the way, thank you for your work on this project. I really appreciate that you've made it, and I hope to see it continue to improve.

eLMoMaNi commented 8 months ago

hey @ElectricRCAircraftGuy I am having the same issue, filelight, du and ncdu shows 0KB for all files. However, I switched to baobab and it worked! Also qdirstat works, you have to run them as root and scan the mounted apfs folder.

antgel commented 3 months ago

@sgan81 Do you think this will be worked on at any point? No pressure, just asking. :)