Getting hard disk drive serial number at the Linux terminal

You can get the serial number through :

1) hdparm:

hdparm -I /dev/sda | grep Serial

2) sginfo is a part of sg3-utils package:

sginfo -a /dev/sda | grep Serial

3) sdparm command :

sdparm -i /dev/sda | grep 'vendor specific'

4) lshw:

lshw -class disk -class storage | grep serial

Can’t run screen due to “cannot open terminal ‘/dev/pts/1’ – please check” error

Turns out the problem was that I ssh’ed into the machine as root, then changed to the user kramer65 with su kramer65 and then tried to run screen, where screen can only be run by the user that logs in using ssh. So after I added kramer65 to the sudoers file with usermod -aG sudo kramer65

Cannot remove file: “Structure needs cleaning”

That is strongly indicative of file-system corruption. You should unmount, make a sector-level backup of your disk, and then run fsck to see what is up. If there is major corruption, you may later be happy that you did a sector-level backup before letting fsck tamper with the data.

How to Check for Errors on a Disk

Run fsck on the target disk, using the desired options. This example checks all file systems (-A) on /dev/sdb:

fsck -A /dev/sdb

Understand fsck Error Codes

The error codes that fsck returns can be understood with the following table from man7.org:

Code Error Code Meaning
0 No errors
1 Filesystem errors corrected
2 System should be rebooted
4 Filesystem errors left uncorrected
8 Operational error
16 Usage or syntax error
32 Checking canceled by user request
128 Shared-library error

Use fsck to Repair File System Errors

Use the -r option to use the interactive repair option.

This example uses fsck to check all file systems except the root, and will attempt repair using the interactive feature:

fsck -AR -y

To check and attempt to repair any errors on /dev/sdb, use this format:

fsck -y /dev/sdb

“RTNETLINK answers: File exists” when running ifup

You might have to flush the device before ifup and ifdown.

sudo ip addr flush dev <device-name>

Updates were rejected because the tip of your current branch is behind

If you want to avoid having to use -f, then you can use just

git pull

instead of

git pull --rebase

The non-rebase will fetch the changes from origin/dev and merge them into your FixForBugbranch. Then, you will be able to run

git push origin FixForBug

without using -f.