NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
install/55375: sysinst sets swap partition size 0 bytes on <800MB disk
>Number: 55375
>Category: install
>Synopsis: sysinst sets swap partition size 0 bytes on <800MB disk
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: install-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jun 12 17:30:00 +0000 2020
>Originator: Izumi Tsutsui
>Release: NetBSD 9.0
>Organization:
>Environment:
System: NetBSD 9.0 (RAMDISK) #0: Fri Feb 14 00:06:28 UTC 2020
mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/cobalt/compile/RAMDISK
Architecture: maybe all
Machine: all
>Description:
sysinst sets partition size 0 bytes if target disk size is
less than 800MB (DEFUSRSIZE).
"No swap by default" is annoying for users even if
there is enough "Free space".
>How-To-Repeat:
GXemul is easier way to test.
% dd if=/dev/zero of=gxemul-cobalt.img bs=1m count=512
% ftp http://cdn.netbsd.org/pub/NetBSD/NetBSD-9.0/cobalt/binary/kernel/netbsd-RAMDISK.gz
% gxemul -X -E cobalt -d gxemul-cobalt.img netbsd-RAMDISK.gz
---
:
[ 1.0000000] NetBSD 9.0 (RAMDISK) #0: Fri Feb 14 00:06:28 UTC 2020
[ 1.0000000] mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/cobalt/compile/RAMDISK
:
[ 4.1002536] wd0 at atabus0 drive 0
[ 4.1002536] wd0: <gxemul-cobalt.img>
[ 4.1002536] wd0: drive supports 128-sector PIO transfers, chs addressing
[ 4.1002536] wd0: 512 MB, 1041 cyl, 16 head, 63 sec, 512 bytes/sect x 1049328 sectors
[ 4.1002536] wd0: 32-bit data port
[ 4.1002536] wd0: drive supports PIO mode 4
[ 4.1002536] wd0(viaide0:0:0): using PIO mode 4
---
NetBSD/cobalt 9.0
This menu-driven tool is designed to help you install NetBSD to a hard disk,
or upgrade an existing NetBSD system, with a minimum of work.
In the following menus type the reference letter (a, b, c, ...) to select an
item, or type CTRL+N/CTRL+P to select the next/previous item.
The arrow keys and Page-up/Page-down may also work.
Activate the current selection from the menu by typing the enter key.
Thank you for using NetBSD!
+-----------------------------------------------+
| NetBSD-9.0 Install System |
| |
|>a: Install NetBSD to hard disk |
| b: Upgrade NetBSD on a hard disk |
| c: Re-install sets or install additional sets |
| d: Reboot the computer |
| e: Utility menu |
| f: Config menu |
| x: Exit Install System |
+-----------------------------------------------+
---
You have chosen to install NetBSD on your hard disk. This will change
information on your hard disk. You should have made a full backup before
this procedure! This procedure will do the following things:
a) Partition your disk
b) Create new BSD file systems
c) Load and install distribution sets
d) Some initial system configuration
(After you enter the partition information but before your disk is changed,
you will have the opportunity to quit this procedure.)
Shall we continue?
+---------------+
| Yes or no? |
| |
| a: No |
|>b: Yes |
+---------------+
---
On which disk do you want to install NetBSD?
+--------------------------+
| Available disks |
| |
|>a: wd0 (512M) |
| b: Extended partitioning |
| x: Exit |
+--------------------------+
---
Sysinst could not automatically determine the BIOS geometry of the disk.
The physical geometry is 1041 cylinders 63 sectors 16 heads
You will be prompted for the geometry. Please enter the number of sectors
per track (maximum 63) and number of heads (maximum 256) that the BIOS uses
to access the disk.
The number of cylinders will be calculated from the disk size.
sectors [63]:
heads [255]:
---
We are now going to install NetBSD on the disk wd0.
NetBSD requires a single partition in the disk's Master Boot Record (MBR)
partition table, this is split further by the BSD disklabel. NetBSD can also
access file systems in other MBR partitions.
If you select 'Use the entire disk' then the previous contents of the disk
will be overwritten and a single MBR partition used to cover the entire disk.
If you want to install more than one operating system then edit the MBR
partition table and create a partition for NetBSD.
About 1.3G is enough for a basic installation, but you should allow extra for
additional software and user files.
Allow at least 3.0G if you want to build NetBSD itself.
+---------------------------------+
| What would you like to do? |
| |
| a: Edit the MBR partition table |
|>b: Use the entire disk |
+---------------------------------+
---
You can use a simple editor to set the sizes of the NetBSD partitions, or
apply the default partition sizes and contents.
You will then be given the opportunity to change any of the partition
details.
The NetBSD (or free) part of your disk (wd0) is 507M.
A full installation requires at least 1042M without X and at least 1292M if
the X sets are included.
+-----------------------------------+
| What would you like to do? |
| |
|>a: Set sizes of NetBSD partitions |
| b: Use default partition sizes |
+-----------------------------------+
---
You can now change the sizes for the system partitions. The default is to
allocate all the space to the root file system. However, you may wish to
have separate /usr (additional system files), /var (log files etc) or /home
(users' home directories) file systems.
Free space will be added to the partition marked with a '+'.
Size (sec) Filesystem
----------------------------------- - --------------------
>a: 10240 /stand
b: 643072 (1028784) + /
c: 0 <swap>
d: 0 /tmp (mfs)
e: 0 /usr
f: 0 /var
----------------------------------- - --------------------
h: Add a user defined partition
i: Clone external partition(s)
j: Change input units (sectors/cylinders/MB/GB)
x: Go on. Free space 385712 sec.
---
>Fix:
According to src/usr.sbin/sysinst/bsddisklabel.c,
sysinst tries to shrink swap partition if there is not
enough space for / (root) and /usr partitions.
It also checks "def_usr" size which is defined as "DEFUSRSIZE",
if /usr is not a separate partition (i.e. its size is zero).
---
static const struct part_usage_info
default_parts_init[] =
{
:
{ .def_size = DEFUSRSIZE*(MEG/512), .mount = "/usr", .type = PT_root,
.fs_type = FS_BSDFFS, .fs_version = 2 },
:
if (wanted->infos[i].type == PT_root) {
if (strcmp(wanted->infos[i].mount, "/") == 0) {
root = i;
} else if (
strcmp(wanted->infos[i].mount, "/usr") == 0) {
if (wanted->infos[i].size > 0)
usr = i;
else
def_usr = i;
}
:
if (root < wanted->num)
required += wanted->infos[root].size;
if (usr < wanted->num)
required += wanted->infos[usr].size;
else if (def_usr < wanted->num)
required += wanted->infos[def_usr].def_size;
free_space -= required;
:
if (free_space < 0 && swap < wanted->num) {
/* steel from swap partition */
daddr_t d = wanted->infos[swap].size;
daddr_t inc = roundup(-free_space, align);
if (inc > d)
inc = d;
free_space += inc;
wanted->infos[swap].size -= inc;
}
if (root < wanted->num) {
/* Add space for 2 system dumps to / (traditional) */
dump_space = get_ramsize() * (MEG/512);
dump_space = roundup(dump_space, align);
if (free_space > dump_space*2)
dump_space *= 2;
if (free_space > dump_space) {
wanted->infos[root].size += dump_space;
free_space -= dump_space;
}
}
---
DEFUSRSIZE (800MB) seems a size for "Full installation",
so it's too aggressive to remove swap partition completely
for such full size /usr binaries for users who will install
NetBSD using "Minimum installation".
sysinst also tries to reserve space for root parttion to
"add space for 2 system dumps to /" but I doubt it's really
useful to reserve such space by "shrinking the swap partition."
Maybe it's better to have a "lower limit" of the default
swap partition size?
Or is it better to simply remove the following lines
> else if (def_usr < wanted->num)
> required += wanted->infos[def_usr].def_size;
(and lines that reserve dump_size)
and make it users' responsibility to allocate enough space
for target installation?
---
Izumi Tsutsui
Home |
Main Index |
Thread Index |
Old Index