Creating the Store with LVM

Most of our Linux / CentOS installations work with LVM. This guide describes how to install the STORE role on a system using LVM.

Step 1 - Determining the current config

Display of discs
# Show free space
df -h
# Show partitions
fdisk -l
# Show partitions
ls /dev/sd*
# If the disk cannot yet be seen, re-scan the SCSI bus
echo "- - -" > /sys/class/scsi_host/host0/scan
# View physical volumes managed by LVM
lvm pvs
# Display logical volumes managed by LVM
lvm lvs
# Display logical volume groups managed by LVM
lvm vgs
# Where is what mounted
mount

The information above is now needed. The configuration should be checked, maybe an LVM is already planned for the storage.

Step 2 - Create a new partition

Here it is necessary to know where to find the additional space. There are 2 variants - either a new plate, or an extended plate. 

In both cases, a new partition is created. Here in this example, a new disk was used, which can be found on /dev/sdb

Adjust the commands below and the partition number (for an existing disk, the partition is then no longer necessarily 1) accordingly.

Anzeige von Discs

Partitioning with fdisk
fdisk /dev/sdb
 
# --> Edit the partitions on /dev/sda
 
n
# --> Create new partition
p
# --> New primary partition
1
# --> Create new partition 1 (view output at fdisk -1 above)
Enter
# --> Confirmation that the first available cylinder should be used
Enter
# --> Confirmation that the last available cylinder is to be used (gives the maximum size in total)
t
# --> Change partition type
8e
# --> Linux LVM
w
# --> When OK, write
 
reboot now


Step 3 - Inclusion in LVM - Create Device

Create device for LVM
# Here is the previous edition of /dev/sd* --> this is the new record (the 1st partition on /dev/sdb, i.e. the second hard disk, newly created partition)
lvm pvcreate /dev/sdb1

Step 4 - Create Volume Group

Create LVM
lvm vgcreate "vg_jtelshared" /dev/sdb1

Step 5 - Create Logical Volume

Create LVM
lvm lvcreate -l +100%FREE vg_jtelshared -n lv_jtelshared

Step 6 - Create File System

Create file system
mkfs.xfs -L data /dev/vg_jtelshared/lv_jtelshared


Step 7 - Prepare Mount Point

Prepare mount point
mkdir /srv/jtel
mkdir /srv/jtel/shared 
chown -R jtel:jtel /srv/jtel/shared

Step 8 - Set and mount the mount point in fstab

fstab entry:

vi /etc/fstab
vi /etc/fstab
...
(add the following line)
 
/dev/mapper/vg_jtelshared-lv_jtelshared /srv/jtel/shared        xfs     defaults 0   0

And mount:

mount
mount /srv/jtel/shared



Step 9 - Check interim result

Check final result
df -h

There should be an entry for /srv/jtel/shared with corresponding free space. 

Install Samba and lsof

Install SAMBA
yum -y install samba samba-client lsof

Configure Samba

Configure SAMBA
cat <<EOFF > /etc/samba/smb.conf
[global]
        workgroup = SAMBA
        security = user
        passdb backend = tdbsam
        printing = cups
        printcap name = cups
        load printers = yes
        cups options = raw
        min protocol = NT1
        ntlm auth = yes

[homes]
        comment = Home Directories
        valid users = %S, %D%w%S
        browseable = No
        read only = No
        inherit acls = Yes

[printers]
        comment = All Printers
        path = /var/tmp
        printable = Yes
        create mask = 0600
        browseable = No

[print$]
        comment = Printer Drivers
        path = /var/lib/samba/drivers
        write list = root
        create mask = 0664
        directory mask = 0775

[shared]
    comment = jtel ACD Shared Directory
    read only = no
    public = yes
    writable = yes
    locking = yes
    path = /srv/jtel/shared
    guest ok = yes
    create mask = 0644
    directory mask = 0755
    force user = jtel
    force group = jtel
    acl allow execute always = True

EOFF
sed -i -e "s/MYGROUP/WORKGROUP/g" /etc/samba/smb.conf

Setup SeLinux, jtel User access and Firewall for Samba

Replace <password> with the password for the jtel user:

SeLinux, jtel User, Firewall
setsebool -P samba_enable_home_dirs=on samba_export_all_rw=on use_samba_home_dirs=on use_nfs_home_dirs=on
printf '<password>\n<password>\n' | smbpasswd -a -s jtel
firewall-cmd --zone=public --add-port=445/tcp --add-port=139/tcp --add-port=138/udp --add-port=137/udp --permanent
firewall-cmd --reload

If necessary, add further users to samba - replacing password with the actual password for the user. Here, for example, the windows administrator user:

More SAMBA users
useradd -m Administrator
printf '<password>\n<password>\n' | smbpasswd -a -s Administrator

Test SAMBA

Start SAMBA
systemctl enable nmb
systemctl enable smb
systemctl start nmb
systemctl start smb

Manually link /home/jtel/shared

link /home/jtel/shared
ln -s /srv/jtel/shared /home/jtel/shared

Test the file mount

Test file mount
# From the windows machines:
 
dir \\acd-store\shared
  • No labels