Author Topic: How to automatically mount a xfs filesystem located on a different hard disk?  (Read 987 times)

0 Members and 1 Guest are viewing this topic.

Offline vindiou

  • Jr. Mitglied
  • **
  • Posts: 58
  • I studied Minix & Xinu in 1987-88!
  • Desktop: Latest KDE & Plasma
  • GPU Card: ATI Radeon HD 5450
  • GPU driver: free
  • Skill: Intermediate
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!

Offline jordan

  • Vollwertiges Mitglied
  • ***
  • Posts: 163
  • Skill: Advanced
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
Jordan @ Linux multi boot

Offline eugen-b

  • Support Team
  • ****
  • Posts: 3191
  • Branch: testing
  • Desktop: LXDE, Fluxbox, JWM, LXQt, bspwm
  • GPU Card: Intel 82945G/GZ
  • GPU driver: free
  • Kernel: 4.5, 4.6
  • Skill: Intermediate
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!
« Last Edit: 27. December 2015, 22:27:53 by eugen-b »
MSI Wind Nettop, Intel Atom 230 1.6GHz (64bit), 2GB RAM
DEs: NET-minimal + (LXDE / Fluxbox / JWM); LXQt OpenRC
how to install on btrfs subvolumes
http://manjaro.github.io/donate/

Offline vindiou

  • Jr. Mitglied
  • **
  • Posts: 58
  • I studied Minix & Xinu in 1987-88!
  • Desktop: Latest KDE & Plasma
  • GPU Card: ATI Radeon HD 5450
  • GPU driver: free
  • Skill: Intermediate
Thanks very much Jordan & Eugen!

BTW, why is it better to use UUID instead of /dev/... ?

Offline jonathon

  • Core Team
  • *****
  • Posts: 2104
  • Technologist - Teacher - Tea drinker
  • Branch: Unstable
  • Desktop: MATE 1.14
  • GPU Card: Nvidia GTX680M
  • GPU driver: Bumblebee nvidia+intel
  • Kernel: 4.6.0-*-MANJARO x86_64
  • Skill: Advanced
UUIDs only change when the partition is formatted. The device path (/dev/sd*) can change when you add and remove other disks.
--
MSI GT70: Core i7-3630QM, 16GB, Nvidia GTX680M, Intel 2230, Manjaro-MATE-amd64-EFI
Lenovo X230: Core i5-3320M, 4GB, Intel HD4000, Intel 6205, Manjaro-MATE-amd64
Dell Studio 1749: Core i5 540, 8GB, ATi HD5650, Intel WLAN, Manjaro-Xfce-amd64
Let's go in the garden; you'll find something waiting.

Offline eugen-b

  • Support Team
  • ****
  • Posts: 3191
  • Branch: testing
  • Desktop: LXDE, Fluxbox, JWM, LXQt, bspwm
  • GPU Card: Intel 82945G/GZ
  • GPU driver: free
  • Kernel: 4.5, 4.6
  • Skill: Intermediate
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.
MSI Wind Nettop, Intel Atom 230 1.6GHz (64bit), 2GB RAM
DEs: NET-minimal + (LXDE / Fluxbox / JWM); LXQt OpenRC
how to install on btrfs subvolumes
http://manjaro.github.io/donate/

Offline vindiou

  • Jr. Mitglied
  • **
  • Posts: 58
  • I studied Minix & Xinu in 1987-88!
  • Desktop: Latest KDE & Plasma
  • GPU Card: ATI Radeon HD 5450
  • GPU driver: free
  • Skill: Intermediate
Thanks!!

Offline jordan

  • Vollwertiges Mitglied
  • ***
  • Posts: 163
  • Skill: Advanced
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
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
Jordan @ Linux multi boot

Offline vindiou

  • Jr. Mitglied
  • **
  • Posts: 58
  • I studied Minix & Xinu in 1987-88!
  • Desktop: Latest KDE & Plasma
  • GPU Card: ATI Radeon HD 5450
  • GPU driver: free
  • Skill: Intermediate
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!


Offline jonathon

  • Core Team
  • *****
  • Posts: 2104
  • Technologist - Teacher - Tea drinker
  • Branch: Unstable
  • Desktop: MATE 1.14
  • GPU Card: Nvidia GTX680M
  • GPU driver: Bumblebee nvidia+intel
  • Kernel: 4.6.0-*-MANJARO x86_64
  • Skill: Advanced
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)
--
MSI GT70: Core i7-3630QM, 16GB, Nvidia GTX680M, Intel 2230, Manjaro-MATE-amd64-EFI
Lenovo X230: Core i5-3320M, 4GB, Intel HD4000, Intel 6205, Manjaro-MATE-amd64
Dell Studio 1749: Core i5 540, 8GB, ATi HD5650, Intel WLAN, Manjaro-Xfce-amd64
Let's go in the garden; you'll find something waiting.

Offline vindiou

  • Jr. Mitglied
  • **
  • Posts: 58
  • I studied Minix & Xinu in 1987-88!
  • Desktop: Latest KDE & Plasma
  • GPU Card: ATI Radeon HD 5450
  • GPU driver: free
  • Skill: Intermediate
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)"
« Last Edit: 16. March 2016, 13:06:38 by vindiou »

Offline scachemaille

  • Held Mitglied
  • *****
  • Posts: 528
  • I'm new. Be nice!
  • Branch: Unstable
  • Desktop: Plasma 5
  • GPU Card: nVidia GT 330M
  • GPU driver: Nouveau
  • Kernel: 4.8_x64
  • Skill: Intermediate
« Last Edit: 16. March 2016, 13:16:45 by scachemaille »

Offline vindiou

  • Jr. Mitglied
  • **
  • Posts: 58
  • I studied Minix & Xinu in 1987-88!
  • Desktop: Latest KDE & Plasma
  • GPU Card: ATI Radeon HD 5450
  • GPU driver: free
  • Skill: Intermediate
Thanks!! That worked perfectly!

Offline scachemaille

  • Held Mitglied
  • *****
  • Posts: 528
  • I'm new. Be nice!
  • Branch: Unstable
  • Desktop: Plasma 5
  • GPU Card: nVidia GT 330M
  • GPU driver: Nouveau
  • Kernel: 4.8_x64
  • Skill: Intermediate
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?

Offline vindiou

  • Jr. Mitglied
  • **
  • Posts: 58
  • I studied Minix & Xinu in 1987-88!
  • Desktop: Latest KDE & Plasma
  • GPU Card: ATI Radeon HD 5450
  • GPU driver: free
  • Skill: Intermediate
nope, just "nofail", but "x-systemd.device-timeout=#" may be useful in the future, thanks!