Ετήσια αρχεία: 2011


Ubuntu Linux: Enable CPU Frequency Scaling / Change CPU Frequency 1

First: Install gnome-applets in order to get cpufreq-selector application.

sudo apt-get install gnome-applets

*NOTES: gnome-applets installs a LOT of stuff and will take more than 300MB of free space.

 

Second: Check if your CPU supports frequency scaling

sudo cpufreq-selector

*NOTES: It will take a few seconds or more to finish. If it doesn’t return any output proceed to the next step. If you get this message “No cpufreq support” then do not follow the next steps as you will not find neither the files mentioned below nor work out this way for you.

 

Three: Find out the available frequencies that your system can scale to and the available governors (modes of operation for frequency scaling).

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors

*NOTES: You will get output that resembles these: 3000000 2300000 1800000 800000 and conservative ondemand userspace powersave performance.

 

Four and final step: Configure your system one core at a time.

sudo cpufreq-selector -c CORE_NUMBER -f FREQUENCY_IN_MHz -g GOVERNOR_MODE

*NOTES: CORE_NUMBER: An integer value that defines the core you want to edit. FREQUENCY_IN_MHz: A frequency from the scaling_available_frequencies file. GOVERNOR_MODE: A mode name from the scaling_available_governors file.


High speed HTTP/ HTTPS/ FTP/ BitTorrent/ MetaLink downloads from terminal

aria2c -V --max-concurrent-downloads=7 --ftp-user=useaccount --ftp-passwd=usersecret ftp://useraccount:[email protected]/somefolder/somefile

aria2c is a versatile command line utility that allows the user to download efficiently files using multiple protocols (HTTP/HTTPS/FTP/BitTorrent/MetaLink).


Create a new partition in an LVM filesystem and mount it, resize it and delete it

Managing storage space on Linux servers is a vital aspect of system administration, and the logical volume manager (LVM) is one of the most popular methods of achieving this. The LVM provides an efficient way to manage and organize the storage on a Linux system, allowing administrators to create and manage volumes flexibly. This article aims to explain some essential commands that are commonly used in managing LVM volumes.

1. lvcreate

The lvcreate command creates a new logical volume with a specified size and name. The syntax of the command is:

lvcreate -L size -n name volume_group;

The “size” parameter specifies the size of the logical volume in units like GB, MB, or TB, and the “name” parameter specifies the name of the logical volume. The “volume_group” parameter specifies the name of the volume group in which the logical volume will be created.

For example, to create a new logical volume named “partitionName” with a size of 372.3GB in a volume group named “boxname,” the following command can be used:

lvcreate -L 372.3GB -n partitionName /dev/boxname;

2. mkfs.ext4

The mkfs.ext4 command is used to create a new file system on a specified partition or logical volume. The syntax of the command is:

mkfs.ext4 device;

The “device” parameter specifies the name of the device on which the file system is to be created.

For example, to create an ext4 file system on a logical volume named “partitionName” in the “boxname” volume group, the following command can be used:

mkfs.ext4 /dev/boxname/partitionName

3. mount

The mount command is used to mount a file system to a specific directory in the file system hierarchy. The syntax of the command is:

mount -t filesystem device mountpoint;

The “filesystem” parameter specifies the type of file system to be mounted, the “device” parameter specifies the name of the device containing the file system, and the “mountpoint” parameter specifies the directory to which the file system should be mounted.

For example, to mount the ext4 file system created in the previous step on a directory named “someName” under the “media” directory, the following command can be used:

mount -t ext4 /dev/mapper/boxname-partitionName /media/someName/;

4. lvextend

The lvextend command is used to extend the size of an existing logical volume. The syntax of the command is:

lvextend -L +size device;

The “size” parameter specifies the size by which the logical volume is to be extended, and the “device” parameter specifies the name of the logical volume.

For example, to increase the size of the “partitionName” logical volume by 122.39GB, the following command can be used:

lvextend -L +122.39G /dev/boxname/partitionName;

5. resize2fs

The resize2fs command is used to resize the file system on a specified partition or logical volume. The syntax of the command is:

resize2fs device;

The “device” parameter specifies the name of the device containing the file system.

For example, to resize the ext4 file system on the “partitionName” logical volume after extending its size, the following command can be used:

resize2fs /dev/boxname/partitionName;

6. lvremove

The lvremove command is used to remove an existing logical volume. The syntax of the command is:

lvremove device;

The “device” parameter specifies the name of the logical volume to be removed.

For example, to remove the ext4 file system on the “partitionName” logical volume, the following command can be used:

lvremove /dev/boxname/partitionName;

Other

Following you can find the commands I used to create a new partition on an LVM (Logical Volume Manager) system where during installation there was some hard disk space left empty.

lvcreate -L 372.3GB -n partitionName /dev/boxname
mkfs.ext4 /dev/boxname/partitionName
mount -t ext4 /dev/mapper/boxname-partitionName /media/someName/
#lvextend -L+122.39G /dev/boxname/partitionName
#resize2fs /dev/boxname/partitionName
##lvremove /dev/boxname/partitionName

After creating the partition, we set it’s type – here we used ext4.
Later we mount the partition to a folder to gain access to it.
Following in comments (#) we show how to resize/extend an already existing partition and how to remove it (##) — make sure to remove all brackets before performing these operations.


Add an existing user to an existing group

Add an existing user to secondary/supplementary user group using the -a option

usermod -a -G groupname useraccount;

The usermod command is a Linux utility used to modify the user account information stored in the /etc/passwd and /etc/group files. The -a option is used to append the specified user account to the specified group. The -G option is used to specify the group name that the user account will be added to. The groupname argument is the name of the group that the user account will be added to, and the useraccount argument is the name of the user account that will be added to the group.

In this command, the user account specified by “useraccount” will be added to the group specified by “groupname”. The -a option ensures that the user account will be added to the specified group without removing it from any other groups it may belong to. The -G option specifies that the user account will be added to the specified group as a secondary group.

Once the user account has been added to the specified group, it will have the permissions and access rights associated with that group. For example, if the group has permissions to read and write to certain files or directories, then the user account will also have these permissions once it has been added to the group.

It’s important to note that changes made with the “usermod” command are not applied immediately. The changes will take effect after the next time the user logs in or after a system reboot. Additionally, it’s important to use this command with caution as adding a user to the wrong group could grant unintended access rights to sensitive information.

In conclusion, the usermod -a -G groupname useraccount command is a useful tool for managing user accounts and group memberships in Linux systems. By adding a user account to a specific group, administrators can grant the user access to specific resources and permissions, making it easier to manage and control access to resources on a system.