-2

Hello Im looking to a simple way of using my 2 empty partitions i did format with Gparted, They seem unmounted and im not very sure about setting up the mount points and auto-mount, Im just arriving from windows and im not looking back. Anyone can help ? ( for the details they are lone partitions on their disks boot and system swap was made on a third disk.

!{Listimage}(https://pasteboard.co/oUmywe1f8TuK.png) LSBLK -F yes i woul like to have them permanent @oldfred

4
  • Post this: lsblk -f Are these partitions you want to permanent mount with fstab when you reboot or occasionally mount just by clicking on them with file browser.
    – oldfred
    Mar 5, 2022 at 19:39
  • well i dont find the square brackets so you are most likely seing the same as me only the link toward the image i took..i want them permanent mounted , i took the image to have each collum on top of each item properly, a copy paste was too messy Mar 5, 2022 at 19:59
  • Welcome, Benoit. What version of Ubuntu are you running?
    – Frobozz
    Mar 5, 2022 at 20:36
  • 1
    I prefer labels, but you can use UUID to keep unique. You can use Disks, gparted or command line to add labels: askubuntu.com/questions/147319/… or sudo e2label /dev/sdXY data or /dev/nvme0n1p1. You also need ownership & permissions. askubuntu.com/questions/1013677/… & askubuntu.com/questions/1058756/… & help.ubuntu.com/community/Fstab
    – oldfred
    Mar 5, 2022 at 20:44

1 Answer 1

0

Welcome to Linux, Benoit!

Just a reminder, there are no safety nets in linux.

Always make a backup!

The following Bash commands will do what you ask. Be certain the partitions are correct for your environment in the "for vol ..." line.

# Become super user - "danger Will Robinson!"
sudo su

# Make backup fstab - in case things go bad
cp /etc/fstab /tmp/fstab.bkup

# Make temporary target fstab
cp /etc/fstab /tmp/fstab.tmp

# Create mount points and fstab entries
# Volume names will vary - use 'lsblk -f' to find yours
for vol in sda1 nvme0n1p1
do
  mkdir -p /mnt/$vol 
  UUID=$(lsblk -fno UUID /dev/$vol) 
  printf "UUID=%s\t/mnt/%s\text4\tdefaults\t0\t2\n" $UUID $vol >> /tmp/fstab.tmp
done

Check that /tmp/fstab.tmp looks good. That is identical to /etc/fstab but with the additional lines added for the new partitions. If all looks good:

cp /tmp/fstab.tmp /etc/fstab
sync;sync
mount -a
exit
2
  • Thanks alot !!! :) im sorry i had the window lowered it works great !! very appreciated Mar 6, 2022 at 1:14
  • i think i made one slight mistake adding the sync;sync after /ect/fstab on the same line, im not certain but now i seem to have UUID=sync in my Fstab (and thats now that i see your wise warning) hehe im guessing i have to enter the UUID manually in the file is there one UUID for the whole Pc or one per drive Mar 6, 2022 at 1:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .