Can't throttle IO on cgroup. Says "No such device" when device exists. What could be wrong? [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
Instructions I followed: https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v1/blkio-controller.html
Script I ran:
BYTES_PER_SEC=1048576;
MAJOR=259
MINOR=1
echo "device name:"
udevadm info -rq name /sys/dev/block/$MAJOR:$MINOR
echo ""
echo "device numbers:"
echo $MAJOR:$MINOR;
echo ""
sudo mount -t cgroup -o blkio none /sys/fs/cgroup/blkio;
sudo echo "COMMAND TO BE EXECUTED:";
sudo echo "$MAJOR:$MINOR $BYTES_PER_SEC";
sudo echo "$MAJOR:$MINOR $BYTES_PER_SEC" > /sys/fs/cgroup/blkio/blkio.throttle.read_bps_device
sudo echo "$MAJOR:$MINOR $BYTES_PER_SEC" > /sys/fs/cgroup/blkio/blkio.throttle.write_bps_device
Output:
~/Desktop >>> sudo ./test.sh [1]
[sudo] password for brian:
/dev/nvme0n1p1
device name: 259:1
mount: /sys/fs/cgroup/blkio: none already mounted on /sys/fs/bpf.
COMMAND TO BE EXECUTED:
259:1 1048576
echo: write error: No such device
echo: write error: No such device
Not sure what could be wrong. I'm also using NixOS here so not sure if that will actually effect the results.

The error occurs because the only way to throttle IO using cgroups version 1 is to use a device that is physical. The major and minor version numbers I used above are for a partition. You need to pick the major and minor numbers for the physical device that HOLDS the partition.

Related

Process gets killed when ssh disconnects [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed last month.
Improve this question
I'm running the script below on a gcp debian instance. When shutting down my computer, ssh disconnects, and the script stops. Below is my script:
wget -P/root -N --no-check-certificate "https://raw.githubusercontent.com/reeceyng/v2ray-agent/master/shell/install_en.sh" && mv /root/install_en.sh /root/install.sh && chmod 700 /root/install.sh &&/root/install.sh
I have tried Tmux and screen to prevent this based on other posts suggestions. None of them were helpful. All processes stop after some time.
Use nohup to detach your process (here, wget) from your shell. For example:
nohup wget -P/root -N --no-check-certificate "https://raw.githubusercontent.com/reeceyng/v2ray-agent/master/shell/install_en.sh" && mv /root/install_en.sh /root/install.sh && chmod 700 /root/install.sh &&/root/install.sh &
should do the trick.

No remote commands executed when ssh runs as sudo [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
The following command gives the expected result (file is created):
sshpass -p pas ssh root#host 'touch foo'
But the following one does nothing on the remote host:
sudo sshpass -p pas ssh root#host 'touch foo'
The only difference here is just sudo mode.
What is the reason here? And how this can be solved?
The problem is more visible when running ssh -v.
With sudo communication interrupts after detecting the server host key.
To solve the problem ssh needs to run with the following argument -o "StrictHostKeyChecking no".

How to set up an SSH Server on OS X [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I'm planning on making a Bash script that sets up an SSH server. The script is only meant to work on a computer running OS X. With the research I have conducted it seems like you have to use the GUI to enable SSH. Is their a way to enable SSH through Terminal and then create a script that does so?
You can enable it from the command line (or a shell script) with:
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist
You might also want to regulate access to the ssh service with the com.apple.access_ssh group:
sudo dseditgroup -o edit -a usernametoallow -t user com.apple.access_ssh
sudo dseditgroup -o edit -a otherusernametoallow -t user com.apple.access_ssh
sudo dseditgroup -o edit -a groupnametoallow -t group com.apple.access_ssh
...after which only usernametoallow, otherusernametoallow, and members of groupnametoallow will be able to ssh into the Mac.

Display LVM information in Linux redhat [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
How to display Logical Volume full name with volume group and their size and mount point? All above information are displayed horizontally.
Example:
LV VG Size Mountpoint
/dev/vg1/lv1 vg1 100M /data
The first three are available from lvs. The last is available from mount. You can combine them with a short script:
#!/bin/bash
(
echo LV VG Size Mountpoint
sudo lvs --noheadings -o lv_path,vg_name,lv_size | while read lv vg size; do
echo -n "$lv $vg $size "
mount | while read dev on path rest; do
[[ "$lv" -ef "$dev" ]] || continue
echo -n "$path"
break
done
echo
done
) | column -t
This produces the following output on my system:
LV VG Size Mountpoint
/dev/vg_gargan/lv_aron vg_gargan 64.00g /home/aron
/dev/vg_gargan/lv_fedora vg_gargan 21.50g /
/dev/vg_gargan/lv_data vg_gargan 21.00g /data
/dev/vg_gargan/lv_swap vg_gargan 2.00g
Hope that helps!

Error mounting in fstab Ubuntu [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I'm working on a bash class project which needs me to create 2 partitions in Ubuntu and make them be automatically mounted each time the systems boots with fstab.
I got the following file which creates (I think correctly) the 2 partitions needed and adds them to the fstab file.
#!/bin/bash
#SVN Partition
(echo n; echo p; echo ; echo ; echo +20G; echo w;) | sudo fdisk /dev/sdb
#WEB Partition
(echo n; echo p; echo ; echo ; echo +5G; echo w;) | sudo fdisk /dev/sdb
sudo su -c "echo '/dev/sdb1 /svn ext4 rw,user,auto,utf8 0 0' >> /etc/fstab"
sudo su -c "echo '/dev/sdb2 /web ext4 rw,user,auto,exec,utf8 0 0' >> /etc/fstab"
When I reboot the system an error appears telling me the automatic mounting for /web and /svn failed.
Does anyone have a clue on what is happening? Thanks in advance.
You haven't formatted the filesystems...
Execute these before reboot.
sudo mkfs.ext4 /dev/sdb1
sudo mkfs.ext4 /dev/sdb2

Resources