Display LVM information in Linux redhat [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 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!

Related

Can't throttle IO on cgroup. Says "No such device" when device exists. What could be wrong? [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 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.

Why 'ps' command works different in oracle Linux and CentOS [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 7 years ago.
Improve this question
I am trying to check whether the pmon process is running or not in CentOS and Oracle Linux over shell command. I used below command.
In CentOS :
ps -e | grep pmon;echo $?
Output
61577 ? 00:00:00 ora_pmon_orcl
0
But, in Oracle Linux:
ps -e | grep pmon;echo $?
Output
1
I am not able to understand why they behave differently.
Can I get a command which will work on both OS as below
1 output for process not running
0 output for process running
Edit: As suggested by Vatine and Dipak
Try running this
ps -ef|grep [p]mon|wc -l|awk '{if ($1 != 0) print "0"; else print "1";}'
It will return 1 if process is not running and 0 if it is running.

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

kill remote process by ssh [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
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.
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.
Improve this question
I can't directly access target host, need ssh as a proxy.
How can I kill a process from local use ssh ? I try this:
ssh root#$center "ssh root#$ip \"ps -ef|grep -v grep|grep $target_dir/$main|awk '{print \$2}'|xargs kill\""
it got error:
kill: can't find process "root"
And how to avoid error where process not exist ?
Suppose your process' name is name, then you can try something like this:
ssh hostname "pid=\$(ps aux | grep 'name' | awk '{print \$2}' | head -1); echo \$pid |xargs kill"
Use pkill -f to easily kill a process by matching its command-line.
ssh root#$center ssh root#$ip pkill -f "$target_dir/$main"

real estate linux back up solution [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 5 years ago.
Improve this question
I did a lot of research..but I couldnt find what I exactly want. Can anyone have any/some knowledge regarding how a real estate company backup strategy should be. I mean, there are different backup types such as full, incremental and differential backups.
Which solution(s) a real estate company should use to backup its resources and how frequently (daily, weekly, etc)?
assume that they have linux servers...
many thanks..
This belongs to serverfault, However you need to provide more details.
You should run incremental daily backups and a weekly fully backup.
for MySQL databases check : http://dev.mysql.com/doc/refman/5.1/en/backup-methods.html
for other files you can use rsync with hard copies.
Check this TLDPhowto and LJ article
Concider using encryption on the backup drive, either full disk using dmcrypt or if you use tar/cpio pipe it to openssl (ex : tar -xf - path1 path2 | openssl enc -aes-128-cbc -salt > backup.$(date --iso).tgz.aes
Example daily rsync backup script:
#!/bin/sh
BACKUP_DIR=/mnt/backups/
BACKUP_PATHES="/var /home"
cd ${BACKUP_DIR}
rm -rf backup.5 backup.5.log.bz2 &>/dev/null
recycle() {
i=$1; y=$(($i+1))
b=${2-backup}
mv "${b}.$i" "${b}.$y" &>/dev/null
mv "${b}.$i.log.bz2" "${b}.$y.log.bz2" &>/dev/null
}
recycle 4
recycle 3
recycle 2
recycle 1
recycle 0
OPTS="--numeric-ids --delete --delete-after --delete-excluded"
nice -n20 ionice -c2 -n2 rsync -axlHh -v --link-dest=../backup.1 ${OPTS} ${BACKUP_PATHES} backup.0/ --exclude-from=/root/.rsync-exclude 2>&1 | bzip2 -9 > backup.0.log.bz2
cd /root &>/dev/null

Resources