Create and Configure File Systems Flashcards

1
Q

to create a file system

A
use mkfs(may ways to use it depending on the file system type, ie)
# mkfs -t ext4 /dev/sdb1
# mkfs.ext4 /dev/sdb1
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

tune2fs

A

helps us control how many times a filesystem can be mounted before a filesystem check needs to run on it.

Command to run after you've formatted a partition
#tune2fs -m0 /dev/sdb1
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

check info on a filesystem

A

tune2fs -l /dev/sdb1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

check a filesystem

A

fsck /dev/sdb1 do not run on a mounted filesystem

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

to create an xfs filesystem

A

mkfs.xfs /dev/sdb2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

to create a vfat filesystem

A

mkfs.vfat /dev/sdb3

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

To get details about a file system type

A

dumpe2fs /dev/sdb2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

to repair an unmounted filesystem consistency (xfs filesystem)

A

xfs_repair /dev/sdb2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

to get details about a mount xfs filesystem

A

xfs_info /dev/sdb2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

to repair an unmounted vfat filesystem

A

fsck.vfat /dev/sdb3

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

steps to mount a filesystem

A
1 - create a directory
#mkdir /mnt/data
2. mount the filesystem
# mount -t ext4 /dev/sdb1 /mnt/data
3. check that it's mounted
# mount | grep data
4. add entry to /etc/fstab to mount after reboot(permanent)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What’s needed to mount an NFS(network file system) filesystem

A
First you need to install
# yum -y install nfs-utils nfs-utils-lib
Then you need to start the right services
# service nfs start
# service rpcbind start
Afterward add them to start at boot
# chkconfig nfs on
#chkconfig --level 35 rpcbind on
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

show which nfs filesystem is available on a system

A

showmount -e [ip or hostname]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

mount nfs to a local directory

A
# mkdir /mnt/nfs
# mount -t nfs ip:/srv/nfs /mnt/nfs   you could also put hostname instead of ip
For permanent entry add to /etc/fstab
name:/srv/nfs    /mnt/nfs    nfs   _netdev    0 0
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

for nfs use _netdev instead of defaults

A

It tells the mount command to wait for the network services to come up prior to mounting the share(to prevent hanging)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

for CIFS network file system (common Internet File System)

A
Install the samba client packages
#yum install -y cifs-utils
# yum install -y samba-client
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Cifs permanent mounting

A

//smbserver/shared /mnt cifs rw,user,credentials=/root/secret.txt 0 0

in /root/secret.txt add
username=visitor
password=Welcome123$

18
Q

to see which shares are available on a cifs server

A

smbclient -U username -L [hostname/IP]

19
Q

To login to the remote cifs share

A

smbclient -U username //ip/shared

20
Q

You can run windows command when you’ve logged into a cifs shared

A

smb: > get filename.txt download a file
smb: > put file1.txt upload a file

21
Q

To mount a cifs share(temporarily)

A

mount -t cifs -o user-[username] //IP-or-host/shared /mnt/shared
review man mount.cifs
You can also do it from the desktop
Go to Places -> connect to server
Change the service type to window share, enter info, then click connect

22
Q

To increase the size of a logical volue

A

use the lvextend command. When you extend the logical volume, yo ucan indicate how much to extend the volume, or how large you want it to be after you extend it.

23
Q

The following command extends the logical volume /dev/myvg/homevol to 12GB

A

lvextend -L 12G /dev/myvg/homevol

24
Q

The following command adds another gigabyte to the logical volume

A

lvextend -L +1G /dev/myvg/homevol

25
Q

The following command extends the logical volume called testlv to fill all of the unallocated space in the volume group myvg

A

lvextend -l +100% Free /dev/myvg/testlv

26
Q

adding a filesystem on a logical volume

A
#mkfs.ext4 /dev/vg_new/lv_new
#mkdir /extra   directory to mount logical volume
add entry to /etc/fstab
/dev/vg_new/lv_new  /extra  ext4   defaults  0 0
# mount -a
27
Q

To grow the logival volume lvresize can also be used

A
#lvresize -L 900M /dev/vg_new/lv_new
Then resize the filesystem
# resize2fs /dev/vg_new/lv_new
28
Q

To shrink the logical volume(make sure to have a backup)

A
#unmount extra
#fsck -f /dev/vg_new/lv_new
#resize2fs /dev/vg_new/lv_new 800MB
#lvresize -L 800MB /dev/vg_new/lv_new
29
Q

Set-GID

A

set-gid directories are used for group collaboration. Everything that is created in a directory with that special permission bit, is automatically owned by the group

30
Q

how to apply the set-git permission

A

applying the set-git permission on a directory by add a 2 before the standard permission set
# chmod 2755 share
-Then you’ll see the directory has a permission set that contains a ‘s’ now in place of the x for group
-the character based way to setup a set-gid directory
#chmod g+s share

31
Q

ACL(Access Control Lists)

A
  • to use AACLs first the acl property needs to be enabled on the partition. run the mount command to check
    # mount
  • to change and turn on ACL make changes in /etc/fstab
    before
    /dev/mapper/vg_rhel01/lv_root / ext4 defaults 1 1
    after
    /dev/mapper/vg_rhel01/lv_root / ext4 defaults,acl 1 1
    Then you need to remount or restart
    to remount
    # mount -o remount /
    Without adding entry to fstab(this isn’t permanent)
    # mount -o remount -o acl /dev/…
32
Q

to check acl on a directory or file

A
use the getfacl command
#getfacl file
33
Q

to add user acl to a file or directory

A

setfacl -m u:user2:rw install.log m = modify

34
Q

to add a group acl on a file

A

setfacl -m g:IT:rwx install.log

35
Q

to remove all acls on a file

A

setfacl -b file1 -b for remove all

36
Q

Note pay attention to “other” users in regard to ACL

A
#setfacl -m o:rwx file1   gives rwx to other, but you cannot use -x or -b to remobe such a change. The only way to remove this acl is either the follwoing command:
#setfacl -m o:www file1
or
#chmod o-rwx file1
37
Q

to remove permissions allowed to the user bob(-x for remove)

A

setfacl -x u:bob file1

38
Q

Apply ACL recursively

A

setfacl -R -m u:user1:rwx file1

39
Q

The following command cancels ACL settings for a user recursively

A

setfacl -R -x u:user1 file1

40
Q

The mask in regard to ACL

A
The mask associated with ACL limits the permission available on a file. In other words, with a mask of --r, you can try all other privileges, but all that can be set with that mask is read privileges. The command to set the mask:
#setfacl -m mask:r-- acltest.txt
41
Q

To set a default ACL

A
Add d: before the rule and specify a directory instead of a filename
#setfacl -m d:o:rx /share
42
Q

Man in regard to ACL

A
review these man pages
#man acl
#man getfacl
#man setfacl
#man star   the star utility