Linux Challenge 1

how to install lvm2 module ??
sudo apt-get install lvm2 is not recognized

Hi @xedosbomb ,
Please check our solutions here

1 Like

Hi @xedosbomb

The issue is apt-get. That is the package manager for Ubuntu. These challenges run on CentOS, where the package manager is yum

1 Like

Thank you for the clarification

Hello KK Team!

Afraid I’ve found a problem. The exercise request [Ensure that the mountpoint “/mnt/dba_storage” has the group ownership set to the “dba_users” group]. and immediately after create the directory I’ve set the ownership of the group of the directory, however, after mount the permission is changed to root.

After mount and the ownership goes to root, I can issue the command again [chown :dba_users /mnt/dba_storage], and the exercise validation will mark as correct. But. in a real situation when I restart the system, the mounting ownership will revert back to root.

Is there a solution for that, or I really get it wrong? :slight_smile:

Thank you all.

Regards,
Raul.

PS: Same goes to the permissions, after mount it get changed, and in a runtime we can change it back to the request of the lab. But after reboot, “kapuft” = (

Hi @raul.souza

It should mount back correctly if it was rebooted. Let’s simulate what happens by unmounting then remounting the volume:

[root@centos-host ~]# ls -l /mnt
total 0
drwxrwx---. 2 root dba_users 6 Sep 18 19:57 dba_storage
[root@centos-host ~]# umount /mnt/dba_storage 
[root@centos-host ~]# ls -l /mnt
total 0
drwxr-xr-x. 2 root root 6 Sep 18 19:57 dba_storage
[root@centos-host ~]# mount -t xfs /dev/dba_storage/volume_1 /mnt/dba_storage
[root@centos-host ~]# ls -l /mnt
total 0
drwxrwx---. 2 root dba_users 6 Sep 18 19:57 dba_storage
[root@centos-host ~]# 

Hi @Alistair_KodeKloud , thank you very much, always nice to get your replies.

I’ve seen in your simulation that the directory become root “property” after the [umount] command. This made me a little more confusing, therefor went to make my simulation :slight_smile:

.
.
1a) Ensure that the mountpoint “/mnt/dba_storage” has the group ownership set to the “dba_users” group.
– Here I’ve set the ownership of the mount point.

1b) Ensure that the mount point “/mnt/dba_storage” has “read/write” and execute permissions for the owner and group and no permissions for anyone else.

[bob@centos-host ~]$ ll /mnt/
total 0
drwxrwx---. 2 root dba_users 6 Sep 19 19:48 dba_storage

.
.

2a) Format the lvm volume “volume_1” as an “XFS” filesystem. :white_check_mark:

2b) Mount the filesystem at the path “/mnt/dba_storage”.

[bob@centos-host ~]$ sudo mount -t xfs /dev/mapper/dba_storage-volume_1 /mnt/dba_storage/
[bob@centos-host ~]$ ll /mnt/
total 0
drwxr-xr-x. 2 root root 6 Sep 19 19:42 dba_storage

at this moment the validation of the step [ group-permissions ] complain that permissions are not set.

So if I do [ umount ], everything get back to the expected and the step [ group-permissions ] is going to pass the validation only when I set the permissions [after] the mounting.

[bob@centos-host ~]$ sudo umount /mnt/dba_storage 
[bob@centos-host ~]$ ll /mnt/
total 0
drwxrwx---. 2 root dba_users 6 Sep 19 19:48 dba_storage

2c) Make sure that this mount point is persistent across reboots with the correct default options.
– For this point I’ve added the line bellow into the [ /etc/fstab ],

/dev/mapper/dba_storage-volume_1 /mnt/dba_storage xfs defaults,gid=1003 0 0

issued the command to mount everything from the file, and got the error below; understood from this error that [ gid ] is not a valid flag for xfs options (but am not sure)

[bob@centos-host ~]$ sudo mount -a
mount: /mnt/dba_storage: wrong fs type, bad option, bad superblock on /dev/mapper/dba_storage-volume_1, missing codepage or helper program, or other error.

so I’ve removed the [gid=1003] option and could mount it.

[/etc/fstab]: /dev/mapper/dba_storage-volume_1 /mnt/dba_storage xfs defaults 0 0
[bob@centos-host ~]$ sudo mount -a
[bob@centos-host ~]$ mount |grep /dev/mapper/dba_storage-volume_1
/dev/mapper/dba_storage-volume_1 on /mnt/dba_storage type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota)

but, again, with the superuser ownership.

[bob@centos-host ~]$ ll /mnt/
total 0
drwxr-xr-x. 2 root root 6 Sep 19 19:42 dba_storage

Could you please, give us your thoughts?

Thank you very much!
Raul.

If I’m reading you correctly, you have assigned the permissions to the mount point before you mounted the volume. The content of the volume initially belongs to root.

You need to assign the permissions to the mounted volume, so they are assigned to the volume itself and not the empty mount point.

Hence

  • Before mounting - /mnt/dba_storage belongs to root
  • Mount the volume and set the permissions now
  • Unmount the volume - empty mount point goes back to root
  • Remount the volume - permissions are restored… because they’re stored in the volume itself.

Hi @Alistair_KodeKloud,

I went to check, forgive me such delay. And YES, that is pretty much correct, after umount and mount again, the ownership was charmingly kept.

huge THANK YOU, for your time and attention in this subject. :grinning:

[root@centos-host bob]# mount |grep /mnt/dba_storage
/dev/mapper/dba_storage-volume_1 on /mnt/dba_storage type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota)

[root@centos-host bob]# ll /mnt/
total 0
drwxrwx---. 2 root dba_users 6 Sep 27 19:41 dba_storage

[root@centos-host bob]# umount /mnt/dba_storage 

[root@centos-host bob]# ll /mnt/
total 0
drwxr-xr-x. 2 root root 6 Sep 27 19:42 dba_storage

[root@centos-host bob]# mount -a

[root@centos-host bob]# mount |grep /mnt/dba_storage
/dev/mapper/dba_storage-volume_1 on /mnt/dba_storage type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota)

[root@centos-host bob]# ll /mnt/
total 0
drwxrwx---. 2 root dba_users 6 Sep 27 19:41 dba_storage

You’re welcome

Happy learning!

Hello,

The following solution is not accepted

$ blkid | grep dba_storage
/dev/mapper/dba_storage-volume_1: UUID="dc1e1a37-c207-4349-bcb3-bf049cd2bfbd" BLOCK_SIZE="512" TYPE="xfs"

$ cat /etc/fstab | grep dba_storage
UUID="dc1e1a37-c207-4349-bcb3-bf049cd2bfbd" /mnt/dba_storage/ xfs     defaults        0 0

why you don’t accept UUID in fstab ?