fstab problem

12 réponses [Dernière contribution]
Substance2004
Hors ligne
A rejoint: 11/05/2013

Hi everyone,

I wanted to intall an extra hard drive for the system.

So after fully formated my hard drive in ext4, I've changed the /etc/fstab for this HD to automatically be mounted when I boot.

I carefully took the UUID of my HD by doing a sudo blkid before.

I also saved a fstab.bak before changing it.

I've typed :
UUID=[the_digits_of_my_hard_drive_UUID] /media/user/My_hard_drive ext4 defaults 0 2

I've done a sudo mount -a with extra hard drive mounted and had no special messages.
With unmounted media, sudo mount -a said the mounting point was not existing, I thought this was normal.
This was not a UUID error.

I tried a reboot, but I can't even have any Grub at all (I have double linux os boot on which I haven't already done the same operation).

I tried to change the fstab with a live USB, but I don't have any privileges to change the fstab.

What did go wrong ?

Thank you

Substance2004
Hors ligne
A rejoint: 11/05/2013

PS : I don't know how many spaces I have to do when writing the line in fstab between the differents informations.

I hope it's not this.

nadebula.1984
Hors ligne
A rejoint: 05/01/2018

The exact number of space(s) is unimportant.

But since you already added the new disk to /etc/fstab, why should you invoke # mount -a command?

Substance2004
Hors ligne
A rejoint: 11/05/2013

Isn't it supposed to mount all filesystems listed in the filesystem table file /etc/fstab ?

So yes, I didn't have any mount of the extra hard drive at all when it was unmounted.
But I suppose it was only when I reboot Trisquel when my extra line in fstab is considered.

It is a real mess to find a good process to install a new hard drive (I read about 4 or 5 ways, some didn't considered UUID).
I thought it was in the procedure.

But I mistook myself before.
I've left a " caracter before the begining of the UUID when I've copied the result of sudo blkid.

And sudo mount -a told there was a mistake !

Magic Banana

I am a member!

I am a translator!

En ligne
A rejoint: 07/24/2010

With unmounted media, sudo mount -a said the mounting point was not existing, I thought this was normal.

Is /media/user/My_hard_drive an existing directory? If not, try to create it:
$ sudo mkdir /media/user/My_hard_drive

That said, /media is supposed to be for removable media. You may want the directory to be directly in /.

Substance2004
Hors ligne
A rejoint: 11/05/2013

I've done this mkdir command because the english Ubuntu told it, but I wanted to see what was going on in /media/user .

Before my unfortunate reboot, I saw that when I was booting my extra hard drive after this mkdir command, I had both My_hard_drive as a folder and My_hard_drive1 as a folder icon with a little hard drive icon in it.

But I've deleted it.

Of course I would prefer the directory to be directly in /.

As I said, I don't know how to modify my system because I have not even a grub when I switch on the computer (I only have the boot menu).
And I can't change anything with a live USB, because it's root protected.

How to do it ???

Magic Banana

I am a member!

I am a translator!

En ligne
A rejoint: 07/24/2010
Substance2004
Hors ligne
A rejoint: 11/05/2013

I have done something else...

Anyway this was a 3 day installation, I've saved before all the home directory and all selections in Synaptic. So, no real problems for recovering it all.

Frist, I tried to modify the /etc/fstab with a live usb by doing

sudo mount /dev/system_partition /mnt

then

sudo pluma /mnt/etc/fstab

which worked pretty well.

But still no grub at all.

Back in the USB live, i've lauched Gparted and saw exclamation marks in the lines of the system, swap, home partitions.

In fact, not having any Grub at all when switch on the computer was a problem with... Bios !

The operation of modifying the fstab had changed the start of the SSD and HD drives in bios !

But I thought this was not the best way to use a computer with an SSD and a HD drive.

So I decided to reinstall it all, which allows me to have extra space on the SSD to install other OS (this is what it's made for) and I've formated the HD in Ext4 (more stable than XFS upon your advices in a previous talk) and choose a /home mount point.
The whole HD drive is now dedicated to Trisquel.

I know I will have to keep a little space for a /home partition in case I'll install other os' because it can cause problems with preferences' softwares I'll launch with them.

I still can modify fstab partition in those future OS for having all privileges on them.

Do you have any advices to give me (making a sudo mkdir /media/user/hard_drive ???) ?

Thanks anyway

Magic Banana

I am a member!

I am a translator!

En ligne
A rejoint: 07/24/2010

I am not sure what kind of advice you want.

You can setup a swap partition (at least the size of your RAM, to hibernate), a partition for / (32 GB are enough for most systems) and a partition for /home that takes the rest of the disk capacity. Keeping unpartitioned space on the disk does not make much sense. Well, if you are using filesystems that cannot be shrunk, free space eases repartitioning. But since you chose ext4 (which can be shrunk) over XFS (which cannot), you will be able to shrink any partition(s) to create a new partition for another system.

If we are talking about two GNU/Linux distributions on the same computer, they can share the same /home: indicate it during installation of the second system, or ask for only / and add a /home line to its /etc/fstab right after. Nevertheless, if a same user runs on both systems a same program but in different versions, one single /home for both systems can create troubles, if the personal configuration of the program changed between the two versions. Also you need the users to have the same user ids and the groups to have the same group ids. If you only install systems based on Debian (or Ubuntu), creating the (first) users in the same order should do it. Otherwise, you can specify the uid when creating every user (and the gid when creating every group) so that it matches the one on the other system (see the third columns of its /etc/passwd and /etc/group files).

For a data filesystem shared among users, you probably want to set the sticky bit.

From any GNU/Linux distribution, you can access any ext4 filesystem, including the /home of another system on the same computer. I am not sure whether any GNU/Linux system requires you to add a line to /etc/fstab for an easy access (or if some will treat the filesystem as on a removable disk, to be mounted in /media). If it does, you need the mount point to exist: create it with 'sudo mkdir /my_mount_point'. You probably want it to be directly in /. The first field on the /etc/fstab line does not need to be a UUID. It can be a "block special device node", i.e., something like /dev/sda1. For "normal" computers, even with several disks, there is nothing to gain by specifying the UUID. For a start (you may then tweak the mount options), the rest of the line can be " /my_mount_point ext4 defaults 0 2", if the filesystem is of the type ext4.

EDIT: I forgot to write about ids, if you go for a shared /home.

Substance2004
Hors ligne
A rejoint: 11/05/2013

> You can setup a swap partition at least the size of your RAM, to hibernate
I did. Around x1.5 of my Ram to be sure. More is useless.

> Keeping unpartitioned space on the disk does not make much sense.
It's a quite big SSD card (around 450 Go) if we consider 32 GB is enough for most system. It increase the speed of the system.
I did prefer a big home with a 2Go HD because I store a lot of things as I use a lot graphics like photos and videos (I use Scribus and my printable folders can be big). SSD drives are worst when you write and read all the time like I do. It is great for laptops as you move with them even switched on.

I sometimes use Ubuntu for upgraded softwares with extra features and hardware that haven't already got free drivers.
I had to use Jitsi which only works only with Chromium. I need Ubuntu in some occasions.

But I this allows me to test other OS. This is why I have a lot free space.

On your second paragraph about other os, this is was I was talking about previously, but you told it better than me.

Magic Banana

I am a member!

I am a translator!

En ligne
A rejoint: 07/24/2010

It's a quite big SSD card (around 450 Go) if we consider 32 GB is enough for most system. It increase the speed of the system.

Being SSD, rather than HDD, increases the speed of the system. Keeping unpartitioned space does not, as far as I know. If the SSD hosts shrinkable filesystems, space is easy to make. For instance, using GParted. That said, if you test other distributions more often than you fill the disk, not having to shrink any filesystem (because you have unpartitioned space) saves you time and decreases risks of damaging the systems you actually use (imagine a power cut while a root partition is shrunk).

I did prefer a big home with a 2Go HD

I guess you mean a 2 TB HD.

nadebula.1984
Hors ligne
A rejoint: 05/01/2018

I often add or remove hard disks or SSDs. Below is what I always do (maybe insecure, but very easy). For your reference:

1. Connect to hard disk or SSD to your system. Create partition(s) and format them. Get the UUID.
2. Create mount points (sub-directories) under home directory (/home/username). I never mount 2nd disk under /media or /mnt, etc.
3. Modify /etc/fstab to add new mount point with the UUID. The parameters are same as /home partition.
4. Reboot the system. If the mounted directory (e.g. /home/username/harddisk) is read-only, change the ownership (for only once):

~$ sudo chown username:username harddisk

Hint: try not to use sudo to run GUI programs like pluma. Use a command line editor like nano with sudo instead. Or else you can try the sudoedit command:

~$ SUDO_EDITOR=pluma sudoedit /etc/fstab

Some GUI text editors (e.g. kate) can't be used with sudo at all. If you try to run "sudo kate", it won't start.

Substance2004
Hors ligne
A rejoint: 11/05/2013

Thank you