INFORMATICS

The Best

How to clear the YUM cache

Inicio desactivadoInicio desactivadoInicio desactivadoInicio desactivadoInicio desactivado

How to clear the YUM cache

What is yum?

The Yellowdog Updater, Modified (yum) is an open-source command-line package-management utility for Linux operating systems using the RPM Package Manager. Yum allows automatic updates, package and dependency management, on RPM-based distributions. Like the Advanced Packaging Tool (APT)

 

How to clear the yum cache:

When a package is downloaded, installed and is removed there is a chance that the package may still be saved/stored in the yum’s cache. So to clean all the cached packages from the enabled repository cache directory, login as root and execute the following:

#yum clean packages

To purge the old package headers information completely, execute the execute the command below:

#yum clean headers

To clean metadata for each enabled repository, execute the command below:

#yum clean metadata

If you wish to clean all the cached files from any enabled repository at once, execute the command:

#yum clean all

Mount an NTFS drive on CentOS 7

Inicio desactivadoInicio desactivadoInicio desactivadoInicio desactivadoInicio desactivado

Mount an NTFS drive on CentOS 7

NTFS-3G

 

NTFS-3G is a stable, open source, GPL licensed, POSIX, read/write NTFS driver for Linux. It provides safe handling of the Windows XP, Windows Server 2003, Windows 2000, Windows Vista, Windows Server 2008 and Windows 7 NTFS file systems.

 

NTFS-3G can create, remove, rename, move files, directories, hard links, and streams.


To mount an NTFS drive, start off by adding the remi-release and epel-release repos to your installation

Epel Repo: https://fedoraproject.org/wiki/EPEL
#yum install epel-release

Remi Repo: https://rpms.remirepo.net
wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm

 

How Do I Install NTFS-3G


Issue the following command to install

#yum install ntfs-3g
You also need the Fuse package but it’s usually pre-installed on CentOS, just verify if it’s installed or not

#yum install fuse

Load the module
#modprobe fuse
List the attached drives to find the NTFS drive to mount

#fdisk -l - show all drive

How Do I Find Out NTFS Partition Name?

Simply type the following command:
# fdisk -l /dev/sda
# fdisk -l /dev/sdb

How Do I Mount /dev/sda1 NTFS Partition at /mnt/ntfs?

First, load the fuse driver, enter:
# modprobe fuse
Create a mount point, enter:
# mkdir /mnt/ntfs
To mount the ntfs partition, enter:
# mount -t ntfs-3g /dev/sda1 /mnt/ntfs
You can use regular Unix commands to copy or access the files:
$ df -h
$ mount
$ cd /mnt/ntfs
$ cp foo /tmp

How Do I Unmount NTFS Partition?

Type the following command:
# umount /mnt/ntfs

How to Unzip zip files in CentOS using unzip Command

Inicio desactivadoInicio desactivadoInicio desactivadoInicio desactivadoInicio desactivado

How to Unzip zip files in CentOS using unzip Command

Install unzip command on CentOS 7

#yum install unzip

Unzip zip files in command line in CentOS

To unzip a zip folder, use the unzip command followed by the name of the zip file.

unzip file_for_unzip.zip

The unzip command in CentOS will unzip the zip file to the current working directory.

Unzip zip file to specific directory

With -d option we can specify the directory, which we want to extract files.

unzip -d /home/user/Documents file_for_unzip.zip

This time CentOS unzip command will extract the zip file to the /home/user/Documents directory.

How to monitor the hard disk status

Inicio desactivadoInicio desactivadoInicio desactivadoInicio desactivadoInicio desactivado

How to monitor the hard disk status

Checking if SMART is enabled

Find out the names of your hard disks by using one of the following commands:

df -h
fdisk -l

Let’s become familiar with the smartctl utility. The first thing we want to check is if S.M.A.R.T support is active on the device. To perform this operation we can run the smartctl utility with the -i option (short for --info):

$ sudo smartctl -i /dev/sda
The output of the command is the following:
smartctl 7.1 2020-04-05 r5049 [x86_64-linux-4.18.0-193.28.1.el8_2.x86_64] (local build) Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org === START OF INFORMATION SECTION === Vendor: LSILOGIC Product: Logical Volume Revision: 3000 User Capacity: 498 999 492 608 bytes [498 GB] Logical block size: 512 bytes Logical Unit id: 0x600508e0000000002bc75cd385bf0d0c Device type: disk Local Time is: Tue Oct 25 14:17:01 2022 CEST SMART support is: Unavailable - device lacks SMART capability.
We can see that basic information are displayed such as the device family, model, sector sizes, etc. What interests us the most, however is the content of the last two lines. From there we can see that the device has SMART capabilities and that, in this case, SMART support is disabled. What if we want to enable it? All we have to do is to run smartctl with the -s option, using “on” as argument:

smartctl 7.1 2020-04-05 r5049 [x86_64-linux-4.18.0-193.28.1.el8_2.x86_64] (local build) Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org =======> INVALID ARGUMENT TO -s: /dev/sda =======> VALID ARGUMENTS ARE: on, off, aam,[N|off], apm,[N|off], dsn,[on|off], lookahead,[on|off], security-freeze, standby,[N|off|now], wcache,[on|off], rcache,[on|off], wcreorder,[on|off[,p]], wcache-sct,[ata|on|off[,p]] <======= Use smartctl -h to get a usage summary Getting familiar with smartctl To get all the available SMART information about a storage device, we can launch the utility with the -a option (short for -all) and of course pass the path of the device we want to check as the last argument of the command. Suppose we want to check the current status of the /dev/sda device; we would run: $ sudo smartctl -a /dev/sda The command above produces a lot of output. Among the other things, we can see the status of various SMART parameters:

smartctl 7.1 2020-04-05 r5049 [x86_64-linux-4.18.0-193.28.1.el8_2.x86_64] (local build) Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org === START OF INFORMATION SECTION === Vendor: LSILOGIC Product: Logical Volume Revision: 3000 User Capacity: 498 999 492 608 bytes [498 GB] Logical block size: 512 bytes Logical Unit id: 0x600508e0000000002bc75cd385bf0d0c Device type: disk Local Time is: Tue Oct 25 14:19:37 2022 CEST SMART support is: Unavailable - device lacks SMART capability. === START OF READ SMART DATA SECTION === Current Drive Temperature: 0 C Drive Trip Temperature: 0 C Error Counter logging not supported Device does not support Self Test logging

RAID Commands

fdisk -l

lblsk

lshw -class disk - show all disk with information

smartctl --scan   - show all installed disks

smartctl -d sat -all /dev/sg1 

lspci |grep -i raid

lspci -vv | grep -i raid

cat /proc/scsi/scsi

 

# smartctl -a /dev/sda -d sat+megaraid,00
  • Show all physical disks on controller 0

    $ omreport storage pdisk controller=0
    
  • Show all logical disks on controller 0

    $ omreport storage vdisk controller=0
    
  • Show all physical disks on vdisk 0

    $ omreport storage pdisk controller=0 vdisk=0
    
  • Reconfigure a vdisk to be raid1 from raid0 (COOL!!!!)

    $ sudo omconfig storage vdisk action=reconfigure controller=0 vdisk=1 raid=r1 pdisk=0:0:2,0:0:3
  • omreport storage pdisk controller=0 vdisk=0 | grep -v ": Not "
     

Search