Why service networking restart or /etc/init.d/networking restart does not work

For example, take the server with the operating system Ubuntu Server 14.04, in which let’s say we changed the network settings when executing the commands:

Continue reading “Why service networking restart or /etc/init.d/networking restart does not work”

Difference between MASQUERADE and SNAT

In this article I will briefly describe the difference between MASQUERADE and SNAT.

MASQUERADE. Less fast routing than SNAT with mass requests, since for each new connection an IP address on the external network interface (WAN) is determined. Great for home use routers and when changing the IP address on the WAN interface.
Continue reading “Difference between MASQUERADE and SNAT”

Description of SMART attributes

In this article I’ll look at the SMART information of the first SSD drive that comes under the arm and describe what the attributes mean.

Suppose we looked at the information on the disk /dev/sda:

sudo smartctl -a /dev/sda

I have the following information:

ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000b   100   100   050    Pre-fail  Always       -       0
  2 Throughput_Performance  0x0005   100   100   050    Pre-fail  Offline      -       0
  3 Spin_Up_Time            0x0007   100   100   050    Pre-fail  Always       -       0
  5 Reallocated_Sector_Ct   0x0013   100   100   050    Pre-fail  Always       -       0
  7 Unknown_SSD_Attribute   0x000b   100   100   050    Pre-fail  Always       -       0
  8 Unknown_SSD_Attribute   0x0005   100   100   050    Pre-fail  Offline      -       0
  9 Power_On_Hours          0x0012   100   100   000    Old_age   Always       -       2850
 12 Power_Cycle_Count       0x0012   100   100   000    Old_age   Always       -       10
168 Unknown_Attribute       0x0012   100   100   000    Old_age   Always       -       0
170 Unknown_Attribute       0x0003   100   100   010    Pre-fail  Always       -       531
173 Unknown_Attribute       0x0012   100   100   000    Old_age   Always       -       12255496
175 Program_Fail_Count_Chip 0x0013   100   100   050    Pre-fail  Always       -       0
187 Reported_Uncorrect      0x0012   100   100   000    Old_age   Always       -       0
192 Power-Off_Retract_Count 0x0012   100   100   000    Old_age   Always       -       5
194 Temperature_Celsius     0x0023   071   067   030    Pre-fail  Always       -       29 (Min/Max 23/33)
196 Reallocated_Event_Count 0x0002   100   100   010    Old_age   Always       -       0
197 Current_Pending_Sector  0x0032   100   100   000    Old_age   Always       -       0
199 UDMA_CRC_Error_Count    0x000b   100   100   050    Pre-fail  Always       -       0
218 Unknown_Attribute       0x000b   100   100   050    Pre-fail  Always       -       0
231 Temperature_Celsius     0x0013   100   100   000    Pre-fail  Always       -       94
233 Media_Wearout_Indicator 0x000b   100   100   000    Pre-fail  Always       -       50171
240 Unknown_SSD_Attribute   0x0013   100   100   000    Pre-fail  Always       -       0
241 Total_LBAs_Written      0x0012   100   100   000    Old_age   Always       -       12213
242 Total_LBAs_Read         0x0012   100   100   000    Old_age   Always       -       321
244 Unknown_Attribute       0x0002   100   100   000    Old_age   Always       -       187
245 Unknown_Attribute       0x0002   100   100   000    Old_age   Always       -       264
246 Unknown_Attribute       0x0012   100   100   000    Old_age   Always       -       12905344

Raw_Read_Error_Rate – means the number of read errors.
Throughput_Performance – overall disk performance.
Spin_Up_Time – time to drive up to the operating speed.
Reallocated_Sector_Ct – number of redistributed (damaged) sectors.
Power_On_Hours – the number of hours that the disk was working.
Power_Cycle_Count – number of disk on/off.
Program_Fail_Count_Chip – number of write errors in flash memory.
Reported_Uncorrect – hardware ECC errors that can not be fixed.
Power-Off_Retract_Count – number of emergency shutdowns.
Temperature_Celsius – the temperature of the disc in degrees Celsius.
Media_Wearout_Indicator – the health indicator of the disc, if it is below 10, then the disc should definitely be replaced.
Total_LBAs_Written – LBA records.
Total_LBAs_Read – LBA reads.

There may also be other attributes:
Start_Stop_Count – number of starts/stops of the spindle.
Seek_Error_Rate – number of positioning errors.
Spin_Retry_Count – number of retry attempts.
Reallocated_Event_Count – number of sector redistribution operations.
Offline_Uncorrectable – number of faulty sectors.
Flying height – height between the head and the surface of the disc.
Disk Shift – the distance of the disc block displacement from the spindle, can change for example after the falls.
G-Sense Error Rate – errors due to external loads/drops.
etc.

See also:
Linux disk test for errors and broken sectors

Description of RAID types

RAID arrays are necessary to improve the reliability of data storage and increase the speed of working with disks by combining multiple disks into one large one. RAID arrays can be either hardware, firmware or software.

I will describe several types:

RAID 0 (stripe) – The mode is only for improving performance when reading/writing does not increase reliability. The user has access to the whole volume of disks, if one of the disks fails, the array is usually destroyed and data recovery is almost impossible.

RAID 1 (mirror) – On all disks the recording is performed synchronously, they completely duplicate each other. Half of the disk space is available to the user. Increases performance only when reading, but this is a very reliable way to protect information. The minimum number of disks is 2.

RAID 10 (RAID 1+0) – This is an array of RAID0 from RAID1 arrays. Fast as RAID0 and reliable as RAID1. The minimum number of disks is four and their number should be even. Half of the disk space is available to the user.
RAID 0 + 1 – RAID1 array from RAID0 arrays. Not popular, since the advantages are worse than RAID 10.

RAID 1E – Similar to RAID10 using an odd number of disks and a minimum of 3.

RAID 5 – User-accessible space is reduced by one disk, reliability is lower than RAID 1, performance is increased when reading and writing as in RAID 0. If one of the disks fails, the data can be restored. The minimum number of disks is 3.

RAID 6 – Similar to RAID 5, including speed, but a little more reliable. The space available to the user is reduced by two disks, the information is not lost when two disks fail. The minimum number of disks is 4.

I personally prefer to use RAID 1 and RAID 6.

Active and passive FTP mode

FTP can work both in the active mode and in the passive mode.

In active mode, the client performs a control connection with the server, and the server makes a connection to the client for data transfer.
The passive control connection and data connection are made by the client himself.

Under the control connection is meant authentication and command transmission.
The control connection is executed by the client in both cases equally, from the client side from the dynamic TCP port 1024-65535 to the server port 21.

In the active mode after the control connection from the client, the FTP server connects to the client’s dynamic port 1024-65535 from its TCP port 20 for data transfer.
In the passive mode after the control connection from the client, the FTP server tells the client the number of the dynamic TCP port 1024-65535 to which it can be connected to the client for data transmission.