Mount Disks and/ or Network Shares in Arch Manjaro
Mount Disks and/ or Network Shares with fstab in Arch Manjaro.
Just documenting how to mount disks and/ or Network Shares with fstab in Arch Manjaro.
Mount Harddrive with fstab
If you installed arch Manjaro there should be an fstab file generated # Open fstab and check it's contents
sudo nano /etc/fstab
It should look something like this
# Static information about the filesystems
# See fstab(5) for details.
# <file system> <dir> <type> <options> <dump> <pass>
UUID=64FC-A341 /boot/efi vfat umask=0077 0 2
UUID=e5f34287-6784-40dd-8121-9fa48a83579c swap swap defaults,noatime 0 0
UUID=20ee6f35-7bea-4a65-92cd-578ec41acf71 / ext4 defaults,noatime 0 1
UUID=25746cdc-a314-4b60-ae3d-9854a9bc3d56 /home ext4 defaults,noatime 0 2
Add new disk
Now let's say i just added a new disk. How to add it # Check the dev name of the new disk
lsblk -f
# Now make a partition on the new disk Use --zero to empty the partition table and change the ? to your drive adress
cfdisk --zero /dev/sd?
Select label type "gpt" when prompted and press enter
Select Free space
Enter to assign all the free space to this Partition
Select Type
Select Linux filesystem
Save the changes
Select Write
Input yes, not just y, when prompted
Select Quit
# Now to format the partition with ext4
mkfs.ext4 /dev/sd?1
Now we have a partition, we can use blkid to get the UUID number # Get UUID of partition
blkid
Copy the UUID and let's add it to fstab # Open fstab
sudo nano /etc/fstab
# Paste the UUID to fstab Remove the "" quotes around the UUID
# Static information about the filesystems
# See fstab(5) for details.
# <file system> <dir> <type> <options> <dump> <pass>
UUID=64FC-A341 /boot/efi vfat umask=0077 0 2
UUID=e5f34287-6784-40dd-8121-9fa48a83579c swap swap defaults,noatime 0 0
UUID=20ee6f35-7bea-4a65-92cd-578ec41acf71 / ext4 defaults,noatime 0 1
UUID=25746cdc-a314-4b60-ae3d-9854a9bc3d56 /home ext4 defaults,noatime 0 2
UUID=af1bc8d8-4f1c-4c7d-b366-a6015e8b10c8
Now come up with a mount name and where you want to mount it (copy the rest (type, options, dump, pass) from /home)
/mntname ext4 defaults,noatime 0 2
So now fstab should look like this
# Static information about the filesystems
# See fstab(5) for details.
# <file system> <dir> <type> <options> <dump> <pass>
UUID=64FC-A341 /boot/efi vfat umask=0077 0 2
UUID=e5f34287-6784-40dd-8121-9fa48a83579c swap swap defaults,noatime 0 0
UUID=20ee6f35-7bea-4a65-92cd-578ec41acf71 / ext4 defaults,noatime 0 1
UUID=25746cdc-a314-4b60-ae3d-9854a9bc3d56 /home ext4 defaults,noatime 0 2
UUID=af1bc8d8-4f1c-4c7d-b366-a6015e8b10c8 /mntname ext4 defaults,noatime 0 2
Now to mount everything listed in fstab run:
sudo mount -a
Now you should be able to acces the drive
cd /mntname
Some Extra info: By placing it in fstab it will auto mount at boot. To unmount everything
sudo umount -a
Mount samba share with fstab
This explains how to mount a samba share with fstab. Source: https://wiki.archlinux.org/title/Samba # First install samba for CIFS Needed to acces samba shares
sudo pacman -S samba
Before you can start the service, make an conf. # Create a conf file for samba
sudo nano /etc/samba/smb.conf
And paste this in the smb.conf
log file = /var/log/samba/%m.log
# Make a file to store the credentials to acces the share
sudo nano /etc/samba/share
And paste this in the file Fill in a username and password with acces to the share you want to mount
username=
password=
# Enable and start Samba Enable samba to start at boot and start it
sudo systemctl enable --now smb
# Create the folder you want to mount to Example: /mnt/share
mkdir -p /mnt/share
# Edit fstab
sudo nano /etc/fstab
And add the share as following I had to add file_mode=0777,dir_mode=0777, because my sabnzbd couldn't write to it.
//ipaddress/share /mnt/share cifs credentials=/etc/samba/share,_netdev,file_mode=0777,dir_mode=0777 0 0
# Mount the share
sudo mount -a
# Check if the share is mounted
cd /mnt/share
Reboot and check if it auto mounts at boot If it doesn't auto mount after reboot, do the following # Edit NetworkManager-wait-online.service
sudo systemctl edit NetworkManager-wait-online.service
And paste the following between the 2 lines at the top
### Anything between here and the comment below will become the new contents of the file
[Service]
ExecStart=
ExecStart=/usr/bin/nm-online -q -t 30
### Lines below this comment will be discarded
# Enable the service to start at boot
sudo systemctl enable NetworkManager-wait-online.service
What this does is that it waits up until 30 seconds, until the NetworkManager is fully Online, to mount the shares