NixOS configuration to format disk before mountingHow to split /etc/nixos/configuration.nix into separate...
Have only girls been born for a long time in this village?
Why should someone be willing to write a strong recommendation even if that means losing a undergraduate from their lab?
How do slats reduce stall speed?
Designing a prison for a telekinetic race
How to translate 脑袋短路 into English?
90s(?) book series about two people transported to a parallel medieval world, she joins city watch, he becomes wizard
Why is su world executable?
Are objects subject to critical hits?
Default camera device to show screen instead of physical camera
Why doesn't the Falcon-9 first stage use three legs to land?
Are unaudited server logs admissible in a court of law?
tikz bug in curve to from nodes
Why didn’t Doctor Strange stay in the original winning timeline?
In xXx, is Xander Cage's 10th vehicle a specific reference to another franchise?
Does the Green Flame-Blade cantrip work with the Zephyr Strike spell?
Why don't politicians push for fossil fuel reduction by pointing out their scarcity?
Syncing bitcoin node with multiple cores
Is there a commercial liquid with refractive index greater than n=2?
What happened after the end of the Truman Show?
What is the grammatical function of the word "y" in the following sentence?
How to think about joining a company whose business I do not understand?
Why should I pay for an SSL certificate?
Is a butterfly one or two animals?
How to avoid using System.String with Rfc2898DeriveBytes in C#
NixOS configuration to format disk before mounting
How to split /etc/nixos/configuration.nix into separate modules?`ld: cannot find -lc` on NixOSNixOS Build Error: “dbus/dbus.h” not foundInstalling CMU fonts on NixOSHow can I install jack2 on nixos?How do I upgrade Nixos to use a new channel nixos version?Is there a faster alternative than `nixos-rebuild switch` when updating services?How can I enable PHP within the Apache service configuration in Nixos?NixOS - how is environment.systemPackages implementedIs NixOS configuration gittable?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I'm running a VM on a virtual cluster. The (experimental) cluster provisioning system puts an unformatted block device in /dev/sdb. Upon cluster initialization, I want to format this device and mount.
In the initialization workflow, my VM contacts the cluster manager to learn how configure the VM--network interfaces, and devices. I'm feeding this info to a nix expression which my /etc/nixos/configuration.nix inherits. I can make the filesystem mount a partitioned disk:
fileSystems."/log" = { device = "${logDevice}1";
fsType = "bind"; };
However, I don't know how to format the device as a part of configuration. If this was a nix derivation, I would put make some sort of buildHook, e.g.
formatLogDisk = ''
parted -s ${logDevice} mklabel gpt
parted -s ${logDevice} unit % mkpart extended ext4 0 100
mkfs.ext4 -q ${logDevice}1
'';
So I'm wondering if there is some sort of preMount module hook that might run this. Otherwise, I can run the utilities directly during the phase that collects the system information, but I was hoping thered be a nixOs based answer.
nixos nix
New contributor
trevor cook is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
I'm running a VM on a virtual cluster. The (experimental) cluster provisioning system puts an unformatted block device in /dev/sdb. Upon cluster initialization, I want to format this device and mount.
In the initialization workflow, my VM contacts the cluster manager to learn how configure the VM--network interfaces, and devices. I'm feeding this info to a nix expression which my /etc/nixos/configuration.nix inherits. I can make the filesystem mount a partitioned disk:
fileSystems."/log" = { device = "${logDevice}1";
fsType = "bind"; };
However, I don't know how to format the device as a part of configuration. If this was a nix derivation, I would put make some sort of buildHook, e.g.
formatLogDisk = ''
parted -s ${logDevice} mklabel gpt
parted -s ${logDevice} unit % mkpart extended ext4 0 100
mkfs.ext4 -q ${logDevice}1
'';
So I'm wondering if there is some sort of preMount module hook that might run this. Otherwise, I can run the utilities directly during the phase that collects the system information, but I was hoping thered be a nixOs based answer.
nixos nix
New contributor
trevor cook is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
I'm running a VM on a virtual cluster. The (experimental) cluster provisioning system puts an unformatted block device in /dev/sdb. Upon cluster initialization, I want to format this device and mount.
In the initialization workflow, my VM contacts the cluster manager to learn how configure the VM--network interfaces, and devices. I'm feeding this info to a nix expression which my /etc/nixos/configuration.nix inherits. I can make the filesystem mount a partitioned disk:
fileSystems."/log" = { device = "${logDevice}1";
fsType = "bind"; };
However, I don't know how to format the device as a part of configuration. If this was a nix derivation, I would put make some sort of buildHook, e.g.
formatLogDisk = ''
parted -s ${logDevice} mklabel gpt
parted -s ${logDevice} unit % mkpart extended ext4 0 100
mkfs.ext4 -q ${logDevice}1
'';
So I'm wondering if there is some sort of preMount module hook that might run this. Otherwise, I can run the utilities directly during the phase that collects the system information, but I was hoping thered be a nixOs based answer.
nixos nix
New contributor
trevor cook is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I'm running a VM on a virtual cluster. The (experimental) cluster provisioning system puts an unformatted block device in /dev/sdb. Upon cluster initialization, I want to format this device and mount.
In the initialization workflow, my VM contacts the cluster manager to learn how configure the VM--network interfaces, and devices. I'm feeding this info to a nix expression which my /etc/nixos/configuration.nix inherits. I can make the filesystem mount a partitioned disk:
fileSystems."/log" = { device = "${logDevice}1";
fsType = "bind"; };
However, I don't know how to format the device as a part of configuration. If this was a nix derivation, I would put make some sort of buildHook, e.g.
formatLogDisk = ''
parted -s ${logDevice} mklabel gpt
parted -s ${logDevice} unit % mkpart extended ext4 0 100
mkfs.ext4 -q ${logDevice}1
'';
So I'm wondering if there is some sort of preMount module hook that might run this. Otherwise, I can run the utilities directly during the phase that collects the system information, but I was hoping thered be a nixOs based answer.
nixos nix
nixos nix
New contributor
trevor cook is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
trevor cook is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
trevor cook is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked Aug 16 at 17:27
trevor cooktrevor cook
1113 bronze badges
1113 bronze badges
New contributor
trevor cook is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
trevor cook is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
trevor cook is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f535917%2fnixos-configuration-to-format-disk-before-mounting%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
trevor cook is a new contributor. Be nice, and check out our Code of Conduct.
trevor cook is a new contributor. Be nice, and check out our Code of Conduct.
trevor cook is a new contributor. Be nice, and check out our Code of Conduct.
trevor cook is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f535917%2fnixos-configuration-to-format-disk-before-mounting%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown