I have NAS (Network Attached Storage) on my network to hold my music, pictures & movies. I attach (mount) the folders on it to my devices for easy access. I was using Samba as it allowed Windows & Linux devices to connect without too much drama.
Then it suddenly stopped working, wtf?
As it turns out a security change in the Samba code meant it couldn't connect unless the version was specified.
To debug and discover the issue the following command run in a terminal allows you to see responses to the "mount" command. Very handy :-)
journalctl -fb
With that running it was just a case of attempting to mount the folders in another terminal to see errors returned. To mount the folders run the following command:
sudo mount -a
Note:
The fix I needed was to simply specify the Samba version in use by adding
vers=1.0
to the mount command. Here's an example:
Before:
//192.168.1.14/Vol_1/pictures /media/pictures cifs credentials=/home/joeking/sambacreds,uid=joeking,gid=joeking,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm 0 0
After:
//192.168.1.14/Vol_1/pictures /media/pictures cifs credentials=/home/joeking/sambacreds,uid=joeking,gid=joeking,iocharset=utf8,file_mode=0777,dir_mode=0777,vers=1.0,noperm 0 0
Sunday, 16 December 2018
Thursday, 22 November 2018
Mounting and accessing a Windows drive from Linux
I copied some of the following suggestion from: https://superuser.com/questions/145191/how-do-i-map-a-drive-network-share-using-the-linux-terminal
I did this because the information may vanish one day and the whole point of this blog is so I don't have to search for the same answers later (My memory is too full after 25 years in IT, lol).
Update:
Get Partition Info: Use sudo blkid to get the UUID (e.g., UUID="1234-ABCD") and TYPE="ntfs". Create Mount Point: sudo mkdir /mnt/windows. Edit /etc/fstab: sudo nano /etc/fstab. Add a Line: Add this line, replacing the UUID and mount point as needed: UUID=1234-ABCD /mnt/windows ntfs-3g defaults,uid=1000,gid=1000,dmask=002,fmask=111 0 0. To mount the drive at boot, edit /etc/fstab
sudo xed /etc/fstab
Add the following line modified to suit your system of course
//source/share /mnt/folder cifs credentials=/home/user/.smbcredentials,uid=1000,gid=1000,_netdev,vers=3.0
To enhance security store credentials in a separate file (.smbcredentials) with restricted permissions (e.g.chmod 600 ~/.smbcredentials). The syntax for .smbcredentials is:
username=user
password=pass
After editing /etc/fstab, test the configuration using sudo mount -a to verify that the share mounts correctly without errors.
I did this because the information may vanish one day and the whole point of this blog is so I don't have to search for the same answers later (My memory is too full after 25 years in IT, lol).
Create a directory on your machine to use as a mount point for the share:
sudo mkdir /media/yoursharename
Then use the mount command to map a Windows share to the mount point you just created:
sudo mount -t cifs -o username=<your username> //server/sharename /media/yoursharename
You should now be to access the share from your /media/yoursharename mount point.
Then use the mount command to map a Windows share to the mount point you just created:
sudo mount -t cifs -o username=<your username> //server/sharename /media/yoursharename
You should now be to access the share from your /media/yoursharename mount point.
Update:
Get Partition Info: Use sudo blkid to get the UUID (e.g., UUID="1234-ABCD") and TYPE="ntfs". Create Mount Point: sudo mkdir /mnt/windows. Edit /etc/fstab: sudo nano /etc/fstab. Add a Line: Add this line, replacing the UUID and mount point as needed: UUID=1234-ABCD /mnt/windows ntfs-3g defaults,uid=1000,gid=1000,dmask=002,fmask=111 0 0. To mount the drive at boot, edit /etc/fstab
sudo xed /etc/fstab
Add the following line modified to suit your system of course
//source/share /mnt/folder cifs credentials=/home/user/.smbcredentials,uid=1000,gid=1000,_netdev,vers=3.0
To enhance security store credentials in a separate file (.smbcredentials) with restricted permissions (e.g.chmod 600 ~/.smbcredentials). The syntax for .smbcredentials is:
username=user
password=pass
After editing /etc/fstab, test the configuration using sudo mount -a to verify that the share mounts correctly without errors.
Tuesday, 13 November 2018
NAS & RAID 5 Array observations
I have been trying to find a NAS to store all my family photos, movies & music. It's been an interesting but frustrating journey and I have some points to share that the "glossy marketing ads" fail to mention.
I hope this helps you in your choices. This is not exhaustive but I have tried 2 major and different brands and "done me some learnin'" in the process.
D-Link NAS. This failed fairly quickly but I was able to restore it as one of the volumes developed an issue. I now know that RAID 5 cannot fix a drive with an unrecoverable disk error. RAID 6 can handle this, so in future it's RAID 6 only for me.
For those interested in the fix, I bought an external drive mount and inserted the drives. These mounted in Linux and then I used Linux disk tools to scan, find & mark unrecoverable disk errors as unusable. RAID 5 fixed. :-)
Drobo NAS - This failed after a year and a half. It claims "Drives have been removed, please re-insert". This is odd as the (Windows only, ugh) software also states all drivebays are full and all drives have a status of "good". So the software conflicts with itself. :/
I have been having a ongoing discussion with their technical support for a couple of weeks about this issue. They are asking the most basic questions. I think this may be a stalling tactic as they appear to have no clue and offer suggestions such as reboot and remount of the drives in the NAS. After nearly 25 years in IT, I have already been there and done that...
As these Drobos have a proprietary filesystem I cannot even take a peek with Linux to find a cause.
Though I have just realised in writing this I *may* be able to fix an unrecoverable disk error. I'll update this post if this is successful.
Update:
Drobo are saying the drive bay is faulty and they will replace it with a new one. I have posted this back to the US. Unfortunately postage was $82 and bubble warp was $6, so returning it was not a cheap exercise. Oh well, I think I may copy the data back to the original D-Link and reformat the Drobo and configure with Raid 6. It's funny that I will end up with a NAS Raid as a backup for a NAS Raid.
Also, I have been scanning the Drobo's drives (3TB each) for unrecoverable disk errors and have found none yet. This has taken almost 2 days so far. I love that under Linux I could pop open 4 terminals and have each one scan 1 of the 4 drives from the Drobo. Under Windows I'd likely have to scan each drive sequentially so rather then 2 days scanning, I would have been looking at well over a week.
Update 2:
This is a little late but over a month ago I had my drobo issue sorted. The manufacturer initially sent me a replacement Drobo and got me to apply a new firmware to it. This broke the Drobo.
They sent me another Drobo and got me to apply the same firmware to it. I mentioned this would likely break it again but they insisted, I applied it and it broke the Drobo.
They sent me a third Drobo and asked me to apply a new and different firmware.
This fixed it, though the Drobo reported a broken drive. Interestingly Linux can use this drive fine. I replaced the working drive and the Drobo rebuilt the array and it all works. Yay.
Note: I had been using my DLink NAS in the mean time but this failed too. I spent a good deal of time trying to fix it but in the end I just formatted the DLinks drives and copied the Drobos contents on to it. I now use rsync to keep the NASs synchronised.
The points I take away from this are:
1) Use RAID 6 only, as this can handle unrecoverable disk errors.
2) No proprietary filesystem, as you can't inspect and fix filesystem errors.
3) Must be able to be monitored and managed by a web interface, not 'Windows only' software.
Using this criteria then the D-Link is the better device, though my model does not support Raid 6.
I hope this helps those in the market and good luck. If anyone has a better and most importantly, reliable RAID 6 NAS device, please post a comment and let me know.
I hope this helps you in your choices. This is not exhaustive but I have tried 2 major and different brands and "done me some learnin'" in the process.
D-Link NAS. This failed fairly quickly but I was able to restore it as one of the volumes developed an issue. I now know that RAID 5 cannot fix a drive with an unrecoverable disk error. RAID 6 can handle this, so in future it's RAID 6 only for me.
For those interested in the fix, I bought an external drive mount and inserted the drives. These mounted in Linux and then I used Linux disk tools to scan, find & mark unrecoverable disk errors as unusable. RAID 5 fixed. :-)
Drobo NAS - This failed after a year and a half. It claims "Drives have been removed, please re-insert". This is odd as the (Windows only, ugh) software also states all drivebays are full and all drives have a status of "good". So the software conflicts with itself. :/
I have been having a ongoing discussion with their technical support for a couple of weeks about this issue. They are asking the most basic questions. I think this may be a stalling tactic as they appear to have no clue and offer suggestions such as reboot and remount of the drives in the NAS. After nearly 25 years in IT, I have already been there and done that...
As these Drobos have a proprietary filesystem I cannot even take a peek with Linux to find a cause.
Though I have just realised in writing this I *may* be able to fix an unrecoverable disk error. I'll update this post if this is successful.
Update:
Drobo are saying the drive bay is faulty and they will replace it with a new one. I have posted this back to the US. Unfortunately postage was $82 and bubble warp was $6, so returning it was not a cheap exercise. Oh well, I think I may copy the data back to the original D-Link and reformat the Drobo and configure with Raid 6. It's funny that I will end up with a NAS Raid as a backup for a NAS Raid.
Also, I have been scanning the Drobo's drives (3TB each) for unrecoverable disk errors and have found none yet. This has taken almost 2 days so far. I love that under Linux I could pop open 4 terminals and have each one scan 1 of the 4 drives from the Drobo. Under Windows I'd likely have to scan each drive sequentially so rather then 2 days scanning, I would have been looking at well over a week.
Update 2:
This is a little late but over a month ago I had my drobo issue sorted. The manufacturer initially sent me a replacement Drobo and got me to apply a new firmware to it. This broke the Drobo.
They sent me another Drobo and got me to apply the same firmware to it. I mentioned this would likely break it again but they insisted, I applied it and it broke the Drobo.
They sent me a third Drobo and asked me to apply a new and different firmware.
This fixed it, though the Drobo reported a broken drive. Interestingly Linux can use this drive fine. I replaced the working drive and the Drobo rebuilt the array and it all works. Yay.
Note: I had been using my DLink NAS in the mean time but this failed too. I spent a good deal of time trying to fix it but in the end I just formatted the DLinks drives and copied the Drobos contents on to it. I now use rsync to keep the NASs synchronised.
The points I take away from this are:
1) Use RAID 6 only, as this can handle unrecoverable disk errors.
2) No proprietary filesystem, as you can't inspect and fix filesystem errors.
3) Must be able to be monitored and managed by a web interface, not 'Windows only' software.
Using this criteria then the D-Link is the better device, though my model does not support Raid 6.
I hope this helps those in the market and good luck. If anyone has a better and most importantly, reliable RAID 6 NAS device, please post a comment and let me know.
Monday, 5 November 2018
How to find what process is locking a file or folder under Windows
To find what process is locking a file or folder under Windows, open the Resource Monitor by typing resmon <ENTER> in the Run applet (Press Windows key + R).
Then type the file/folder name into the search box on the mid-right of the Resource Monitor.
After some searching the errant process will be displayed. Just close the process/program or kill it via Task Manager if it's no longer visible.
Hint: In earlier versions of Windows you may need to use Sysinternals Process Explorer to locate and kill the process.
Then type the file/folder name into the search box on the mid-right of the Resource Monitor.
After some searching the errant process will be displayed. Just close the process/program or kill it via Task Manager if it's no longer visible.
Hint: In earlier versions of Windows you may need to use Sysinternals Process Explorer to locate and kill the process.
Monday, 29 October 2018
Running SQL from the command line
I run a family Minecraft server. I use Craftbukkit for the server as it allows adding plugins without the need to unzip jars, etc.
One of the plugins called Savage Death Chest automatically put your items into chests so they are not lost upon death. This is great however finding the chest can be a pain.
I discovered the plugin uses a small sqllite database (deathchests.db) file for storing deaths including X, Y, Z coordinates. Eureka!
I wrote an SH script file to interrogate the file for the latest coordinates and display them in the terminal.
Then it's simply a case of executing the Minecraft TPC command for teleporting to the spot:
/tpc X Y Z
Note: Be careful with the Y coordinate as you may teleport into a rock or into water. It may be worth adding 10 to the Y coordinate to be sure you above the chest.
The SH file is quite simple:
sqlite3 /Minecraft/CraftBukkit\ Server/plugins/SavageDeathChest/deathchests.db 'select x, y, z from blocks where blockid = (select max(blockid) from blocks)'
Note: You may need to install sqllite to get this to work
One of the plugins called Savage Death Chest automatically put your items into chests so they are not lost upon death. This is great however finding the chest can be a pain.
I discovered the plugin uses a small sqllite database (deathchests.db) file for storing deaths including X, Y, Z coordinates. Eureka!
I wrote an SH script file to interrogate the file for the latest coordinates and display them in the terminal.
Then it's simply a case of executing the Minecraft TPC command for teleporting to the spot:
/tpc X Y Z
Note: Be careful with the Y coordinate as you may teleport into a rock or into water. It may be worth adding 10 to the Y coordinate to be sure you above the chest.
The SH file is quite simple:
sqlite3 /Minecraft/CraftBukkit\ Server/plugins/SavageDeathChest/deathchests.db 'select x, y, z from blocks where blockid = (select max(blockid) from blocks)'
Note: You may need to install sqllite to get this to work
Wednesday, 17 October 2018
Easily reinstalling Linux (Mint)
I switched all our home PCs to Linux Mint a few years ago, as I was sick of the unreliability of MS Windows. Near weekly reinstalls of Windows pushed me over the edge. Suffice to say kids and Windows don't mix. Lol.
Since then I have only had to reinstall Linux once and that was a dream effort.
How?
The trick is when reinstalling, choose exactly the same partition where the existing (broken) Linux is, to install the new Linux.
The install process will complain that files exist and will be overwritten. That's what we want! The beautiful thing is you will end up with a working Linux AND by creating new users with the same names as the previous users, the previous users will have all the same files available to them. No mucking about with Windows GUIDs, hidden folders or other rubbish.
Windows can't do that and you'll end up with old user Home folders and new user Home folders. Then you need to try and work out what to move from old to new. This may not be so hard for yourself but trying to decide what another person wants moved and doesn't care about is a pain and a potential heartache.
Note: You will still need reinstall your applications in either operating system but at least under Linux your users don't lose irreplaceable personal data.
Since then I have only had to reinstall Linux once and that was a dream effort.
How?
The trick is when reinstalling, choose exactly the same partition where the existing (broken) Linux is, to install the new Linux.
The install process will complain that files exist and will be overwritten. That's what we want! The beautiful thing is you will end up with a working Linux AND by creating new users with the same names as the previous users, the previous users will have all the same files available to them. No mucking about with Windows GUIDs, hidden folders or other rubbish.
Windows can't do that and you'll end up with old user Home folders and new user Home folders. Then you need to try and work out what to move from old to new. This may not be so hard for yourself but trying to decide what another person wants moved and doesn't care about is a pain and a potential heartache.
Note: You will still need reinstall your applications in either operating system but at least under Linux your users don't lose irreplaceable personal data.
Awesome animated wallpaper for Linux
After sprucing up my GUI with Compiz, I thought I'd see if there was a way to animate my wallpaper.
This led me to find the awesome Komorebi. It's freeware and hosted on Github.
This tool adds animated wallpapers to your desktop and so far it seems quite compatible with Compiz, woohoo. It also comes with a tool for creating your own animated video wallpapers. The interfaces for these tools are very slick and modern.
The only negative I have found so far is that it does increase CPU usage to around 15% - 25%. This is not bad considering my Linux box is a few years old, so it should be less on newer hardware.
Enjoy :-)
This led me to find the awesome Komorebi. It's freeware and hosted on Github.
This tool adds animated wallpapers to your desktop and so far it seems quite compatible with Compiz, woohoo. It also comes with a tool for creating your own animated video wallpapers. The interfaces for these tools are very slick and modern.
The only negative I have found so far is that it does increase CPU usage to around 15% - 25%. This is not bad considering my Linux box is a few years old, so it should be less on newer hardware.
Enjoy :-)
Sunday, 14 October 2018
The best desktop experience, bar none.
I'd played with Compiz in the past. I was very impressed with the desktop effects it provided, such as Wobbly Windows (like windows made of Jelly), workspaces/desktops mapped to a cube and random menu effects. I found playing games would cause issues, so it slipped from use as a buggy GUI is not wanted.
Imagine my surprise when I re-tried Compiz and discovered it fast, bug free and that it played nicely with fullscreen games. Woohoo. Now I finally have a desktop that IMHO puts Windows and Macs to shame.
Installation:
Under Linux Mint it was as simple as installing the Mate desktop (if using Cinnamon) and then enabling Compiz, rather than the standard Marco Composite desktop.
Initially I discovered no "Wobbly Windows", so a quick install of "compiz plugins" fixed that and also added many other features. So much to customise now, wow, just wow.
Imagine my surprise when I re-tried Compiz and discovered it fast, bug free and that it played nicely with fullscreen games. Woohoo. Now I finally have a desktop that IMHO puts Windows and Macs to shame.
Installation:
Under Linux Mint it was as simple as installing the Mate desktop (if using Cinnamon) and then enabling Compiz, rather than the standard Marco Composite desktop.
Initially I discovered no "Wobbly Windows", so a quick install of "compiz plugins" fixed that and also added many other features. So much to customise now, wow, just wow.
How to change the lockscreen wallpaper in Linux Mint.
Find the JPG file you want to use and copy it over the top of the existing default file /usr/share/backgrounds/linuxmint/linuxmint.jpg
$> sudo cp -f
Update:
Use this command to set any wallpaper to your lockscreen when using Cinnamon.
gsettings set org.cinnamon.desktop.background picture-uri 'file:///home/username/Pictures/your-wallpaper.jpg'
Tips:
* Check your desktop environment: Run echo $XDG_CURRENT_DESKTOP to confirm if you're using Cinnamon, MATE, or Xfce
* Default locations: System wallpapers are usually in /usr/share/backgrounds/
* Permissions: Make sure the wallpaper file has appropriate read permissions
Monday, 30 April 2018
Hiding users from login screen in Linux Mint
To hide users from the login screen
$ sudo gedit /etc/mdm/mdm.conf
Add an Exclude line referencing the users to hide under the Greeter section:
[greeter] Exclude=nobody, user1,user2 etc
$ sudo gedit /etc/mdm/mdm.conf
Add an Exclude line referencing the users to hide under the Greeter section:
[greeter] Exclude=nobody, user1,user2 etc
Subscribe to:
Posts (Atom)