I wanted to run an fsck check on my 5TB external hard drive on my raspberry pi.
This is the output:
$ sudo e2fsck -c -v /dev/sda
e2fsck 1.44.5 (15-Dec-2018)
Checking for bad blocks (read-only test): 0.46% done, 5:04 elapsed. (0/0/0 errors)
There has been zero progress for hours now. The elapsed time is stuck as well. This is actually my second attempt. Before I tried sudo e2fsck -p -c -v /dev/sda. This one doesn't give any output, that's why I let it run for a whole week before terminating.
My drive is unmounted, partitionless, and freshly formatted with mkfs.ext4. Output from ps:
$ ps -a
PID TTY TIME CMD
1075 tty1 00:00:00 bash
8404 pts/1 00:00:00 sudo
8405 pts/1 00:00:04 e2fsck
8446 pts/1 00:00:00 sh
8447 pts/1 00:00:05 badblocks
23605 pts/2 00:00:00 ps
I noticed on my first attempt, that it was impossible to send a SIGINT, SIGTERM, or SIGKILL to badblocks.
Why is this?
Related
There is a field in process object in node.js: process.title
That field allows you to change process name displayed in top or ps command on linux.
Is there some way to do this for and in bash script also?
Changing the command line reference from running processes is possible on *NIX with /proc filesystem :
$ ps
PID TTY TIME CMD
106 tty4 00:00:01 bash
719 tty4 00:00:00 ps
$ echo "toto" > /proc/106/comm
$ ps
PID TTY TIME CMD
106 tty4 00:00:01 toto
719 tty4 00:00:00 ps
$
And yes, it's not the prettiest way to do so.
I am just trying to understand more about the PID column when running the ps command.
If I have two terminal windows open, in the first one I run the following command
firefox &
Then run the ps command in BOTH and get the following output from the first window
PID TTY TIME CMD
16814 pts/1 00:00:00 bash
16822 pts/1 00:00:04 MainThread
16881 pts/1 00:00:02 Privileged Cont
16938 pts/1 00:00:00 WebExtensions
17026 pts/1 00:00:00 Web Content
17081 pts/1 00:00:00 ps
And the following in the second
PID TTY TIME CMD
16794 pts/0 00:00:00 bash
17082 pts/0 00:00:00 ps
In both outputs we see the shell process. Why do they not have the same PID, even if it has the same process name.
Why some processes could not be migrated to a certain cpu by cpuset(7) while some processes could?
I found that these processes could not be really migrated to a certain cpu(Though when you check the cpuset filesystem,it seems ok.But if check the affinity of these processes by top or htop, you could find the cpuset does not work for these processes indeed.):
/sbin/init splash
/usr/sbin/rpc.idmapd
/lib/systemd/systemd-timesyncd
/lib/systemd/systemd-timesyncd
/usr/sbin/cups-browsed
/usr/sbin/sshd -D
/sbin/dhclient -d -q -sf /usr/lib/NetworkManager/nm-dhcp-helper -pf
/var/run/dhclient-
/usr/sbin/dnsmasq --no-resolv --keep-in-foreground --no-hosts --bind-interfaces --pid-
sshd: john [priv]
sshd: john [priv]
sshd: john#notty
/usr/lib/openssh/sftp-server
lightdm --session-child 12 15
upstart-file-bridge --daemon --user
/usr/lib/gvfs/gvfsd-fuse /run/user/1000/gvfs -f -o big_writes
/usr/lib/at-spi2-core/at-spi-bus-launcher
/usr/bin/dbus-daemon --config-file=/etc/at-spi2/accessibility.conf --nofork --print-addre
/usr/lib/at-spi2-core/at-spi2-registryd --use-gnome-session
/usr/lib/update-notifier/system-crash-notification
/usr/lib/x86_64-linux-gnu/hud/hud-service
/usr/lib/dconf/dconf-service
/usr/lib/x86_64-linux-gnu/indicator-power/indicator-power-service
/usr/lib/x86_64-linux-gnu/indicator-power/indicator-power-service
/usr/lib/x86_64-linux-gnu/indicator-datetime/indicator-datetime-service
/usr/lib/x86_64-linux-gnu/indicator-sound/indicator-sound-service
/usr/lib/x86_64-linux-gnu/indicator-printers/indicator-printers-service
/usr/lib/evolution/evolution-source-registry
/usr/lib/evolution/evolution-source-registry
/usr/lib/colord/colord
/usr/lib/colord/colord
/usr/lib/evolution/evolution-calendar-factory
/usr/bin/gnome-software --gapplication-service
/usr/lib/unity-settings-daemon/unity-fallback-mount-helper
/usr/lib/gvfs/gvfs-udisks2-volume-monitor
/usr/lib/gvfs/gvfs-udisks2-volume-monitor
/usr/lib/udisks2/udisksd --no-debug
/usr/lib/gvfs/gvfs-gphoto2-volume-monitor
/usr/lib/evolution/evolution-calendar-factory-subprocess --factory contacts --bus-name or
zeitgeist-datahub
I think that may because your computer use NUMA model rather than SMP model. This can solve the problem, but I'm not sure if that is the reason.
I installed Cygwin for 64 bit versions of Windows.and I run "Cygwin64 Terminal" in order to confirm whole process' state. As far as I know, ps command must show STAT column but It is impossible to find STAT column Whenever I execute "ps -l" or "ps aux" ,"ps -ef", "ps axj"..
I really want to view STAT column in ps command because a source code which I practice recently request me to check zombie process by means of ps command.
screenshot of ps command without STAT column
Use procps
$ /usr/bin/procps.exe ax
PID TTY STAT TIME COMMAND
1580 pty1 Ss 0:00 -bash
1624 pty0 R 0:00 /usr/bin/procps ax
1522 ? Ss 0:05 /usr/bin/mintty -i /Cygwin-Terminal.ico -
1599 pty1 T 0:00 less .bashrc
1523 pty0 Ss 0:00 -bash
1579 ? Ss 0:00 /usr/bin/mintty -i /Cygwin-Terminal.ico -
you can find it in procps-ng package
$ cygcheck -f /usr/bin/procps
procps-ng-3.3.16-1
Run container:
[root#localhost ~]# tty
/dev/pts/3
[root#localhost ~]# docker run -it nginx /bin/bash
root#bee12031f933:/# sleep 20
root#bee12031f933:/#
See:
[root#localhost ~]# tty
/dev/pts/2
[root#localhost ~]# w
17:43:24 up 19 days, 45 min, 5 users, load average: 0.00, 0.01, 0.05
USER TTY FROM LOGIN# IDLE JCPU PCPU WHAT
root pts/0 192.168.1.22 16:24 1:01m 0.73s 0.00s sleep 20
root pts/1 192.168.1.22 11:31 1:02m 4.92s 4.65s docker run -it centos:7.7.1908
root pts/2 192.168.1.22 16:31 4.00s 0.70s 0.01s w
root pts/3 192.168.1.22 15:09 4.00s 0.25s 0.07s docker run -it nginx /bin/bash
root pts/4 192.168.1.22 16:41 44.00s 0.06s 0.06s -bash
Example picture:
enter image description here
enter image description here
docker container running in pts/3, execute command in container "sleep 20". then, i execute command "w" on the external host, display command "sleep 20" is executed in pts/0, what's the reason ?
why do external hosts display commands executed in containers ?
docker is similar to how LXC works. It allows sandboxing processes from one another, and controlling their resource allocations.
Since the resources are "separated", the system will show the information based on what it knows.
myuser#localhost: ~ $ tty
/dev/pts/1
myuser#localhost: ~ $ docker run --rm -it ubuntu:18.04 bash
root#36ed505961f4:/# tty
/dev/pts/0
Check the Kernel Namespaces for more info.