4

I'm using Ubuntu 20.04.4 LTS. Why do I have a file in /home/myname/ called fdimage that is 805,8 GB? My SSD is a 500 GB one, and the partition allocated on it is only 125 GB... Clearly something is corrupted. What is going on here? Can I get rid of it?

The output of this command, however, tells a different story. According to du, this fdimage file only has a size of around 54.34 GB... How can Ubuntu give two different sizes for the same file?

du -a | sort -n -r | head -n 20

85129301    .
54340504    ./fdimage
12699488    ./Desktop

Again, the command stat /home/myname/fdimage returns a different size (805800542208 bytes = 805,8 GB) I'm fairly new to Ubuntu, and I couldn't find much information to this ./fdimage file, but from what I've read, I understood that maybe it's a kind of backup that Ubuntu automatically makes. Can I turn this off? I have my own backups, and I don't want Ubuntu eating more that half of my disk space.

In my last post I explained that, while I was using GNU ddrescue, my main drive completely filled up. I had to enter Ubuntu rescue mode to manually delete some files to have access again to the system. Is this related to the fdimage being this big? I had a file called mapfile in /home/myname but it was 0 kB in size. The drive on which I wanted to create a copy is still empty (0 bytes). Maybe I filled up my main drive instead of the external one with the blocks from the bad disk I was trying to rescue? Maybe I used the wrong ddrescue command? I cant't wrap my head around this, given that I could not find any files related to ddimage (apart from the above-mentioned mapfile that was empty) on my SSD.

Thanks in advance for your help.

1 Answer 1

14

Your fdimage is likely a sparse file, which would explain the wildly different file size. You can confirm this with the following command:

ls -lsh fdimage 

This will show the occupied size in the first column. If the occupied size is smaller than the apparent size then the file is sparse.

The file may have been created if multiple ddrescue commands had been tried, as the name appears in examples from the Gnu documentation. You can certainly delete the file so long as nothing is currently using it and you do not need any of the data contained within.

4
  • Thank you very much. Yes, as a matter of fact, I tried multiple ddrescue commands, because I had to interrupt the recovery process. The command ls -lsh fdimage returns 52G -rw-r--r-- 1 root root 751G feb 28 14:47 fdimage... So, I think that it is actually 52 GB.
    – Aleph_0
    Commented Mar 5, 2022 at 12:26
  • 2
    @Aleph_0: It's using 52G of disk space; it's logical file length is 751G. cat fdimage would produce a stream of bytes 751G long, including many all-zero regions which were seeked-over instead of written explicitly when the file was created. Neither size is wrong, they just have different meanings. Commented Mar 6, 2022 at 7:40
  • Spares files are a somewhat difficult concept to gasp. Think of it as a compressed file (like ZIP files). The file being magically decompressed when read. The (uncompressed) contents are about 800G but on disk the (compressed) file takes only 50G.
    – max
    Commented Mar 7, 2022 at 4:00
  • 1
    @max it may be more accurate to think of this sparse file as "an 805-page book with words on just 52 of those pages". Sparseness and compression are quite different as a compressed file is expected to be complete otherwise it cannot reconstitute the words, whereas a sparse file is known to be incomplete so is read from and written to with this in mind 👍🏻
    – matigo
    Commented Mar 7, 2022 at 6:41

You must log in to answer this question.

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