Thursday, April 11, 2019

Linux and the hard drive, LVM, SSD, USB, capacity, speed and lifespan

Mass External Storage


For mass external storage I use Seagate Expansion USB3 drives, I have 2 5TB and 4 8TB drives.  I thought they were the same drive except for capacity but I'm here waiting for 2.2TB of data to write to the 5TB drive, and 16 hours later, it's still not finished.  Yesterday day I was able to fill the 8TB drive with 5TB data in a few hours (I didn't time it).  Near as I can tell, the 5TB drive has the "Seagate 5TB BarraCuda 5400 RPM 128MB Cache" inside and the 8TB has the "Seagate Barracuda 7200 RPM 256MB Cache" inside.  I'm guessing platter density is where most of the speed boost is coming from, heads are writting 2x more per pass, and the higher RPM and larger cache helps, but this 5x faster write speed on the 8TB drive is just amazing!

At $140 for 8TB, I don't see any other choice for cheap external storage, at that price I can buy three 8TB drives for the cost of one 14TB drive.  And I don't see any other choice for the next 5-10 years, the new drive head tech is coming later in 2019 with 20TB drives, but I expect it to be $1,000+, I doubt we'll see those 20TB drives hit the sub $200 price point in less than 5 years.

2020 - now the best value is the Seagate Expansion 10TB on Amazon, for around $180. (In 2021 I shelled out $270 for the 14TB) And when they say 10TB they mean 9TB, formatted:

 Number  Start (sector)    End (sector)  Size       Code  Name
   1              40     19532873693   9.1 TiB     8300  Linux filesystem

 lsusb -t - will tell you what speed (USB) the drive is attached at, sometimes if you had a USB 2 (480M) device plugged to that USB port you may not get USB 3 speed (5000M) until you reboot.

amber<534>%  lsusb -t
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
    |__ Port 1: Dev 2, If 0, Class=Mass Storage, Driver=uas, 5000M
    |__ Port 3: Dev 3, If 0, Class=Mass Storage, Driver=uas, 5000M
    |__ Port 4: Dev 5, If 0, Class=Mass Storage, Driver=uas, 5000M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M
    |__ Port 2: Dev 3, If 0, Class=Mass Storage, Driver=uas, 480M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M




For backup of the most critical backups, like photographs, I'm using MDisc BD, said to last 1,000 years.

When will my internal SSD die?


smartctl --all /dev/sda tells me my Samsung EVO 850 has 32541 Power_On_Hours, nearly 4 years, and Total_LBAs_Written is 60265626638, 28.06 TB.  Only 33 Power-On cycles.  Should I worry?  No one knows for sure about SSD lifespan, with tests and opinions varying, except that the first generation SSDs died young and the next gen like the Samsung EVO's seems to live forever.  I don't expect any problems, I have a EVO 840 that's 6 years old and no sign of problems.  If and when I replace the EVO 850 likely I would go with the Seagate 2TB FireCuda, it's the best of the SSD+HD world.
In 2022 - NVMe pretty much owns the internal drive space, 2T for $200, and incredibly fast.

Formatting steps:

dmesg = drive letter "?" (or from mount, did it automount??)
0) umount !! ; dmesg -T
1) gdisk -l /dev/sdb (got the right drive???)
2) gdisk /dev/sdb
3) d = delete existing partion
4) n = create new, 8300 for Linux
5) w = write/exit
6) power off, or reread??
7) gdisk -l /dev/sdb ; umount  /run/media/charles/EFI
8) mkfs -V -t ext4 /dev/sdb1 = newfs
9) tune2fs -L seagate5 /dev/sdb1
10) tune2fs -m 0 /dev/sdb1
11) vi /etc/fstab, LABEL=seagate5  /seagate5       ext4    defaults 0 0 (use tabs!!)
12) mkdir /seagate5; mount /seagate5 ; df

Note - there are differences between umount and eject that can bite you!
May need a reboot to reset the USB port speed, if you had an optical in that port.
for i in 1 2 3; do hdparm -tT /dev/sdb; done
If dmesg is showing "Ring error" that may mean bad cable.

Mounting by label / file system busy error

Say you pull a drive from another system, in the old days one could mount the drive simply as /dev/sdb1. But if it's a LVM partition it's a bit more complicated and you likely will get the "file system busy" error when you try to mount it. Simple solution is to attach the drive via a USB enclosure and "ls /dev/mapper". Likely you'll see your drive there as the label it's know by and you can then mount that label:

locnar<76># ls /dev/mapper
control                       fedora_localhost--live-swap@  fedora_miner-swap@
fedora_localhost--live-home@  fedora_miner-home@
fedora_localhost--live-root@  fedora_miner-root@

add this line to fstab:
/dev/mapper/fedora_miner-home /mnt/d2    ext4    defaults 1 1              

mkdir /mnt/d2; mount /mnt/d2

External USB case, pop in 2.5 or 3.5 drives






Monday, November 26, 2018

Linux and mouse buttons, assigning functions, VNC cut and paste







In most distros you can assign menu functions to mouse buttons via system settings.

What I'm wanting to do is make the left mouse button select and the right button paste.  Here's how:

 xmodmap ~/.xmodmap

and in the .xmodmap we have:

!
! Swap Caps_Lock and Control_L
!
keycode 109 = Multi_key
remove Lock = Caps_Lock
remove Control = Control_L
keysym Control_L = Caps_Lock
keysym Caps_Lock = Control_L
add Lock = Caps_Lock
add Control = Control_L
!
! mouse control
!
pointer = 1 3 2 4 5

The above first swaps the control and caps lock key, I grew up with Sun keyboards and that's the way it should be, next the "pointer" statement swaps the right and middle buttons for paste.

VNC cut and paste fun.  Most forums advise running vncconfig to resolve you cut and paste issues, however if you're running a Linux KDE desktop and multiple VNC viewer windows like I do, having vncconfig running on anywhere screws cut and paste up.  I found killing off vncconfig makes cut and paste between all windows work just fine.

Or not!  Further investigation seems to indicate KDE Klipper is the problem.  Having KDE running inside a VNC session seems to cause issues with cut and paste, killing Klipper seems to have fixed the problem.



Sunday, June 17, 2018

Linux - no sound after upgrade


The old 2 headed display
On Fedora 25;

Few days ago I upgraded my kernel, easy process, but my second monitor stopped working.  I didn't care much and wasn't going to spend any time fixing it since I was going to order a single larger monitor anyway, so I went back to the older kernel.  When I hooked up the new monitor and booted the new kernel I noticed sound wasn't working.  Long Google hunt later, with no correct answers found, I noticed for the fully working kernel I had a second packaged called  "kernel-modules-extra".

Sure enough, installing "kernel-modules-extra" with a version number which matched the new kernel fixed the sound problem, and likely would have fixed the the second monitor problem too.

You can test for this problem using "aplay -a", if you get a "no sound cards found" message then likely you have a kernel/driver issue which may be solved by installing the correct version of the "kernel-modules-extra" package.

locnar<132>% rpm -qa | grep -i kernel

kernel-headers-4.9.6-200.fc25.x86_64
kernel-core-4.13.16-100.fc25.x86_64
kernel-core-4.9.6-200.fc25.x86_64
kernel-core-4.1.13-100.fc21.x86_64
kernel-modules-4.13.16-100.fc25.x86_64
kernel-modules-extra-4.9.6-200.fc25.x86_64
kernel-4.1.13-100.fc21.x86_64
kernel-modules-extra-4.13.16-100.fc25.x86_64
kernel-4.9.6-200.fc25.x86_64
abrt-addon-kerneloops-2.9.0-1.fc25.x86_64
kernel-modules-extra-4.1.13-100.fc21.x86_64
kernel-modules-4.1.13-100.fc21.x86_64
kernel-debug-devel-4.9.6-200.fc25.x86_64
kernel-modules-4.9.6-200.fc25.x86_64
libreport-plugin-kerneloops-2.8.0-1.fc25.x86_64



The new 4k curved display

Thursday, December 28, 2017

Audio/Video Tools - ripping SACD, DVD-Audio and Blu-ray


So you're running Kodi and want to have all your SACD and DVD-Audio music online?

DVD Audio Extractor is the tool for the job, it'll pull the audio out of DVDA discs and save as MLP or convert to FLAC, it'll even pull tags for most discs.  Works with any DVD drive.  Use the GUI or there's a command line tool dvdae.



My LA Woman DVD-Audio


SACD is a harder one to deal with.  The discs won't read in regular DVD drives, so you need to either get the one special PS3 that will run Linux and read SACDs, or recent news says it can be done by connecting to a port on the newer Oppo players (model Oppo 105D is reported to work).  Otherwise, go fish on bittorrent for the ISOs.

Once you have the SACD ISO files, sacd_extract will turn them into .dsf files that Kodi will play.
Look about for sacd_extract-0.3.8-1.144.x86_64.rpm or source, I started off building from source but found a SUSE Linux RPM that works fine on Fedora.  Example command line:

sacd_extract -m -s -i BatOutOfHell.iso

And chmod a+x on the directory it creates, otherwise my Kodi players with NFS access can't play the files!  On some recent conversions to .dsf (the -s option) I've been getting a loud POP at the end of each song, so I switched to using the -p flag (Philips .dff format) instead of the -s and the problem has gone away.  I don't know if it's a problem with the disc, Kodi or sacd_extract but I've not had it happen before.

My Bat Out Of Hell SACD

Blu-Ray - to move your discs online the best tool I've used is makemkv, it'll open any type of DVD or Blu-Ray disc and extract the content unchanged to .mkv files.  That right, it doesn't "reencode" or compress anything.  If you want to compress or convert to another format, use a tool for that, Handbrake or just ffmpeg.  There's a lot of bugs and problems with Handbrake, I'd not use it for extracting.  Example command line:

ffmpeg -i mpeg2movie.mkv -c:v libx264 -crf 17 mpeg4movie.mkv





If you get an error like below, it means your blu-ray drive doesn't understand the new key/disc that just came out and has therefore bricked itself.  That's right, it won't even read the old discs it use to.
The only fix I know of it to upgrade to a newer release of makemkv, which somehow "unbricks" the blu-ray drive and your problem is solved.

"Tip for everyone, MakeMKV displays the AACS version of the disc before you open the disc. Don't try to open the disc if the disc is higher than the current version that is supported by MakeMKV, which is v63."

Can't read AACS VID from disc - most likely current AACS host certificate is revoked by your drive

See MKB for the story.


Saturday, September 23, 2017

Android best apps and tips


Android and Linux desktop integration




Want to get SMS message and be able to reply to them from your desktop?

How about drag and drop pictures from your phone to desktop with a USB cable?

Install kde-connect (yum install -y kde-connect) on your Linux desk/laptop!  And the KDE Connect app from Playstore. With this app it's easy to move files back and forth between your phone and desktop.

Or it should be, after upgrading to Fedora 29 kdeconnect stopped working.  It pairs fine, however I can't send files to my desktop anymore, after beating Google and all the settings to death I found the best advice was to use the "andftp" Android app with ssh, it works better than kdeconnect does for file sharing from your phone to your desktop.

Another way to do it is via USB cable and the simple-mtpfs Linux RPM.

Another way is Cloud sharing, get a free Gdrive account.

And of course, since we're talking Android here, you can always pop the SD card out of the phone and mount it your desktop/laptop.  I find this is the best way when you're transferring a lot of media files.


NFS on Android?  Forget it, unless you root the device.  However Kodi on Android can access your NFS server just fine.  And KDE Connect can send files back and forth, so that's what you have to live with.


gmail can't establish a reliable connection to the server - You may get this error if your device battery goes completely dead, like you left it in a drawer for several months without charging.  Then you find you can't login to Gmail or Playstore.  The fix that works for me is simply setting the date/time on the device to be current.  It's some kind of "out of range date" bug thing.

Battery

Gause meter

Monday, July 17, 2017

Remove or change a "." extension from files

There's quite a lot of convoluted advice out there on how to do this, cut the ".mp3" or other dot something extension from files, using tricky loops and funny shells.  For years I did convoluted things with sed and for loops, but recently I've switched to the simple and versatile /bin/rename command.

My example files:

locnar<117>% touch Snoop1.H264.mkv Snoop2.H264.mkv title00.mkv

locnar<118>% ls
Snoop1.H264.mkv  Snoop2.H264.mkv  title00.mkv

locnar<119>% rename ".mkv" "" *

locnar<120>% ls
Snoop1.H264  Snoop2.H264  title00

Done!



Thursday, March 16, 2017

Linux log




After fiddling about a bit this morning I was able to join a WebEx meeting
using Chrome. Type in the URL bar:

chrome://apps/

And click on the Cisco WebEx app.

If it's not there click on Web Store then select "App" on the left button
and search for "WebEx".  Install the app. (the APP, not the extension!!)

Another way I commonly use WebEx is from my Android phone and tablet.



https://www.theregister.co.uk/2017/03/21/dns_records_more_revealing_than_you_think_says_german_boffin/

uas_eh_abort_handler = many drive problems, issue went away when I swapped cables.

This happen with a brand new cable.  Over many years as a sys admin I've seen the bad SCSI (now USB) cable issue pop up again and again, with no rhyme or reason.  Known good cables fail out of the blue.  New out of the bag cables are bad.  Lesson learned, always have spare cables on hand, not just as many as you need, always buy extras, from different sources, and keep them handy.

openSUSE Tumbleweed RPMs install on Fedora 25, who knew!?!?!

There's lots of advice out there as to how to change your default boot kernel, and none of it works. At least not on Fedora 25.  What does work is install "grub-customizer" and use that to change the boot order.  No need to "update MBR", I didn't and the order stuck.

There is an issue with kernel 4.13.16-100, doesn't see my second monitor like 4.9.6-200 does.  So I'm just staying with 4.9.6-200 until I do the F25 to F27 upgrade, then I'll dig into the hows/whys if my second monitor isn't seen.

yum updateinfo list - very useful command, had not used before, try and see.

Today's PSA:

[568049.151349] IPv6: ADDRCONF(NETDEV_UP): wlp2s0: link is not ready
[568364.120021] IPv6: ADDRCONF(NETDEV_UP): wlp2s0: link is not ready
[568679.139156] IPv6: ADDRCONF(NETDEV_UP): wlp2s0: link is not ready

Unreadable time stamps on your dmesg (Captain's log) output?

This is what we call "Unix Stardates", or seconds since the kernel started. There's an easy solution,
use "dmesg -T" to produces a coherent time/date format:

[Fri Mar 23 14:33:20 2018] IPv6: ADDRCONF(NETDEV_UP): wlp2s0: link is not ready
[Fri Mar 23 14:38:35 2018] IPv6: ADDRCONF(NETDEV_UP): wlp2s0: link is not ready
[Fri Mar 23 14:43:50 2018] IPv6: ADDRCONF(NETDEV_UP): wlp2s0: link is not ready

Not to be confused with "Unix Time" (seconds since 1 January 1970), which is really a Doctor Who thing.

Mounting Nero! This maybe a disc image with .nrg or .cdi, the file comand shows:

locnar<80># file Image1.cdi
Image1.cdi: Nero CD image at 0x4B000 UDF filesystem data (version 1.5) '071215_0244'

Mount as shown below:

mount -o "loop,offset=307200" imagename.nrg /mount-point
mount -o "loop,offset=307200" Image1.cdi /mnt/sysimage