Systemd & fstab

General support questions
Post Reply
jeffdvo
Posts: 30
Joined: 2015/01/19 21:06:40

Systemd & fstab

Post by jeffdvo » 2018/09/17 15:10:43

Hopefully some kind soul(s) can help me with this.

Long story cut short (been playing with this for nearly 2 weeks), lost power to the (home) server which hasn't been rebooted for nearly a year. On restarting it went in to emergency mode. I entered admin password and had a look what was happening, df produced unexpected results in that it didn't tally with /mnt. I edited fstab to comment out the 2 data drives and USB drive and it rebooted normally. Adding back each drive in turn and rebooting seemed to cure the problem until I added the USB drive, then I got emergency mode again. Disabled in fstab and physically removed, Installed Centos on a spare laptop (with Gnome) and plugged in the USB drive. It worked perfectly, all data seemed to be intact and fsck -f found no problems. Further checking on server, it appeared that the /dev/mounts(?) had got mixed up and the boot drive was using sdc1 which was the USB drive. I re-imaged using an image i'd done a few days before (Mondoarchive) but it didn't sort the problems :-(

found an article (www) thegeekdiary.com/centos-rhel-7-how-to-follow-the-mount-order-in-etcfstab/ and blog.fpmurphy.com/2014/04/system-d-and-etcfstab.html both articles suggest that /etc/fstab is now redundant and that the contents of fstab need to be "copied" in to "/etc/systemd/system/" but I'm not sure what I need to do! I have 4 physical HDDs, one is the Boot/system drive and I have 2 x 1TB internal data drives and a 2TB USB drive(all using ext4)

current fstab

#
# /etc/fstab
# Created by anaconda on Thu Apr 13 15:29:44 2017
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/cl_dvofps-root / xfs defaults 0 0
UUID=5f510094-4886-4655-bbe3-26c7d74c3f2f /boot xfs defaults 0 0
/dev/mapper/cl_dvofps-swap swap swap defaults 0 0
/dev/cl_dvofps/home /home xfs attr2,inode64,relatime,noquota 0 0
#/dev/sda1 /mnt/main ext4 defaults 0 0
#/dev/sdb1 /mnt/main02 ext4 defaults 0 0
#/dev/sdc1 /mnt/usbback ext4 defaults 0 0

Do I need to make 4 separate files for each drive (/etc/systemd/system) or can I do one file to include all the drives? I've read the systemd manual but am now even more confused :-(

My knowledge of Linux isn't great, I know enough to break things :-) I stumble through by using Webmin, Putty and WinSCP from my Windows box.

Cheers

Jeff

stevemowbray
Posts: 519
Joined: 2012/06/26 14:20:47

Re: Systemd & fstab

Post by stevemowbray » 2018/09/17 15:19:14

Just use fstab, but use labels or UUIDs to mount the drives, not devices.

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Systemd & fstab

Post by TrevorH » 2018/09/17 15:22:42

Run blkid to get the UUIDs from all devices and find the ones you are interested in and use those instead of device names.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

MartinR
Posts: 714
Joined: 2015/05/11 07:53:27
Location: UK

Re: Systemd & fstab

Post by MartinR » 2018/09/17 15:34:48

From man blkid
It is recommended to use lsblk(8) command to get information about block devices, or lsblk --fs to get an overview of filesystems, or findmnt(8) to search in already mounted filesystems.
For example:

Code: Select all

# lsblk --fs
NAME           FSTYPE      LABEL         UUID                                   MOUNTPOINT
sda                                                                             
├─sda1         ext4        Boot          xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
├─sda2         ext4        Root2         xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx   
├─sda3         ext4        Root3         xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx   /
└─sda4         LVM2_member               xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
  ├─YYYYY-Swap swap        Swap          xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx   [SWAP]
  ├─YYYYY-Var  ext4        Var           xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx   /var
  └─YYYYY-Home ext4        Home          xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx   /home
... etc

jeffdvo
Posts: 30
Joined: 2015/01/19 21:06:40

Re: Systemd & fstab

Post by jeffdvo » 2018/09/17 18:14:30

Gents,

THANK YOU, very helpful. I've mounted the 2 data drives using the UUID and everything is working fine. I won't worry about the systemd/system thing :-)

Next job, getting the new UPS to talk to Centos :-)

Jeff

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Systemd & fstab

Post by TrevorH » 2018/09/17 20:17:54

For APC UPSes, apcupsd is in the EPEL repo. For others you probably want nut.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

jeffdvo
Posts: 30
Joined: 2015/01/19 21:06:40

Re: Systemd & fstab

Post by jeffdvo » 2018/09/17 23:05:28

Thanks Trevor. apcupsd didn't work but NUTS did (after a reboot.) My UPS is a Salicru SPS 700 One, I tried the Blazer_USB driver and that didn't work but the nuts generic one did. I can sleep tonight :-)

Cheers

Jeff

Post Reply