ubuntu und swap size

ror.schach
Beiträge: 27
Registriert: 23 Nov 2020, 13:30

ubuntu und swap size

Beitrag von ror.schach »

Hallo,

ich versuche gerade mit OPSI und dem ubuntu20.04-Paket eine Installation durchzuführen. Doch am Ende ist die Swap-Partition immer 1GB groß und dies ist uns etwas knapp.

Laut Doku sollte die Swap-Partition unter default-Einstellungen so groß sein wie der verfügbare RAM. In unserem Fall 8GB.

Ich habe folgende versucht.

Partion_disk: first
partion_method: lvm
partition_recipe: Atomic
swap_size: <empty>

erwartet: 8GB
vorhanden: 1GB Partition

Partion_disk: first
partion_method: lvm
partition_recipe: Atomic
swap_size: 10GB

erwartet: 10GB
vorhanden: 1GB Partition

Partion_disk: first
partion_method: lvm
partition_recipe: customSwap
swap_size: 10GB

erwartet: 10GB
vorhanden: 2GB FILE

Was mache ich falsch? Wie bekomme ich eine 8GB Swap-Partition erstellt?

Vielen Dank

ror.schach
Benutzeravatar
SisterOfMercy
Beiträge: 1556
Registriert: 22 Jun 2012, 19:18

Re: ubuntu und swap size

Beitrag von SisterOfMercy »

The swap partition size is in ubuntu20-04.py like this:

Code: Alles auswählen

partition_recipe = productProperties.get('partition_recipe', 'atomic')
if partition_recipe == 'customSwap':
    partition_method = 'regular'
    swapSizeProp = productProperties.get('swap_size', '')
    if swapSizeProp:
        removedUnits = removeUnit(swapSizeProp)
        swapSize = int(removedUnits)/1048576
        logger.notice(u"swap size: %s" % swapSize)
    else:
        meminfo = open('/proc/meminfo').read()
        matched = re.search(r'^MemTotal:\s+(\d+)', meminfo)
        if matched:
            memory = int(matched.groups()[0])
            swapSize = int(memory)/1024
            logger.notice(u"memory: %s" % swapSize)
So partition_recipe should be set to customSwap, and partition_method will automatically be set to regular.

But this does not work the same for UEFI, so are you in UEFI or in legacy mode?

It could also be due to the horrible way you set custom partition sizes in the preseed file. How large is the harddisk that ubuntu is installed on?
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
ror.schach
Beiträge: 27
Registriert: 23 Nov 2020, 13:30

Re: ubuntu und swap size

Beitrag von ror.schach »

The harddisk size is 512GB.

If partition method is automatically set to regluar does this mean I can NOT use crypto? Which would we like to use going forward.

We use UEFI only and we did not touch the preseed file yet.
Benutzeravatar
SisterOfMercy
Beiträge: 1556
Registriert: 22 Jun 2012, 19:18

Re: ubuntu und swap size

Beitrag von SisterOfMercy »

If you use UEFI only there is another partition recipe that is used. You will have to modify your preseed file. Copy the current preseed file into the custom directory, give it a sensible name.

Find the line with "d-i partman-auto/expert_recipe string \"
Comment out the customswap thing, and insert your own custom partitioning. Sizes are a bit trial and error.
Example:

Code: Alles auswählen

d-i partman-auto/expert_recipe string				\
	custom ::						\
		1130 1130 1130 ext4				\
			$primary{ }				\
			$bootable{ }				\
			method{ format } format{ }		\
			use_filesystem{ } filesystem{ ext4 }	\
			options/nosuid{ nosuid }		\
			options/noexec{ noexec }		\
			options/nodev{ nodev }			\
			options/noatime{ noatime }		\
			options/acl{ acl }			\
			options/user_xattr{ user_xattr }	\
			mountpoint{ /boot }			\
			.					\
		16109 16109 16109 ext4				\
			$lvmok{ }				\
			lv_name{ root }				\
			method{ format } format{ }		\
			use_filesystem{ } filesystem{ ext4 }	\
			options/noatime{ noatime }		\
			options/acl{ acl }			\
			options/user_xattr{ user_xattr }	\
			mountpoint{ / }				\
			.					\
		9666 9666 -1 ext4				\
			$lvmok{ }				\
			lv_name{ opt }				\
			method{ format } format{ }		\
			use_filesystem{ } filesystem{ ext4 }	\
			options/nodev{ nodev }			\
			options/noatime{ noatime }		\
			options/acl{ acl }			\
			options/user_xattr{ user_xattr }	\
			mountpoint{ /opt }			\
			.					\
		2150 2150 2150 linux-swap			\
			method{ swap }				\
			format{ }				\
			.					\
This example does not have any options for UEFI, so you would have to add those yourself.

Then change preseed in configed to the sensible name you gave the file. Set partition_recipe to the name used in the preseed file, in this case custom.
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
Benutzeravatar
m.radtke
Ex-uib-Team
Beiträge: 1767
Registriert: 10 Jun 2015, 12:19

Re: ubuntu und swap size

Beitrag von m.radtke »

Guten Morgen,

ich kann das Problem nachstellen und werde schauen wie man das gelöst bekommt.
Grundsätzlich greif das swap_size Property nur wenn das partition_recipe auf customSwap steht.
Das customSwap partition_recipe überschreibt das partition_method auf regular, da es damals so vom Kunden gebraucht wurde, somit wird alles was da drin steht überschrieben.

Verwendet ihr UEFI?
Damals wurde das customSwap vom Kunden nur für BIOS Maschinen gebraucht und das Partitionierungsschema unter UEFI ist da nochmal etwas anders.

Gruß
Mathias


Vielen Dank für die Nutzung von opsi. Im Forum ist unser Support begrenzt.

Für den professionellen Einsatz und individuelle Beratung empfehlen wir einen Support-Vertrag und eine Schulung.
Gerne informieren wir Sie zu unserem Angebot.

uib GmbH
Telefon: +49 6131 27561 0
E-Mail: sales@uib.de


ror.schach
Beiträge: 27
Registriert: 23 Nov 2020, 13:30

Re: ubuntu und swap size

Beitrag von ror.schach »

Moin,

wir benutzen ausschließlich UEFI.

Gibt es zu dem custom-Preseed-File eine Doku on die ich schaun kann, damit ich nicht blind mit stochern anfange :D

Danke

ror.schach
Benutzeravatar
SisterOfMercy
Beiträge: 1556
Registriert: 22 Jun 2012, 19:18

Re: ubuntu und swap size

Beitrag von SisterOfMercy »

Well, not really. Somewhere all these expert recipe options in preseed files are not that well documented.

Maybe you have a support contract with uib or with canonical? Otherwise it might be an issue of searching for terms like this: "ubuntu preseed partitioning expert recipe" on your preferred search page.
I think there is also a way of recording your choices during a manual install and using that afterwards, but I have no experience with that at all.
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
Benutzeravatar
m.radtke
Ex-uib-Team
Beiträge: 1767
Registriert: 10 Jun 2015, 12:19

Re: ubuntu und swap size

Beitrag von m.radtke »

also als schnellen Workaround kannst du das Netboot Paket ubuntu verwenden.

habe eben eine UEFI VM mit 8GB RAM und 5GB SWAP installiert und wurde korrekt gesetzt.

Gruß
Mathias


Vielen Dank für die Nutzung von opsi. Im Forum ist unser Support begrenzt.

Für den professionellen Einsatz und individuelle Beratung empfehlen wir einen Support-Vertrag und eine Schulung.
Gerne informieren wir Sie zu unserem Angebot.

uib GmbH
Telefon: +49 6131 27561 0
E-Mail: sales@uib.de


ror.schach
Beiträge: 27
Registriert: 23 Nov 2020, 13:30

Re: ubuntu und swap size

Beitrag von ror.schach »

SisterOfMercy hat geschrieben: 26 Jan 2022, 09:00 If you use UEFI only there is another partition recipe that is used. You will have to modify your preseed file. Copy the current preseed file into the custom directory, give it a sensible name.
For now we only use the ubuntu20-04 package. Except from product properties we do not change anything. Where do I find the "current preseed file"
Benutzeravatar
SisterOfMercy
Beiträge: 1556
Registriert: 22 Jun 2012, 19:18

Re: ubuntu und swap size

Beitrag von SisterOfMercy »

ror.schach hat geschrieben: 27 Jan 2022, 11:58 For now we only use the ubuntu20-04 package. Except from product properties we do not change anything. Where do I find the "current preseed file"
/var/lib/opsi/depot/ubuntu20-04/ubuntu20-04.cfg
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
Antworten