0

I want to back up /home dir, but the sudo du -h /home | tail -n1 shows

22146824    /home

however df -h shows:

/dev/sda5        54G   22G   30G  42% /home

22*2^30 == 23622320128

The later number is much bigger then the first, and they should show the same disk usage? What number of space should I use, if I want to make partition on floppy disk?

milanHrabos
  • 381
  • 2
  • 4
  • 12
  • 1
    The inevitable reference: Why are there so many different ways to measure disk usage?. A common reason for df showing more used space than du is deleted files. Refer to the exhaustive answer to the linked question for a list of other possible causes. – fra-san Jul 08 '20 at 22:53
  • @fra-san yes, that is a lot of info, but there is no mention what to use for making partition, which is for practical reason. Now that is the question, should I make partition with 22GiB according to df or cca 0.0207GiB according to du? (where I will then rsync it to floppy) – milanHrabos Jul 08 '20 at 23:04
  • 1
    Is really 22146824 coming from du -h? Which version of du? I thought 22146824 was in KiB (actually from du with no -h). The difference between the used space as reported by those two tools is usually modest (e.g. 66 MiB out of 114 GiB for my / right now). – fra-san Jul 08 '20 at 23:13

1 Answers1

0

If you create a file system then you do not only need space for the data but also for the metadata. Thus du (ignoring the metadata) shows too little capacity.

The df number is relevant for this case.

Hauke Laging
  • 90,279