Week 5: Cloud Infrastructure & Networks 101

Table of Contents

  1. Single Bit vs. Double Bit Error (Difference and Correction)
  2. NVMe vs. SCSI vs. SATA
  3. sudo vs su - / $ vs. # / root vs. admin vs. user
  4. Wheel Group
  5. References

1. Single Bit vs. Double Bit Error (Difference and Correction)

A Hamming code is a particular kind of error-correcting code (ECC) that allows single-bit errors in code words to be corrected. Such codes are used in data transmission or data storage systems in which it is not feasible to use retry mechanisms to recover the data when errors are detected. This type of error recovery is also known as forward error correction (FEC).

Constructing a Hamming code to protect, say, a 4-bit data word

Hamming codes are relatively easy to construct because they’re based on parity logic. Each check bit is a parity bit for a particular subset of the data bits, and they’re arranged so that the pattern of parity errors directly indicates the position of the bit error.

It takes three check bits to protect four data bits (the reason for this will become apparent shortly), giving a total of 7 bits in the encoded word. If you number the bit positions of an 8-bit word in binary, you see that there is one position that has no “1”s in its column, three positions that have a single “1” each, and four positions that have two or more “1”s.

If the four data bits are called A, B, C and D, and our three check bits are X, Y and Z, we place them in the columns such that the check bits are in the columns with one “1” and the data bits are in the columns with more than one “1”. The bit in position 0 is not used.

Bit position:  7  6  5  4  3  2  1  0
in binary: 1 1 1 1 0 0 0 0
1 1 0 0 1 1 0 0
1 0 1 0 1 0 1 0
Bit: A B C X D Y Z -

The check bit X is set or cleared so that all of the bits with a “1” in the top row — A, B C and X — have even parity. Similarly, the check bit Y is the parity bit for all of the bits with a “1” in the second row (A, B and D), and the check bit Z is the parity bit for all of the bits with a “1” in the third row (A, C and D).

Now all seven bits — the codeword — are transmitted (or stored), usually reordered so that the data bits appear in their original sequence: A B C D X Y Z. When they’re received (or retrieved) later, the data bits are put through the same encoding process as before, producing three new check bits X’, Y’ and Z’. If the new check bits are XOR’d with the received check bits, an interesting thing occurs. If there’s no error in the received bits, the result of the XOR is all zeros. But if there’s a single bit error in any of the seven received bits, the result of the XOR is a nonzero three-bit number called the “syndrome” that directly indicates the position of the bit error as defined in the table above. If the bit in this position is flipped, then the original 7-bit codeword is perfectly reconstructed.

A couple of examples will illustrate this. Let’s assume that the data bits are all zero, which also means that all of the check bits are zero as well. If bit “B” is set in the received word, then the recomputed check bits X’Y’Z’ (and the syndrome) will be 110, which is the bit position for B. If bit “Y” is set in the received word, then the recomputed check bits will be “000”, and the syndrome will be “010”, which is the bit position for Y.

Hamming codes get more efficient with larger codewords. Basically, you need enough check bits to enumerate all of the data bits plus the check bits plus one. Therefore, four check bits can protect up to 11 data bits, five check bits can protect up to 26 data bits, and so on. Eventually you get to the point where if you have 8 bytes of data (64 bits) with a parity bit on each byte, you have enough parity bits to do ECC on the 64 bits of data instead.

Different (but equivalent) Hamming codes

Given a specific number N of check bits, there are 2N equivalent Hamming codes that can be constructed by arbitrarily choosing each check bit to have either “even” or “odd” parity within its group of data bits. As long as the encoder and the decoder use the same definitions for the check bits, all of the properties of the Hamming code are preserved.

Sometimes it’s useful to define the check bits so that an encoded word of all-zeros or all-ones is always detected as an error.

What happens when multiple bits get flipped in a Hamming codeword

Multible bit errors in a Hamming code cause trouble. Two bit errors will always be detected as an error, but the wrong bit will get flipped by the correction logic, resulting in gibberish. If there are more than two bits in error, the received codeword may appear to be a valid one (but different from the original), which means that the error may or may not be detected.

In any case, the error-correcting logic can’t tell the difference between single bit errors and multiple bit errors, and so the corrected output can’t be relied on.

Extending a Hamming code to detect double-bit errors

Any single-error correcting Hamming code can be extended to reliably detect double bit errors by adding one more parity bit over the entire encoded word. This type of code is called a SECDED (single-error correcting, double-error detecting) code. It can always distinguish a double bit error from a single bit error, and it detects more types of multiple bit errors than a bare Hamming code does.

It works like this: All valid code words are (a minimum of) Hamming distance 3 apart. The “Hamming distance” between two words is defined as the number of bits in corresponding positions that are different. Any single-bit error is distance one from a valid word, and the correction algorithm converts the received word to the nearest valid one.

If a double error occurs, the parity of the word is not affected, but the correction algorithm still corrects the received word, which is distance two from the original valid word, but distance one from some other valid (but wrong) word. It does this by flipping one bit, which may or may not be one of the erroneous bits. Now the word has either one or three bits flipped, and the original double error is now detected by the parity checker.

Note that this works even when the parity bit itself is involved in a single-bit or double-bit error. It isn’t hard to work out all the combinations.

2. NVMe vs. SCSI vs. SATA

These three types of storage interfaces serve as the infrastructure for your data transfers. It’s what gets your valuable information from point A to point B. And just like our roads and highways, there are many options that are best suited for different scenarios. So whether you’re simply archiving data for compliance with government regulations, or you’re selling products on your website, you’ll want to strategically choose the interface — or mix of interfaces — that’s right for you.

SATA (Serial Advanced Technology Attachment)

SATA is the oldest and cheapest interface. Your daughter might call it “basic.” It’s the county roads you drive on when grandma’s in the car and you’re not in a rush. SATA interfaces deliver data through a high-speed serial cable over two pairs of conductors. Back in the 90s, this was a remarkable improvement to interfaces that used parallel data streams. By transmitting data serially, SATA was able to wrap multiple bits into packets and move the data faster than ever before. And while they may not be the most state-of-the-art option today, SATA interfaces are still used in almost every laptop you see on the market.

In a server environment, SATA does come with a few drawbacks. Most notably, SATA can’t read and write simultaneously because it only features half-duplex capabilities. It also has less functionality for error recovery and reporting. So for light workloads involving cold (rarely accessed) data, SATA is a great bargain. However, at the enterprise level, you’re more likely to want SAS channels for your more demanding workloads.

Ultimately, SATA is your best choice when cost is more important in your storage interface decision than performance. For more complex workloads requiring higher performance, you’ll likely want to upgrade to SAS.

SAS (Serial Attached SCSI)

SAS was the natural evolution of SATA once solid state drives came into play. It’s the highway you take on your daily commute to work: you ought to get there on time, but you’re not going to break your back to see Karen in accounting two minutes earlier.

The main difference between SAS and SATA is the point-to-point serial protocol. With SAS, controllers are linked directly to the drive; it also enables the connection of up to 128 different devices via thinner and longer cables. Plus, SAS has full-duplex capabilities supporting simultaneous read and write tasks at high speeds.

For these reasons, SAS is the most common storage interface in data centers. It’s reliable, gives you a great speed-to-cost ratio, and features built-in error checking for end-to-end data integrity. And SAS can also be configured to operate in the same environment as SATA. So you can use SAS drives for your hot (frequently accessed) data, while leveraging the cost advantage of SATA drives for colder data.

Choose SAS if you want to meet the industry standard today. And if you’re looking farther down the road, consider NVMe.

NVMe (Non-Volatile Memory Express)

Your daughter’s dance recital starts in 15 minutes and the shaky phone recording’s not going to cut it. You need to get there now, no matter the cost. For enterprises that need heavy duty compute power, there’s no better performer than the NVMe storage interface. It costs a pretty penny, but it’s worth it if speed is your primary decision factor.

NVMe’s were invented to address a burgeoning problem for server manufacturers. In the early 2000’s, the first PCIe bus offered significant increases in bandwidth because it attached directly to the CPU. Unfortunately, this bandwidth was bottlenecked by storage interfaces that were designed for hard disk drives. So NVMe was created to future-proof the interface and take full advantage of advancements in server technology.

NVMe sits directly between the device driver and the PCIe device, enabling low latency, scalability, and security. This allows them to deliver up to 4 times better I/O operations per second than the most advanced SAS interfaces. Additionally, by enabling drives to use the same “pool” of lanes connected to the CPU, NVMe significantly increases scalability. From a cost standpoint, NVMe can greatly reduce power consumption and improve security to meet standards like the Opal and Enterprise SSC (Security Subsystem Class) specifications.

While this powerful new storage interface has yet to become the standard in server storage interface technology, it is certainly the next big thing. So if you want to set up your storage environment to exceed the status quo in ten years, it’s worth investing in NVMe now.

3. sudo vs su - / $ vs. # / root vs. admin vs. user

Working as root means that you have the power to:

  • Remove any or all files
  • Change the permissions of any or all files
  • Change the runlevel of the system
  • Alter user accounts
  • Mount or unmount filesystems
  • Remove or install software
  • Create, remove, and alter file systems

Basically, you can do anything to the system as the root user. It is the all-powerful administrative account. And, unlike other more chatty operating systems, you won’t see a, “Are you sure?” dialog to be sure that the rm -rf * command you just issued was in /opt/tmp rather than at /. As you can imagine, errors made as the root user can be irreversible and devastating. There is an alternative: sudo.

sudo

sudo, which is an acronym for superuser do or substitute user do, is a command that runs an elevated prompt without a need to change your identity. Depending on your settings in the /etc/sudoers file, you can issue single commands as root or as another user. To continue running commands with root power, you must always use the sudo command. For example, if you want to install the Nginx package, you run:

$ dnf install nginx

But you will see an error if you are not root or in the sudo group. Instead, if you run this command:

$ sudo dnf install nginx

You will be asked to type your password, and then you can run the command if you are a part of the sudo group.

A simple way to switch to an interactive session as a root user is the following:

$ sudo -i

The theory behind using sudo is that the act of issuing the sudo command before any command you run makes you think more about what you’re doing and hopefully make fewer mistakes with an account that possesses unlimited power.

su

su, on the other hand, is an acronym for switch user or substitute user. You are basically switching to a particular user and you need the password for the user you are switching to. Most often, the user account you switch to is the root account but it can be any account on the system.

For example, if you type:

$ su -

In the above example, you are switching to root and you need the root password. The (-) switch provides you with root's environment (path and shell variables) rather than simply giving you root user power for a single command while keeping your own environment.

$ su bryant

For the second example, you are switching to bryant, and so you need bryant’s password unless you are root.

If you want to switch to the bryant user account including bryant’s path and environment variables, use the (-) switch:

$ su - bryant

The (-) switch has the same effect as logging into a system directly with that user account. In essence, you become that user.

In short, if the screen shows a dollar sign ($) or hash (#) on the left of the blinking cursor, you are in a command-line environment.

$ vs. #

$, #, % symbols indicate the user account type you are logged in to.

  • Dollar sign ($) means you are a normal user.
  • hash (#) means you are the system administrator (root).
  • In the C shell, the prompt ends with a percentage sign (%).

There are differences on prompts in different Unix or GNU/Linux distributions because of their default settings. For example, the prompt of Debian/Ubuntu is guest@linux:~$, the one of Fedora/CentOS/RedHat is [guest@linux ~]$ and the one of SuSE Linux/OpenSUSE is guest@linux:~>. In general, the prompt usually show the login user name, machine hostname, and current working directory and ended with a dollar ($), percentage (%), or hash (#) sign.

guest@linux:~$
  • guest - username: the user account you are logged in to.
  • linux - machine hostname: the machine you are operating.
  • ~ - current working directory: the directory you are in. Tilde (~) means home directory, i.e. the default directory when first logging in.

root vs. admin vs. user

The “root” user has full access to everything and anything in the OS X system including System files and user accounts. The Admin user does not have access to the System files or the files in other user accounts than his/her own.

Is root the same as admin?
This level of access is also called “root” or “superuser” in some cases. In Untangle, and indeed in most tech products, admin/administrator/root/superuser are just different words to describe the same thing. This means as admin (root) you have the power to: Read/Modify any setting.

What is root admin?
1. Alternatively referred to as an admin, administrator, and gatekeeper, root is a superuser account on a computer or network and has complete control. See our Administrator definition for a full explanation.

What is the root account and how does it differ from a user account?
The root account is the administrator account as in Windows. A normal user account hasn’t got the privileges root has for obvious reasons, initially after installing your linux distro you will find a normal user in most cases cannot even install additional software unless the account privileges are changed.

Is super user the same as root?
root is the superuser on Linux system. … The root account, also known as the superuser account, is used to make system changes and can override user file protection. root has unlimited powers, and can do anything on system hence the term superuser is used.

Does Windows have a root user?
Superuser Accounts in Windows, Linux, & Unix/Unix-like Systems. In Windows systems, the Administrator account holds superuser privileges. … In Linux and Unix-like systems, the superuser account, called ‘root’, is virtually omnipotent, with unrestricted access to all commands, files, directories, and resources.

What is the system user in Windows?
The system account is used by the operating system and by services that run under Windows. There are many services and processes within Windows that need the capability to log on internally (for example during a Windows installation).

What is root password?
In Linux, root privileges (or root access) refers to a user account that has full access to all files, applications, and system functions. … The sudo command tells the system to run a command as a superuser, or root user. When you run a function using sudo , you’ll usually have to enter your password.

Is root user a virus?
Root means the highest level user in Unix or Linux. Basically, the root user holds system privileges, allowing them to execute commands without restrictions. A rootkit virus has the ability to function as a root user once it has successfully infected the computer. That’s what is a rootkit virus capable of.

Why is root called root?
Unix and Unix-like

BSD often provides a toor (“root” written backward) account in addition to a root account. Regardless of the name, the superuser always has a user ID of 0. … The name root may have originated because root is the only user account with permission to modify the root directory of a Unix system.

What is the difference between root and user in Linux?
“root” (aka “superuser”) is the name of the system administrator account. The origins of the name are a little archaic, but that doesn’t matter. Root user has user id 0 and nominally has unlimited privileges. Root can access any file, run any program, execute any system call, and modify any setting.

What is normal user Linux?
Normal users are the users created by the root or another user with sudo privileges. Usually, a normal user has a real login shell and a home directory. Each user has a numeric user ID called UID.

What is the meaning of Sudo?
sudo is an abbreviation of “super user do” and is a Linux command that allows programs to be executed as a super user (aka root user) or another user. It’s basically the Linux/Mac equivalent of the runas command in Windows.

Is Sudo a root?
Sudo runs a single command with root privileges. … This is a key difference between su and sudo. Su switches you to the root user account and requires the root account’s password. Sudo runs a single command with root privileges — it doesn’t switch to the root user or require a separate root user password.

What is superuser access?
Superuser is an app that lets you manage all the privileges on your Android with full freedom. To do this, of course, you’ll need to have a root device. … Once you have Superuser installed, you can easily manage all the privileges for each app you have installed on your device.

What is the name and the UID of the administrator user?
The UID of the administrator user refers to a unique positive integer that is assigned by the system to each user. It is the user identity definition that is used by the system to identify each user. On the other hand, the username is an interface for the humans to recognize their account and login to the system.

4. Wheel Group

The wheel group is a special user group used on some Unix systems to control access to the su command, which allows a user to masquerade as another user (usually the super user).

What is the wheel group in CentOS?
By default, CentOS 7 has a user group called the “wheel” group. Members of the wheel group are automatically granted sudo privileges. Adding a user to this group is a quick and easy way to grant sudo privileges to a user.

What does group mean in Linux?
In Linux, a group is a collection of users. The main purpose of the groups is to define a set of privileges like read, write, or execute permission for a given resource that can be shared among the users within the group. Users can be added to an existing group to utilize the privileges it grants.

What is Sudoers wheel?
When the wheel group membership gives an user full root access through sudo, it is normally configured like this in the /etc/sudoers file: %wheel ALL=(ALL) ALL. Meaning: “any members of group wheel on ALL hosts can sudo to ALL user accounts to run ALL commands.”

What are users and groups in Linux?
User groups play an important role on Linux systems. They provide an easy way for a select groups of users to share files with each other. They also allow sysadmins to more effectively manage user privileges, since they can assign privileges to groups rather than individual users.

How do I list all groups in Linux?
In order to list groups on Linux, you have to execute the “cat” command on the “/etc/group” file. When executing this command, you will be presented with the list of groups available on your system.

Who is in the wheel group?
The wheel group is a group which limits the number of people who are able to su to root. This usually consists of a group named “wheel” and a set of users that are permitted to use the utility ‘su’ in order to change to root.

How do Linux groups work?
How do groups work on Linux?

  1. Every process belongs to a user (like julia)
  2. When a process tries to read a file owned by a group, Linux a) checks if the user julia can access the file, and b) checks which groups julia belongs to, and whether any of those groups owns & can access that file.
    20 нояб. 2017 г.

How do I find the group GID in Linux?
The groups command lists groups that the user is currently a member of, not all the groups available on the system. You can lookup a group by name or gid using the getent command.

How do you create a group in Linux?
Creating a Group in Linux

To create a new group type groupadd followed by the new group name. The command adds an entry for the new group to the /etc/group and /etc/gshadow files. Once the group is created, you can start adding users to the group .

How do I get Sudoers list?
You can also use “getent” command instead of “grep” to get the same result. As you see in the above output, “sk” and “ostechnix” are the sudo users in my system.

Why is it called Wheel Group?
Origins. The term wheel was first applied to computer user privilege levels after the introduction of the TENEX operating system, later distributed under the name TOPS-20 in the 1960s and early 1970s. The term was derived from the slang phrase big wheel, referring to a person with great power or influence.

How do you use Visudo command?
visudo command uses vi as the editor here some tips to use it:

  1. Switch to root, (su root), then run visudo, (as above).
  2. Find where it says “root ALL=(ALL) ALL”.
  3. Type “o” to insert a new line below it.
  4. Now type what you want to insert, eg “username ALL=(ALL) ALL”.
  5. Hit esc to exit insert-mode.
  6. Type “:x” to save and exit.

How do I manage groups in Linux?
Creating and managing groups on Linux

To create a new group, use the groupadd command. …
To add a member to a supplementary group, use the usermod command to list the supplementary groups that the user is currently a member of, and the supplementary groups that the user is to become a member of. …
To display who is a member of a group, use the getent command.
See also Frequent question: How do I use Microsoft Office in Ubuntu?
10 февр. 2021 г.

How many types of groups are there in Linux?
In Linux there are two types of group; primary group and secondary group. Primary group is also known as private group. Primary group is compulsory. Every user must be a member of a primary group and there can be only one primary group for each member.

How do you set a primary group in Linux?
To set or change a user primary group, we use option ‘-g’ with usermod command. Before, changing user primary group, first make sure to check the current group for the user tecmint_test. Now, set the babin group as a primary group to user tecmint_test and confirm the changes.

5. References

  1. https://electronics.stackexchange.com/questions/71410/single-bit-error-correction-double-bit-error-detection
  2. https://community.hpe.com/t5/Servers-Systems-The-Right/SATA-vs-SAS-vs-NVMe-Making-Sense-of-Storage-Interfaces/ba-p/7039626#.YZGVz2BBw2w
  3. https://www.redhat.com/sysadmin/difference-between-sudo-su
  4. https://askubuntu.com/questions/706186/difference-between-and-in-linux-environment
  5. https://ostoday.org/other/best-answer-what-is-the-difference-between-root-and-administrator.html
  6. https://ostoday.org/linux/what-is-wheel-group-in-linux.html

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Nayeon

Nayeon

Undergraduate student. Currently exploring what’s called cloud infrastructure.