Manjaro Linux Forum

Technical Issues and Assistance => Newbie Corner => Topic started by: vindiou on 27. December 2015, 21:30:50

Title: How to automatically mount a xfs filesystem located on a different hard disk?
Post by: vindiou on 27. December 2015, 21:30:50
Hi,

I want to automatically mount a xfs filesystem located on a different hard disk than the one I'm currently using.

I know how to do it "manually": I click on Dolphin, then click on the hard disk (on the left) and Dolphin mounts the filesystem.

Now if I type "mount", I have:

/dev/sdc5 on /run/media/user-me/cf8321f4-e25f-4c13-a68a-3817d9cf87ce type xfs (rw,nosuid,nodev,relatime,attr2,inode64,noquota,uhelper=udisks2)

I don't know how to mount it automatically at boot.

I have tried to add lines to my /etc/fstab but it doesn't work.

What is the correct syntax?
Should I add a line to my /etc/fstab ?

Thanks!
Title: Re: How to automatically mount a xfs filesystem located on a different hard disk?
Post by: jordan on 27. December 2015, 21:46:36
Hi!
After having mounted your xfs partition
Comparing /etc/mtab, mount and proc/mounts
e.g.
Code: [Select]
cat /etc/mtaband as admin
blkid
you' ll see what you have to add in your /etc/fstab
Title: Re: How to automatically mount a xfs filesystem located on a different hard disk?
Post by: eugen-b on 27. December 2015, 22:07:02
Why not using a search engine with 'xfs mount fstab'? There are many decent results. Try to find out which options would suit your case.
My advise would be only to use UUID insted of /dev/sdb3 or sth.
This seems to be the most comprehensive source https://www-01.ibm.com/support/knowledgecenter/SSNW54_1.1.0/com.ibm.kvm.v110.admin/XFSfilesystem.htm

An option set that worked on Arch (two years ago)
Code: [Select]
# /dev/sdb1
UUID=375eac75-e460-4453-9b00-c87cc3b0496e    /             xfs           rw,relatime,attr2,inode64,noquota    0 1
# /dev/sdb2
UUID=19883531-aee5-4f2d-a152-8f8bbbd82261    /home         xfs           rw,relatime,attr2,inode64,noquota,noauto,x-systemd.automount    0 1
https://bbs.archlinux.org/viewtopic.php?id=174209

Don't simply copy, use your own UUIDs! Even an intemediate user might forget, no offence!
Title: Re: How to automatically mount a xfs filesystem located on a different hard disk?
Post by: vindiou on 27. December 2015, 22:40:44
Thanks very much Jordan & Eugen!

BTW, why is it better to use UUID instead of /dev/... ?
Title: Re: How to automatically mount a xfs filesystem located on a different hard disk?
Post by: jonathon on 27. December 2015, 22:57:44
UUIDs only change when the partition is formatted. The device path (/dev/sd*) can change when you add and remove other disks.
Title: Re: How to automatically mount a xfs filesystem located on a different hard disk?
Post by: eugen-b on 27. December 2015, 23:28:37
For example, you have two SATA ports 1 and 2 and two drives. SATA1 will be assigned sda, SATA2 - sdb. If you use sda and sdb variables in the fstab and some day decide to switch the SATA cables you will find that your Linux (I didn't try this with other OS) will not go very far past Grub menu. If you used UUID in fstab, then you can switch the cables as you wish.
Title: Re: How to automatically mount a xfs filesystem located on a different hard disk?
Post by: vindiou on 27. December 2015, 23:38:54
Thanks!!
Title: Re: How to automatically mount a xfs filesystem located on a different hard disk?
Post by: jordan on 28. December 2015, 11:11:11
Hi!
Late, but yesterday I did not have enough time and because the questions was unanswered, I thought a short answer is better than no answer.
URLs for basic Info:
https://en.wikipedia.org/wiki/Fstab (https://en.wikipedia.org/wiki/Fstab)
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/filesystems/xfs.txt?id=HEAD (http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/filesystems/xfs.txt?id=HEAD)
To edit your file with your KDE editor kate or kwrite:
Code: [Select]
kdesu kwrite /etc/fstab
Code: [Select]
sudo blkid -> UUID,
Code: [Select]
mount-> mount point and possible options
options in fstab: depends on your system (32 or 64 bit, hd or SSD,...) and your wishes
dump 0 and pass 0
Title: Re: How to automatically mount a xfs filesystem located on a different hard disk?
Post by: vindiou on 16. March 2016, 12:38:10
Ok, I now have my xfs filesystem (located on a different hard disk #2) that automatically mounts, good :

Code: [Select]
/etc/fstab
UUID=cf8371f4-e43f-4c13-a68a-3817d9cf86ce   /mnt2    xfs     rw,nosuid,nodev,relatime,attr2,inode64,noquota 0 0

I have a new problem:

If I remove this hard disk #2 OR if it fails for whatever reason OR if the filesystem changed, then Manjaro hangs at boot!

How can I still login in Manjaro in such a situation?

Thanks!

Title: Re: How to automatically mount a xfs filesystem located on a different hard disk?
Post by: jonathon on 16. March 2016, 12:40:22
You would need to remove (or comment out, or change) the line in your fstab - otherwise it will hang while trying to mount the disk that's not there.

(Aside: you should check what the XFS mount defaults are - 'relatime' at least is default)
Title: Re: How to automatically mount a xfs filesystem located on a different hard disk?
Post by: vindiou on 16. March 2016, 13:05:02
Sorry but I can't believe that there's no solution to prevent being stuck at boot!

In such a situation, wouldn't it be cool to get a message such as :

"Manjaro is currently unable to mount filesystem "/mnt2" (or whatever message)
 Do you want to Continue to boot / mount it Manually / Shutdown? (type C, M or S)"
Title: Re: How to automatically mount a xfs filesystem located on a different hard disk?
Post by: scachemaille on 16. March 2016, 13:10:15
Hello..
Check about the nofail fstab option
And have a look here
https://wiki.archlinux.org/index.php/fstab (https://wiki.archlinux.org/index.php/fstab)
https://bbs.archlinux.org/viewtopic.php?id=115262 (https://bbs.archlinux.org/viewtopic.php?id=115262)
Title: Re: How to automatically mount a xfs filesystem located on a different hard disk?
Post by: vindiou on 16. March 2016, 13:22:52
Thanks!! That worked perfectly!
Title: Re: How to automatically mount a xfs filesystem located on a different hard disk?
Post by: scachemaille on 16. March 2016, 13:27:04
Thanks!! That worked perfectly!
did you use x-systemd.device-timeout to change the default timeout in case the disk is not present to avoid to slow down your boot?
Title: Re: How to automatically mount a xfs filesystem located on a different hard disk?
Post by: vindiou on 16. March 2016, 13:32:53
nope, just "nofail", but "x-systemd.device-timeout=#" may be useful in the future, thanks!