O espaço extra no seu sistema de arquivos é reservado para o root. Isso pode ser alterado com tune2fs -m
(assumindo, é claro, que é um sistema de arquivos ext2 / 3/4). A página man dá uma boa explicação:
-m reserved-blocks-percentage
Set the percentage of the filesystem which may only be allocated by privileged processes. Reserving some number of filesystem blocks for use by privileged processes is done to avoid filesystem fragmentation, and to allow system daemons, such as syslogd(8), to continue to function correctly after non-privileged processes are prevented from writing to the filesystem. Normally, the default percentage of reserved blocks is 5%.
Outras opções que afetarão o tamanho do seu sistema de arquivos são se um diário está ativado ou não (sistemas de arquivos ext3 / 4) e espaço reservado para permitir que o sistema de arquivos seja aumentado em tamanho. O Journalling pode ser desativado com tune2fs -O ^has_journal
, embora eu não recomende isso (ele também pode ser redimensionado ou colocado em um dispositivo externo - consulte -J
).
has_journal
Use a journal to ensure filesystem consistency even across unclean shutdowns. Setting the filesystem feature is equivalent to using the -j option.
Finalmente, o espaço reservado para aumentar o tamanho do seu sistema de arquivos pode ser aumentado com tune2fs -O ^resize_inode
. Uma vez removido, isso desaparece para sempre. Isso só reduzirá o tamanho do espaço usado.
resize_inode
Reserve space so the block group descriptor table may grow in the future. Tune2fs only supports clearing this filesystem feature.
Veja também - Espaço reservado para raiz em um sistema de arquivos - por quê?
Exemplo:
$ truncate -s 1G testfs # create sparse file
$ mkfs.ext4 testfs
mke2fs 1.42.9 (4-Feb-2014)
testfs is not a block special device.
Proceed anyway? (y,n) y
Discarding device blocks: done
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
65536 inodes, 262144 blocks
13107 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376
Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
$ mkdir mnt
$ sudo mount -o loop testfs mnt; df -h mnt; sudo umount mnt
Filesystem Size Used Avail Use% Mounted on
/dev/loop0 976M 1.3M 908M 1% /home/graeme/test/mnt
$ tune2fs -m 0 testfs
tune2fs 1.42.9 (4-Feb-2014)
Setting reserved blocks percentage to 0% (0 blocks)
$ sudo mount -o loop testfs mnt; df -h mnt; sudo umount mnt
Filesystem Size Used Avail Use% Mounted on
/dev/loop0 976M 1.3M 959M 1% /home/graeme/test/mnt
$ tune2fs -O ^has_journal testfs
tune2fs 1.42.9 (4-Feb-2014)
$ sudo mount -o loop testfs mnt; df -h mnt; sudo umount mnt
Filesystem Size Used Avail Use% Mounted on
/dev/loop0 1008M 1.3M 991M 1% /home/graeme/test/mnt
$ tune2fs -O ^resize_inode testfs
tune2fs 1.42.9 (4-Feb-2014)
Please run e2fsck on the filesystem.
$ e2fsck testfs
e2fsck 1.42.9 (4-Feb-2014)
testfs was not cleanly unmounted, check forced.
Filesystem does not have resize_inode enabled, but s_reserved_gdt_blocks
is 63; should be zero. Fix<y>? yes
Resize_inode not enabled, but the resize inode is non-zero. Clear<y>? yes
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences: -(2--64) -4193 -(229378--229440)
Fix<y>? yes
Free blocks count wrong for group #0 (28585, counted=28649).
Fix<y>? yes
Free blocks count wrong for group #1 (32703, counted=32766).
Fix<y>? yes
Free blocks count wrong for group #3 (32703, counted=32766).
Fix<y>? yes
Free blocks count wrong for group #5 (32703, counted=32766).
Fix<y>? yes
Free blocks count wrong for group #7 (32703, counted=32766).
Fix<y>? yes
Free blocks count wrong (257701, counted=258017).
Fix<y>? yes
testfs: ***** FILE SYSTEM WAS MODIFIED *****
testfs: 11/65536 files (0.0% non-contiguous), 4127/262144 blocks
$ sudo mount -o loop testfs mnt; df -h mnt; sudo umount mnt
Filesystem Size Used Avail Use% Mounted on
/dev/loop0 1008M 20K 992M 1% /home/graeme/test/mnt