diff options
author | cperciva <cperciva@FreeBSD.org> | 2005-08-16 13:19:17 +0000 |
---|---|---|
committer | cperciva <cperciva@FreeBSD.org> | 2005-08-16 13:19:17 +0000 |
commit | 0a2bc27888b0b4f83dbfcc0cf62abd87aa231762 (patch) | |
tree | 36801fff788656a503e4e6eb7301a2a72e0c7bc3 /usr.sbin/sade | |
parent | 6f0a19f7ae2112c33839203865b8c22f797468fe (diff) | |
download | FreeBSD-src-0a2bc27888b0b4f83dbfcc0cf62abd87aa231762.zip FreeBSD-src-0a2bc27888b0b4f83dbfcc0cf62abd87aa231762.tar.gz |
Change the default partition sizing code in order to
1. Provide larger /, /var, and /tmp partitions (the last increase was
in 2001, and we now have both larger hard drives and more space-hungry
software.)
2. If there is enough space available, allocate extra space to /var
sufficient to store a crash dump.
On systems where harddrivesize > 3 * RAMsize + 10GB, the default sizes
will now be as follows:
swap RAMsize * 2
/ 512 MB
/tmp 512 MB
/var 1024 MB + RAMsize
/usr the rest (8GB or more)
On systems where harddrivesize > RAMsize / 8 + 2 GB, the default sizes
will be in the following ranges, with space allocated proportionally:
swap RAMsize / 8 -- RAMsize * 2
/ 256 MB -- 512 MB
/tmp 128 MB -- 512 MB
/var 128 MB -- 1024 MB
/usr 1536 MB -- 8192 MB
On systems with even less disk space, the existing behaviour is not
changed.
Approved by: re (kensmith)
MFC after: 1 day
(or once people stop arguing about colours of paint)
Diffstat (limited to 'usr.sbin/sade')
-rw-r--r-- | usr.sbin/sade/label.c | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/usr.sbin/sade/label.c b/usr.sbin/sade/label.c index c752f73..c5d81af 100644 --- a/usr.sbin/sade/label.c +++ b/usr.sbin/sade/label.c @@ -82,10 +82,10 @@ * for this configuration we scale things relative to the NOM vs DEFAULT * sizes. If the disk is larger then /home will get any remaining space. */ -#define ROOT_DEFAULT_SIZE 256 -#define USR_DEFAULT_SIZE 3072 -#define VAR_DEFAULT_SIZE 256 -#define TMP_DEFAULT_SIZE 256 +#define ROOT_DEFAULT_SIZE 512 +#define USR_DEFAULT_SIZE 8192 +#define VAR_DEFAULT_SIZE 1024 +#define TMP_DEFAULT_SIZE 512 #define HOME_DEFAULT_SIZE USR_DEFAULT_SIZE /* @@ -93,10 +93,10 @@ * when we have insufficient disk space. If this isn't sufficient we scale * down using the MIN sizes instead. */ -#define ROOT_NOMINAL_SIZE 192 -#define USR_NOMINAL_SIZE 512 -#define VAR_NOMINAL_SIZE 64 -#define TMP_NOMINAL_SIZE 64 +#define ROOT_NOMINAL_SIZE 256 +#define USR_NOMINAL_SIZE 1536 +#define VAR_NOMINAL_SIZE 128 +#define TMP_NOMINAL_SIZE 128 #define HOME_NOMINAL_SIZE USR_NOMINAL_SIZE /* The bottom-most row we're allowed to scribble on */ @@ -1378,6 +1378,11 @@ requested_part_size(char *varName, daddr_t nom, int def, int perc) * a confirmation requestor (*req == 1). *req is 0 on * entry to this call. * + * As a special exception to the usual sizing rules, /var is given + * additional space equal to the amount of physical memory present + * if perc == 100 in order to ensure that users with large hard drives + * will have enough space to store a crashdump in /var/crash. + * * We autolabel the following partitions: /, swap, /var, /tmp, /usr, * and /home. /home receives any extra left over disk space. */ @@ -1468,7 +1473,21 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req) record_label_chunks(devs, dev); } if (VarChunk == NULL) { - sz = requested_part_size(VAR_VAR_SIZE, VAR_NOMINAL_SIZE, VAR_DEFAULT_SIZE, perc); + /* Work out how much extra space we want for a crash dump */ + unsigned long crashdumpsz; + + mib[0] = CTL_HW; + mib[1] = HW_PHYSMEM; + size = sizeof(physmem); + sysctl(mib, 2, &physmem, &size, (void *)0, (size_t)0); + + if (perc == 100) + crashdumpsz = physmem / 1048576; + else + crashdumpsz = 0; + + sz = requested_part_size(VAR_VAR_SIZE, VAR_NOMINAL_SIZE, \ + VAR_DEFAULT_SIZE + crashdumpsz, perc); AutoVar = Create_Chunk_DWIM(label_chunk_info[here].c->disk, label_chunk_info[here].c, sz, part, |