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
Related
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.
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.
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
I have a script which executes manually:
#!/bin/bash
mount -t cifs //192.168.138.18/Shared_Drive /mnt/share -o username=user,password=guest
But sudo crontab -e doesn't execute it. I tried:
#reboot /home/user/startup.sh
#reboot sh /home/user/startup.sh
#reboot bash -l /home/user/startup.sh
#reboot /bin/bash /home/user/startup.sh
Nothing works. Permits are:
-rwxr-x--x 1 user user
crontab -e doesn't execute scheduled command, it opens your crontab rules file in an editor
The command will then be executed by cron itself on the specified schedule. (If the rule is written correctly. If you want help checking that then include the cron rule.)
Also note that the crontab command man page says
Note that su(8) can confuse crontab and that if you are running inside of su(8) you should always use the -u option for safety's sake
So you should run sudo crontab -u root -e
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!
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