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).

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.

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.

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.