Mount permanently new internal hard drive in custum directory

Hello community.-

I have recently purchased a new sata internal hard drive, i have formated it with filesystem gpt and ext4 with gparted, now i want to mount it permanently in this directory /home/jorgecg/Backup in my “home” disk or partition but when i build sudo nixos-rebuild switch i cant boot my system and in best scenarios its mounted incorrectly i have added this to my configuration.nix.-

fileSystems.“home/jorgecg/Backup” = {
device = “/dev/disk/by-uuid/87fcae4a-327f-4a99-a768-0148f5811c0d”;
fsType = “ext4”;
options = [ “defaults” “user” “rw” “utf8” “noauto” “umask=000” ];
};

i have found my disk uuid with the command.- ls -l /dev/disk/by-uuid Also i dont know its correct but i have modified hardware-configuration.nix with the same code, could someone help me please? i have spent a week in this

In case this isn’t a typo, you need the leading slash before home in fileSystems."/home/jorgecg/Backup"

Otherwise, you’ll need to find what the actual error message is. With the noauto option you have there, it shouldn’t cause boot to fail, and you should be able to log in and mount it manually and see what it says.

Oh sorry about that yes, it was a typo, but i corrected it and still i cant boot, journalctl -xb -p3 throws me this errors but dont know why or how to fix them.- nixos systemd: Failed to mount /root/.cache/doc and Failed to mount /root/.gufs, im thinking of mounting the drive with a label, would that be a good approach? Thanks by the way @ElvishJerricco

If the errors are complaining about directories like /root/.cache/doc and /root/.gufs, then the /home/jorgecg/Backup file system obviously isn’t the problem. Try to figure out why those directories are failing to mount. What does your hardware-configuration.nix look like?

Heres my hardware-configuration.nix, but its not the same that the one i had when i post this thread, lol i had to install nixos again yesterday night because i couldnt boot neither compile again my configuration.nix heres my new file.-

Do not modify this file! It was generated by ‘nixos-generate-config’

and may be overwritten by future invocations. Please make changes

to /etc/nixos/configuration.nix instead.

{ config, lib, pkgs, modulesPath, … }:

{
imports =
[ (modulesPath + “/installer/scan/not-detected.nix”)
];

boot.initrd.availableKernelModules = [ “xhci_pci” “ahci” “usb_storage” “usbhid” “sd_mod” ];
boot.initrd.kernelModules = ;
boot.kernelModules = [ “kvm-amd” ];
boot.extraModulePackages = ;

fileSystems.“/” =
{ device = “/dev/disk/by-uuid/67609d83-28f5-424e-ab55-5555d48b3fab”;
fsType = “ext4”;
};

fileSystems.“/boot” =
{ device = “/dev/disk/by-uuid/5DE7-6E33”;
fsType = “vfat”;
};

fileSystems.“/home” =
{ device = “/dev/disk/by-uuid/00f99ed8-2ca3-4f44-a3a8-7323a0cc8f67”;
fsType = “ext4”;
};

swapDevices = ;

Enables DHCP on each ethernet and wireless interface. In case of scripted networking

(the default) this is the recommended approach. When using systemd-networkd it’s

still possible to use this option, but it’s recommended to use it in conjunction

with explicit per-interface declarations with networking.interfaces.<interface>.useDHCP.

networking.useDHCP = lib.mkDefault true;

networking.interfaces.enp4s0.useDHCP = lib.mkDefault true;

nixpkgs.hostPlatform = lib.mkDefault “x86_64-linux”;
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

Btw i have removed my directory/hard drive mount point, cant risk to format again

heres my new hardware-configuration.nix with the mount point recently added.-

# Do not modify this file!  It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations.  Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:

{
  imports =
    [ (modulesPath + "/installer/scan/not-detected.nix")
    ];

  boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ "kvm-amd" ];
  boot.extraModulePackages = [ ];

  fileSystems."/" =
    { device = "/dev/disk/by-uuid/67609d83-28f5-424e-ab55-5555d48b3fab";
      fsType = "ext4";
    };

  fileSystems."/boot" =
    { device = "/dev/disk/by-uuid/5DE7-6E33";
      fsType = "vfat";
    };

  fileSystems."/home" =
    { device = "/dev/disk/by-uuid/00f99ed8-2ca3-4f44-a3a8-7323a0cc8f67";
      fsType = "ext4";
    };

  fileSystems."/root/.cache/doc" =
    { device = "portal";
      fsType = "fuse.portal";
    };

  fileSystems."/root/.gvfs" =
    { device = "gvfsd-fuse";
      fsType = "fuse.gvfsd-fuse";
    };

  fileSystems."/home/jorgecg/Backup" =
    { device = "/dev/disk/by-uuid/87fcae4a-327f-4a99-a768-0148f5811c0d";
      fsType = "ext4";
    };

  swapDevices =
    [ { device = "/dev/disk/by-uuid/adfd1c73-b129-4f82-8ebc-64cb1dc211e6"; }
    ];

  # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
  # (the default) this is the recommended approach. When using systemd-networkd it's
  # still possible to use this option, but it's recommended to use it in conjunction
  # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
  networking.useDHCP = lib.mkDefault true;
  # networking.interfaces.docker0.useDHCP = lib.mkDefault true;
  # networking.interfaces.enp4s0.useDHCP = lib.mkDefault true;
  # networking.interfaces.tailscale0.useDHCP = lib.mkDefault true;

  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
  hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

Please format your code using triple backticks ``` before and after

Looks like your hardware-configuration.nix got kinda funky. I don’t think those /root/.gvfs or /root/.cache/doc parts are supposed to be there.

Sorry didnt knew how to format code, i will do it tommorrow now its late at night, do i remove those entries from hardware-configuration.nix ?
Thank you again

@ElvishJerricco !!! Man now it works !!! Thank you very much !!