Mount NTFS partitions on Linux

After connecting the disk to the server, let’s see a list of all the disks and find the name of the desired one:

sudo fdisk -l

I’ll give an example of mounting NTFS partition of a disk in Ubuntu (since I had a disk partitioned into two partitions, drive C and D, then they were found in the system as /dev/sdb1 and /dev/sdb2, both mounted to the created directories):

sudo mkdir /newhdd1
sudo mount -t ntfs /dev/sdb1 /newhdd1
sudo mkdir /newhdd2
sudo mount -t ntfs /dev/sdb2 /newhdd2

Since before this disk was used in the Windows system, I had a mount error:

The disk contains an unclean file system (0, 0).
Metadata kept in Windows cache, refused to mount.
Failed to mount ‘/dev/sdb1’: The operation is not allowed
The NTFS partition is in an unsafe state. Please resume and shutdown
Windows fully (no hibernation or fast restarting), or mount the volume
read-only with the ‘ro’ mount option.

In this case, you can mount the partition in read-only mode:

sudo mount -t ntfs -o ro /dev/sdb1 /newhdd1

Either fix the partitions with the command:

sudo ntfsfix /dev/sdb1
sudo ntfsfix /dev/sdb2

And after that, mount with full access:

sudo mount -t ntfs /dev/sdb1 /newhdd1
sudo mount -t ntfs /dev/sdb2 /newhdd2

You can unmount it like this:

sudo umount -t ntfs /dev/sdb1 /newhdd1
sudo umount -t ntfs /dev/sdb2 /newhdd2

See also:
Managing disk partitions in Ubuntu using fdisk

Managing disk partitions in Ubuntu using fdisk

Let’s review the existing disks:

sudo fdisk -l | grep '/dev/sd'

We display the fdisk menu for further work, for example with the disk /dev/sda:

sudo fdisk /dev/sda

Help can be obtained by pressing the “m” key, exit without saving the changes with the “q” key.

Before mounting, you must create any empty directory:

sudo mkdir /mnt/disk

For example, I connected an external HDD drive for backup copies and mounted with the following command:

sudo mkdir /backup_flows
sudo mount -t auto /dev/sdb1 /backup_flows

The /etc/fstab file contains information about all the partitions mounted at boot:

sudo nano /etc/fstab

To learn the UUID of partitions, you can use the command:

sudo blkid

You can format the command with:

sudo mkfs.ext4 /dev/sdb1

The table of the file system can be seen by the command:

df -h

See also:
Mount NTFS partitions on Linux

Adding a disk to LVM

Suppose we have already configured LVM, for example, as I described in this article – Setting up and using LVM

Switch to the root user:

sudo su

If there is no hot-swap drive, turn off the server, connect a new disk, turn on the server and look at the name of the new disk (in my case it’s /dev/sdd):

fdisk -l

Let’s see the existing groups and how much space is left:

vgdisplay

Let’s see a list of physical volumes:

pvdisplay

Let’s start marking a new disk:

fdisk /dev/sdd
n
p
1
Enter
Enter
t
8e
w

Now create a physical volume:

pvcreate /dev/sdd1

Let’s see a list of logical volumes:

lvdisplay

We extend it by adding a new partition (where ixnfo is a volume group):

vgextend ixnfo /dev/sdd1

See the list of physical volumes as follows:

pvscan

Let’s look at the path of the logical volume (in my case /dev/ixnfo/temp) and add a new section:

lvextend /dev/ixnfo/temp /dev/sdd1

Let’s see the size of the mounted logical volume:

df -h

So the size did not change, we’ll fix it with the command:

resize2fs /dev/ixnfo/temp

Done.

Setting up and using LVM

LVM (Logical Volume Management) allows you to compile multiple disks and areas from disks into one logical volume and then split again as you like.

PV (Physical Volume) — partition or whole disk
VG (Volume Group) — a single disk assembled from physical volumes
LV (Logical Volume)

Switch to the root user:

sudo -i

Install LVM if it is not already installed (Ubuntu/Debian):

apt-get install lvm2

Let’s look at the information about the disks:

fdisk -l

On the test I have /dev/sda with the system and not marked /dev/sdb.

Let’s make the physical partition all /dev/sdb without partitioning:

pvcreate /dev/sdb

To view the list of physical volumes, use the command:

pvdisplay

Create a volume group named ixnfo:

vgcreate ixnfo /dev/sdb

If necessary, delete as follows:

vgremove ixnfo

Example of viewing existing groups and how much space is left:

vgdisplay

For the test, create a logical volume “temp” of 100 megabytes:

lvcreate -L100 -n temp ixnfo

To view the list of logical volumes, use the command:

lvdisplay

Let’s format it:

mkfs.ext4 -L temp /dev/ixnfo/temp

Create a folder, mount the created volume:

mkdir /mnt/temp
mount /dev/ixnfo/temp /mnt/temp

You can unmount it like this:

umount /mnt/temp/

See also:
Adding a disk to LVM
Managing disk partitions in Ubuntu using fdisk

Installing Zurmo on Linux

On the test I will install Zurmo in Ubuntu Server 16.04 and PHP 7.

1) First, let’s see the requirements http://zurmo.org/wiki/installation-requirements
Establish the necessary:

sudo apt-get install apache2 mysql-server mysql-client wget unzip php php-mysql php-cli php-gd php-common php-curl php-dev php-pear php-imap libapache2-mod-php php-mcrypt php-memcache php-memcached memcached php-soap php-mbstring

Open the PHP configuration file in a text editor:

sudo nano /etc/php/7.0/apache2/php.ini

And let’s specify some parameters:

date.timezone = Europe/Kiev
post_max_size = 32M
upload_max_filesize = 32M
zend.assertions = 0

Restart apache2 to apply the changes:

sudo service apache2 restart

2) Connect to mysql, create an empty database and the user:

mysql -u root -p
CREATE DATABASE zurmo;
CREATE USER 'zurmo'@'localhost' IDENTIFIED BY 'PASSWORD';
GRANT ALL PRIVILEGES ON `zurmo`.* TO 'zurmo'@'localhost';
FLUSH PRIVILEGES;
QUIT;

3) Download the latest version from the official site http://zurmo.org/download
You can copy the link to the stable version and for example download in linux like this:

wget http://build.zurmo.com/downloads/zurmo-stable-3.2.1.57987acc3018.zip

4) Unzip the zurmo file, move it to the web server directory and assign the rights:

unzip zurmo-stable-3.2.1.57987acc3018.zip
mv zurmo /var/www/html/zurmo/
sudo chown -R www-data:www-data /var/www/html/zurmo/

5) Now you can open a link in the browser http: //HOST/zurmo/app/index.php, proceed with the installation and follow the displayed instructions.
At installation we will specify the password of user super and we will fill it, it will be necessary further for an input.

6) During the installation, Zurmo required to disable the strict MySQL mode, for this I opened the configuration file:

sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

Added at the very end of the parameter (since it was not):

sql_mode=""

Reloaded MySQL:

sudo service mysql restart

Done.

Access Control Apache2

Access control Apache2 version 2.4 slightly different from 2.2, for example, to allow access to all, in version 2.4 you need to specify:

Require all granted

Allow access to the specified IP addresses:

Require local
Require ip 192.168.56.1 192.168.22.10

Allow all but the specified IP:

Require all granted
Require not ip 192.168.56.1

Allow the specified host:

Require host example.com

Prohibit all:

Require all denied

And in the version of Apache2 2.2, permit everyone access like this:

Order allow,deny
Allow from all

Prohibit all:

Order deny,allow
Deny from all

Allow access by specified IP:

Order allow,deny
Allow from 192.168.56.1 192.168.22.10

Allow the specified host:

Order Deny,Allow
Deny from all
Allow from example.com

After the changes in the Apache2 configuration, a reboot is required (if the changes were in the .htaccess file, then the reboot is not required):

sudo service apache2 restart

See also:
Using .htaccess

Change connect_timeout in MySQL

connect_timeout – the number of seconds that the mysql server waits for the connection package before terminating the connection.

Connect to MySQL and see the current value:

mysql -u USER -p
show variables like "connect_timeout";
quit;

The value of connect_timeout can be specified in the file /etc/mysql/my.cnf, for example:

[mysqld]
connect_timeout=10

In real time, you can change by executing the SQL query (after restarting MySQL it will be reset to the standard or specified in the configuration file):

SET GLOBAL connect_timeout=10;

The standard value is 10, the minimum value is 2, the maximum is 31536000.

How to install and enable mbstring

To install mbstring in Ubuntu/Debian, run the following command:

sudo apt-get install php-mbstring

In CentOS like this:

sudo yum install php-mbstring

You can activate/deactivate the module like this:

sudo phpenmod mbstring
sudo phpdismod mbstring

Restart Apache2 to apply the changes:

sudo service apache2 restart

Let’s see if mbstring is activated:

php -i | grep -i mbstring

How to get into BIOS on Lenovo laptops

Today it was necessary to go into the BIOS on the Lenovo IdeaPad 110-15IBR laptop (80T7), but when you press all the keys that are usually used to enter the BIOS, the laptop did not respond and the system continued to boot.

As it turned out, in the BIOS of this Lenovo laptop model, the HotKey Mode function is activated as standard and the functional keys are activated instead of the F1-F12 keys.

Therefore, to enter the BIOS, it is necessary to press two Fn and F2 keys simultaneously, if HotKey Mode is disabled, then simply F2.

See alsoFunction keys Fn on the laptop work the other way around