19 systemd exercise emergency mode filesystem create and mount partprobe fstab



mount -o remount,rw /
rm /etc/crypttab
vim /etc/fstab #remove crypttab
==================================
create and mount new filesystem

1) fdisk /dev/sdb
n
w

2)partprobe
partprobe is a program that informs the operating system kernel of partition table changes, by requesting that the operating system re-read the partition table. For instance, if you create a new partition on one of your disks using parted, you should run partprobe afterwards to make the kernel aware of the new partition configuration.


3)mkfs.xfs /dev/sdb1

4)mount /dev/sdb1 /sdbmountfolder

5)fstab
# /etc/fstab
# Created by anaconda on Sat Sep  9 22:05:18 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-root     /                       xfs     defaults        0 0
UUID=64f8607e-7764-4841-bd8b-3196bbea8223 /boot                   xfs     defaults        0 0
/dev/mapper/cl-swap     swap                    swap    defaults        0 0
/dev/sdb2 /sdbmount xfs defaults 0 0
=======================
second option with mounting - systemd
1) fdisk /dev/sdb
n
w

[root@localhost system]# vim test.mount
[root@localhost system]# mkfs.xfs /dev/sdb3
meta-data=/dev/sdb3              isize=512    agcount=4, agsize=6400 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=25600, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=855, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@localhost system]# mkdir /sdb3mount
[root@localhost system]# cat test.mount 
[Unit]
Description = test mount

[Mount]
What = /dev/sdb3
Where = /sdb3mount
Type = xfs

[Install]
WantedBy = multi-user.target
[root@localhost system]# systemctl start test.mount
Failed to start test.mount: Unit is not loaded properly: Invalid argument.
See system logs and 'systemctl status test.mount' for details.
[root@localhost system]# systemctl status test.mount
● test.mount - test mount
   Loaded: error (Reason: Invalid argument)
   Active: inactive (dead)
    Where: /sdb3mount
     What: /dev/sdb3

Sep 17 11:04:34 localhost.localdomain systemd[1]: test.mount's Where= setting doesn....
Sep 17 11:04:45 localhost.localdomain systemd[1]: test.mount's Where= setting doesn....
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost system]# vim test.mount 
[root@localhost system]# ls /
1    boot  etc   lib    lvdisk  mnt  proc  run   sdb3mount  srv  tmp  var
bin  dev   home  lib64  media   opt  root  sbin  sdbmount   sys  usr
[root@localhost system]# mkdir /test
[root@localhost system]# vim test.mount 
[root@localhost system]# systemctl start test.mount
[root@localhost system]# systemctl enable test.mount
Created symlink from /etc/systemd/system/multi-user.target.wants/test.mount to /etc/systemd/system/test.mount.
[root@localhost system]# systemctl status test.mount
● test.mount - test mount
   Loaded: loaded (/etc/systemd/system/test.mount; enabled; vendor preset: disabled)
   Active: active (mounted) since Sun 2017-09-17 11:05:57 EDT; 17s ago
    Where: /test
     What: /dev/sdb3

Sep 17 11:05:57 localhost.localdomain systemd[1]: Mounting test mount...
Sep 17 11:05:57 localhost.localdomain systemd[1]: Mounted test mount.
[root@localhost system]#

Comments

Popular posts from this blog

HAproxy logging

tomcat catalina coyote jasper cluster

NFS mount add in fstab _netdev instead of default | firewall-cmd --list-all