Page 1 of 1

how to auto mount ext4 partition ?

PostPosted: Dec 29th, '14, 01:41
by gerzal
Hi !
how to mount automatically and permanently a partition without requesting the root password every time I want to access in.
the partition is ext4.
thank you friends.

Re: how to auto mount ext4 partition ?

PostPosted: Dec 29th, '14, 11:22
by Symbioxy
Hi!

- Go to the Mageia Control Center / Local Disks / Manage disk partitions: https://doc.mageia.org/mcc/4/en/content/drakdisk.html
- "you can switch to the hard disk you want to work on by selecting the correct tab (sda, sdb, sdc etc)."
- Click on the partition you want to automatically mount
- Click on Mount point
- Type the path you want to use to access the content, typically: /mnt/my_drive, and OK

Is this your partition on a local drive and permantantly available to the system?

Re: how to auto mount ext4 partition ?

PostPosted: Dec 29th, '14, 19:50
by doktor5000
You can also take another approach as explained in viewtopic.php?f=41&t=5148

If you take the approach as suggested by Symbioxy, keep https://wiki.mageia.org/en/Mageia_4_Err ... rrect_UUID in mind and be sure to add the option "nofail" for that mount as otherwise system boot will fail if this partition cannot be mounted during boot.

Re: how to auto mount ext4 partition ?

PostPosted: Dec 29th, '14, 20:21
by gerzal
before reading your post I tried modifying fstab file and the catastrophe happened
this is exactelly what i'm suffring of and i'm not expert.
here is the content of the old fstab file ( not sure about the line i modified):
# Entry for /dev/sdb4 :
UUID=c660d5ca-ce0d-48d6-bb52-e21a5036f33c / ext4 acl,relatime 1 1
# Entry for /dev/sdb3 :
UUID=4f5cb9a8-a42c-4fad-8edf-1f33ab91e603 /home ext4 acl,relatime 1 2
# Entry for /dev/sda1 :
UUID=5BA5202220F01E0C /media/windows ntfs-3g defaults,umask=000 0 0
# Entry for /dev/sda5 :
UUID=cbc2090b-bafe-4ea7-9604-8767212f925e /var/ ext4 defaults 1 2 (here is the line i tried to modify and get it back)
none /proc proc defaults 0 0
# Entry for /dev/sdb5 :
UUID=2962d6a6-6b9d-4984-8b78-6e0e92e0b121 swap swap defaults 0 0

I added this thing at the end
Code: Select all
umask=000 0 0

and when i got the message you spoke about, i get back the line as it was.
but nothing changed, and i don't know what i have to do.
plz help me because I don't want to reinstall the system, it is full of applications and history of my skype discussions and more and more.

Re: how to auto mount ext4 partition ?

PostPosted: Dec 29th, '14, 22:29
by doktor5000
Well, when you are in the mergency shell, simply edit fstab with vi /etc/fstab and remove the umask=000 bit.
In vi, x key and Del key do the same. If you're done, press Esc :wq and enter to save the file.
You can also use any other non-graphical editor, e.g. nano or mcedit or emacs or whatever you like.

FWIW, which ext4 partition do you want to automount? /dev/sda5 ( /var ) ?
As you seem to have added the umask=000 bit for an ntfs partition ...?

In any case, you can also comment out the complete offending line from /etc/fstab by prepending it with a # sign.


At the end reboot and report back.

Re: how to auto mount ext4 partition ?

PostPosted: Dec 29th, '14, 23:19
by gerzal
first of all thanks, I comment the line and the system works again
I have linux mint beside mageia and I did the modification via text editor, but mageia is my prefered distribution.
so, what should I do to resolve the mistake I did ?
thanks again :)

Re: how to auto mount ext4 partition ?

PostPosted: Dec 30th, '14, 01:22
by doktor5000
Best describe which partition you want to mount, and post the exact contents of your current /etc/fstab and the output of
Code: Select all
lsblk -fl
as root

Re: how to auto mount ext4 partition ?

PostPosted: Dec 30th, '14, 18:56
by gerzal
hi and sorry to be late,
I would like to mount sda5, and here is the contenent of fstab as root
Code: Select all
# Entry for /dev/sdb4 :
UUID=c660d5ca-ce0d-48d6-bb52-e21a5036f33c / ext4 acl,relatime 1 1
# Entry for /dev/sdb3 :
UUID=4f5cb9a8-a42c-4fad-8edf-1f33ab91e603 /home ext4 acl,relatime 1 2
# Entry for /dev/sda1 :
UUID=5BA5202220F01E0C /media/windows ntfs-3g defaults,umask=000 0 0
# Entry for /dev/sda5 :
# UUID=cbc2090b-bafe-4ea7-9604-8767212f925e /var/ ext4 defaults 1 2
none /proc proc defaults 0 0
# Entry for /dev/sdb5 :
UUID=2962d6a6-6b9d-4984-8b78-6e0e92e0b121 swap swap defaults 0 0

and the output of the command line lsblk -fl as root as well :
Code: Select all
NAME FSTYPE LABEL           UUID                                 MOUNTPOINT
sda                                                             
sda1 ntfs                   5BA5202220F01E0C                     /media/windows
sda2                                                             
sda5 ext4   stock           cbc2090b-bafe-4ea7-9604-8767212f925e
sdb                                                             
sdb1                                                             
sdb2 ext4                   bf44d1a6-55bc-4fab-84e5-03de10c76cae
sdb3 ext4   home_of_mageia4 4f5cb9a8-a42c-4fad-8edf-1f33ab91e603 /home
sdb4 ext4   mageia4         c660d5ca-ce0d-48d6-bb52-e21a5036f33c /
sdb5 swap                   2962d6a6-6b9d-4984-8b78-6e0e92e0b121 [SWAP]
sdb6 ext4                   50605965-c3b7-4cc6-aee7-44d6b7a63992
sr0

thnaks.

Re: how to auto mount ext4 partition ?

PostPosted: Dec 30th, '14, 22:09
by doktor5000
gerzal wrote:# Entry for /dev/sda5 :
# UUID=cbc2090b-bafe-4ea7-9604-8767212f925e /var/ ext4 defaults 1 2

Please remove the trailing slash from the fstab entry.

Can you please show the output of
Code: Select all
mount -t ext4 /dev/sda5 /mnt
ls -al /mnt



Totally apart from that, please keep in mind that you still would need to copy/sync over the content that is currently in /var to your new /var partition.

Re: how to auto mount ext4 partition ?

PostPosted: Dec 30th, '14, 22:45
by gerzal
Code: Select all
total 44
drwxr-xr-x  8 root root  4096 Dec 29 20:48 ./
drwxr-xr-x 21 root root  4096 Dec 30 18:23 ../
drwxr-xr-x  5 root root  4096 Dec 29 01:19 cache/
drwxr-xr-x  7 root root  4096 Dec 29 01:19 lib/
drwx------  2 root root 16384 Mar 17  2014 lost+found/
drwxr-xr-x  2 root root  4096 Dec 29 20:48 nmbd/
srwxrwxrwx  1 root root     0 Dec 29 01:17 proftpd.sock=
drwxr-xr-x 11 root root  4096 Dec 29 20:48 run/
drwxrwxrwt  2 root root  4096 Dec 29 01:17 tmp/

Re: how to auto mount ext4 partition ?

PostPosted: Dec 30th, '14, 22:48
by gerzal
and about what did you say :
Totally apart from that, please keep in mind that you still would need to copy/sync over the content that is currently in /var to your new /var partition.

i didn't understan that, sorry.

Re: how to auto mount ext4 partition ?

PostPosted: Dec 30th, '14, 23:11
by doktor5000
So the manual mount is OK. If you edited the fstab and removed the trailing slash, you can now remove the # sign at the beginning of that line, it will be mounted on next boot.

For your question: You currently have a running system where /var is on the / partition, and it already contains some files from your running system.
If you now mount /dev/sda5 as /var all the files in that directory from your running will be over-mounted and effectively hidden away.
You need to take care to replicate the current content of /var to the new /dev/sda5 partition.
But you can also simply try if it works like you want to do it and then report back.

Re: how to auto mount ext4 partition ?

PostPosted: Dec 30th, '14, 23:45
by gerzal
when I removed # from that line I couldn't boot and I got this message :
Sorry, but there has been a problem starting your graphical display.

In order to debug your problem we will automatically switch to a text-based login screen from where you can login as the root user and run the "drakx11" utility to configure your graphical display.

and I go back to that line and put # again.
:(

Re: how to auto mount ext4 partition ?

PostPosted: Dec 31st, '14, 13:57
by doktor5000
You're missing at least /var/log and also /var/lock symlink on the new sda5 partition. Also /var/run on your new partition is a directory, whereas it should be a symlink to /run.
Hence my previous hint:

doktor5000 wrote:You currently have a running system where /var is on the / partition, and it already contains some files from your running system.
If you now mount /dev/sda5 as /var all the files in that directory from your running will be over-mounted and effectively hidden away.
You need to take care to replicate the current content of /var to the new /dev/sda5 partition.


This is what /var looks like here, from a clean Mageia 5 installation:
Code: Select all
┌─[doktor5000@Mageia5]─[12:49:22]─[~]
└──╼ ls -al /var
total 32
drwxr-xr-x 1 root root  148 Dec 21 16:40 ./
drwxr-xr-x 1 root root  176 Dec  6 19:50 ../
-rw-r--r-- 1 root root  163 Dec  6 19:15 .updated
drwxr-xr-x 1 root root  150 Dec 21 16:40 cache/
drwxr-xr-x 1 root root    8 Dec  6 19:18 db/
drwxr-xr-x 1 root root    0 Oct 31 19:47 empty/
drwxr-xr-x 1 root root    0 Oct 17 19:59 games/
drwxr-xr-x 1 root root  676 Dec 31 04:02 lib/
drwxr-xr-x 1 root root    0 Oct 31 19:47 local/
lrwxrwxrwx 1 root root   11 Oct 31 19:47 lock -> ../run/lock/
drwxr-xr-x 1 root root 1000 Dec 31 04:02 log/
lrwxrwxrwx 1 root root   10 Oct 31 19:47 mail -> spool/mail/
drwxr-xr-x 1 root root    0 Oct 31 19:47 nis/
drwxr-xr-x 1 root root    0 Oct 31 19:47 opt/
drwxr-xr-x 1 root root    0 Oct 31 19:47 preserve/
lrwxrwxrwx 1 root root    6 Oct 31 19:47 run -> ../run/
drwxr-xr-x 1 root root   94 Dec  6 22:03 spool/
drwxrwxrwt 1 root root 2082 Dec 30 22:15 tmp/
drwxr-xr-x 1 root root   22 Dec 21 16:40 www/
drwxr-xr-x 1 root root    0 Oct 31 19:47 yp/


You could so something like

Code: Select all
mount /dev/sda5 /mnt
rsync -av --dry-run --log-file=rsync.log /var /mnt

and see the rsync ouuput what it wants to copy to your new sda5 partition.