You are not logged in.

#1 2014-12-16 18:27:10

ajrl
Member
Registered: 2013-05-18
Posts: 22

Reserved space on ext4

Is there any danger in having zero reserved space on a device that I only use for storage? The wiki shows an example that leaves one percent, but on a 4-TB hard drive, that's 40 GB lost. I'm not familiar enough with file systems to understand what that reserved space is for, but I don't see why I would need it if I don't have an OS installed on the device.


¡A la máquina!

Offline

#2 2014-12-16 18:46:19

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: Reserved space on ext4

I usually don't reserve space on 'storage' devices. As I understand it, the reservation is intended to prevent non-root users and processes from filling up the device, because Bad Things happen if 'system' devices get full. OTOH, having free space is nice if you ever defragment and helps prevent fragmentation in the first place. Though I'm not 100% sure how reserved space is handled, so it may not have any effect on preventing fragmentation.

Also FYI, I think there's a way to reserve by blocks or something other than percent.


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#3 2014-12-16 18:57:51

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: Reserved space on ext4

@ajrl
You mean (as a crude example) doing something like creating a 3.99 TB partition and leaving .01 TB unused? Does the Arch Linux wiki suggest that? What would be the purpose of having unused space on a drive?

@alphaniner
Are we talking about the same thing? How would reserved space assist in preventing the drive from filling up? Would the unused space start being used somehow?

Offline

#4 2014-12-16 19:01:21

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Reserved space on ext4

drcouzelis, by default ext filesystems reserve 5% of disk space just for root (when a filesystem is 95% full, only root can write to it).

Offline

#5 2014-12-16 19:22:40

ajrl
Member
Registered: 2013-05-18
Posts: 22

Re: Reserved space on ext4

I read a couple of different things about what the reserved space is for. The Arch wiki says that it's to avoid fragmentation (or maybe to allow for defragmentation if necessary?). Another source says that it's reserved for system services in case you run out of storage space. The top answer on this page says both. I don't see why I would need to worry about system services, so I guess the question is how much space is enough for a large device to avoid fragmentation. 1 GB on a 4-TB drive?


¡A la máquina!

Offline

#6 2014-12-16 19:38:23

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Reserved space on ext4

The more filled your filesystem is, the harder it is to have (big) files with few extents. You might have files with many extents (although they could perhaps be contiguous on the disk) on an empty filesystem, if fallocate() isn't used.

I myself disable reserved blocks.

Offline

#7 2014-12-16 20:10:46

ajrl
Member
Registered: 2013-05-18
Posts: 22

Re: Reserved space on ext4

I didn't realize until today that fragmentation was possible with ext* file systems, but from what I read, I don't need to worry about it too much. The tune2fs utility is able to reserve just a fraction of a percent of space, so I'm going to reserve something like 1 GB (0.025 percent). The reserved space can be adjusted even with files on the device, so I can always reduce it to zero later if I want.

For reference, this will resize the reserved space to 0.1 percent:

tune2fs -m 0.1 /dev/mapper/'device'

Thank you for all the input.


¡A la máquina!

Offline

#8 2014-12-16 21:10:27

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: Reserved space on ext4

Thanks! I learned something. smile

Offline

#9 2014-12-16 22:12:49

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: Reserved space on ext4

Me too. I thought the percent had to be an integer because some installer I used years ago wouldn't accept decimal values.


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

Board footer

Powered by FluxBB