This last Friday, the 17th, I woke up with all sorts of errands in mind I wanted to get done because when I clocked out of work later that day, everything would be closed and there some things I wanted to take care of before that happened. But my supervisor had a personal situation happen that caused him to not attend work for over a week and I try to only wear my headphones when I can guarantee that I will not get my headphone privileges taken away because I couldn't hear him. Since he was gone, I wanted to load up my phone with stuff to listen to, before getting on with the rest of my day.
I had a bunch of recordings of a family member who has passed on who had a really crass, irreverent and sarcastic sense of humor. I hadn't listened to them for a while and decided I wanted to hear them. But they are not named in a clean manner so they would all be organized at all. The naming schemes are all over the place or not at all. I wanted to clean this up when I saw it, so I put a few recordings on my phone from my Ubuntu RAID Server, which is minimized, meaning there is no GUI. But it uses SMB, so most of my interactions with it are through Windows, with a GUI.
I started organizing them with date at the front of the file names and then realized, you know, all it takes to lose all of these files, since it is Linux, is to accidentally press the delete key and accidentally confirm deleting these files. That is too uncomfortably close for comfort to risk. Right now what I do with several of my files which I peruse regularly is to put all of the files in a folder called "-0 actual" at the top of the folder in Windows, and then make shortcut copies of all of these files in the folder that contains the "-0 actual" folder. It doesn't eliminate the risk of accidentally deleting files, but because I will more often than not, only need to access the outer folder if playing files directly on my desktop computer. If I need the actual file I will have to go into the actual folder and get it and make sure to get out of it as quickly as possible to avoid fudging keys and stuff. I noticed that my mom fudges keys all the time which is why I removed write privileges from her. But I discovered that I also do it too, just not quite as frequently. I created users for myself that have no write privileges but SMB hates switching back and fourth between users all the time. So one of the tactics I employ is this actual folder solution.
As I moved the files into the actual folder I discovered that I had only copied instead of cut them and pasted them. So now there were two copies. And then I got mixed up over another problem I can't remember. I wasn't going to blindly just delete the files in the outer folder without first making sure I wasn't deleting anything that was not copied to the actual folder. And then I forgot which folder I was in and thought it was the outer folder and deleted all the contents. And then I realized what I had done. It is all very hard for me to understand how I did this trying be very careful, both folders were empty. It didn't matter to me how I did it. They were both empty and this was all that mattered. I started to panic.
I knew that the files should still be present on the IronWolf drive which backs up my RAID because Bo Landsem, a friend who has been a network engineer for twenty five years, told me that he never, ever under any circumstance whatsoever relies on a RAID, he always, always, always backs it up and that is why when all of his colleagues have RAIDs fail on them and scramble to try and recovery the data with special software and stuff like that, he always just reverts back to his other backups. So on his advice, I bought a 12TB IronWolf Hard Drive on discount while building my server, deciding not to place my trust in just a RAID.
At the time, Doug thought that the RAID was perfectly trustworthy but I refused to risk it. However, I did not know at that time that in Linux, all it takes is to press the delete key and confirm it before the file is gone. In Windows there is at least a recycle bin. Doug said things like, well, just don't press the delete key. No, I know that I will do it on accident. I know I am not perfect, so I need fail safes.
And what Doug explained like six months later when this information came to my attention was that there isn't really a recycle bin in Windows as we like to think of it, the files don't get transferred to a new folder, what happens in Windows which we see as a recycle bin folder is that windows flags the files so that they appear in the recycle bin folder but they don't get deleted until they have either been in there long enough to be automatically deleted or you clear the recycle bin yourself. I had made a habit out of always keeping my recycle bin clear and things like this have really caused me to want to be more careful and not do so unless I am sure I know what I am deleting. But in Linux, none of this matters, it's all just academic.
I was very uncomfortable with this. But I tried to fix it and make it so things can't just get deleted so easily, and I have not found a solution that satisfies. Seriously, in Linux, the OS that is by far the most customizable? And I can't get a solution that buffers potential deleting like a recycle bin?
It just occurred to me that surely someone has created software for Linux that does this. Surely I am not the only one who thinks this. So I am going to look. But right now, I have accidentally deleted a bunch of files that have serious sentimental value to me and they cannot just be replaced. They are fortunately supposed to still be on my IronWolf drive for reasons exactly like this. That was a well spent nearly $400, I think on discount from about 400 for like 300 or something when I bought it.
But I had never navigated to it without Doug's help. We set it up and he navigated to it and showed me it was there, and then several months later he showed me how to navigate to it and that it wasn't that big of a deal, but that wasn't something I was going to remember. I figured, well hopefully I still either have his help or ChatGPT can explain how to do it or something. For now, I worry about what's currently on my plate and not about things that are not foremost on my mind. Someday I will better figure out how to do this, but I know it is there and that it is doing its job and I know that there is a cron job in Linux running an rsync every Wednesday early in the morning while I am asleep. And since just barely accidentally deleted these files and it's a Wednesday, I don't need to worry about whether or not they are there. But my whole day just went out the window, I will call in sick if I have to in order to avoid losing these files. I need to know they are recovered so I can peacefully move on with my life. And I have several hours before I need to be at work so there's a good chance it won't come to that and I need to make sure I don't have to call in sick because I don't like short paychecks.
First thing, I opened up ChatGPT and asked how to navigate to this file from the directory where I SSH in from. To my surprise this way far easier than I thought it would be. And I thought, once I get to these files and see them listed on the cli, I will SCP them over to my laptop. I don't want to just SCP them back to the RAID, want to have them more tangibly in my hands in a fashion I know that I have them and know what I am doing and that by dragging and dropping them in the folder of my choice, I am not mistyping a command or some stupid thing and anything happens that with my current comprehension, is unpredictable. So I wanted to SCP them to my laptop which is where I was SSHing into the server from. But I had a bunch of challenges that required troubleshooting and caused a great deal of stress.
Just so you know, I am leaving out much of the two and a half hours of frustration not figuring out why things weren't working, but I wasn't able to simply enter the folders I desired. I first had to contend with why I couldn't see the files I was expecting to see. I don't remember why I was able to look into these files so easily and see that what I was looking for was missing, but suffice it to say, that I saw firstly that there were a bunch of users such as "KeepOut" and also "KeepOut[with a skull and crossbones emoji]", Jack Sticka's idea. After dealing with that for maybe nine months and having had to set up SMB several times and having to navigate to find the proper emoji online and then deal wuth the fact that the same exact emoji looks different on one ecosystem such as apple than on another like windows. I would search on my iPhone and not see exactly what I saw in Windows. I ultimately discovered that Windows and Apple display the same exact things verbatim in totally different ways. So I eventually got Doug's help to remove the emoji from the user. But on the IronWolf, this was not straight forward like it would be in Windows. The same user put the same files and folders together, but it was named slightly differently when it did it in a number of cases. I entered "KeepOut" thinking that everything will be in there. I don't know why the version of the user with the emoji is there, but when I went inside to look for the folders and files, the folders were there but the files were not. I backed out eventually and tried the user with the skull and crossbones. And then for some reason, I then experienced great difficulty in actually accessing these files. Now this difficulty only lasted for maybe a half hour. What came next was the real difficulty and it compounded later.
There was a folder that in Windows, is called "- 1 Audio", and then inside of that, in Windows, is called "dad A U D I O". This is how I control where the folders are regardless of word the file is named with, if it is a commonly accessed file, I want it near the top and not have t scroll through and searching with a fine tooth comb through folde3rs that almost never get accessed. I prioritize the ones that I access all the time with special names and characters and extra spaces. And in the cases where I simply have a lot of folders and need to be able to find what I am looking for without visual strain, I is capitalization and spaces throughout the name.
So "- 1 Audio" is for organization and is the outer-most folder I need to access. And "dad A U D I O" is the inner most folder I need to access in this case and is for visually standing out in the crowd so I can find it easily. This caused so much trouble. When Doug was helping me set it up, I had unwittingly done this in Windows, not knowing that this was a problem with Linux. So when we had to set up permissions for different users, these special naming schemes which don't appear too complicated in Windows suddenly got extremely complicated in Linux. And it isn't even that what you have to do in Linux is so complicated as a result, but keeping track of what you are doing so you do it properly is a nightmare.
In Linux, you have to do something called Escaping spaces with a backslash. For example: A file named my file.txt
is referred to as my\ file.txt.
After successfully navigating to the correct directory on the Linux server, I attempted to use the SCP command to transfer files to the Windows machine. The initial SCP commands failed due to several reasons, including incorrect IP addresses, once I had the proper IP addresses, it took tie to then realize I was getting them backwards, and that the IP for my laptop was used for the server and the IP address for the server was used for my laptop. Then there were improper file paths, and incorrect user credentials. I verified the IP addresses of both the server and the Windows machine and ensured the username for the Windows machine was correct by checking the prompt in the Windows terminal, which displayed the logged-in username. And I used IPCONFIG in windows to verify my windows laptop IP address. I don't recall using IFCONFIG to get the IP address of my server...oh yeah, that is because I have SSHed into my server so many hundreds of times by this point and the address is reserved on my routers DHCP address reservation configuration page, that I didn't need to look it up. But an IP address reservation is different from a static IP but gets the same result, just a static address is configured directly on the machine and a reserved address is always the same address given to the machine by the server. I am not sure why if you statically assign an address, why you wouldn't still have to reserve the same address on the DHCP server, because you could see that if the DHCP is dolling out different addresses than the computer has statically assigned to it, then network communication will cease unless maybe broadcast messages maybe get through. And you need your printers and servers to always have the same IP address or things like file shares would be a nightmare and would never work.
The next hurdle involved the SCP command structure. On several occasions, the command failed because it did not accurately reflect the directory structure or handle spaces in file names correctly. Commands such as scp -r /mnt/ironwolf/dad_audio/* Christian@192.168.50.65:/C:/Users/Christian/Desktop/Dad_Audio_Transfer/
were adjusted multiple times to address issues like inaccessible directories or improperly defined paths.
ChatGPT suspected network issues when every time I entered a command and the text curser on a blank line under the entered command would just blink endlessly, sometimes for five minutes, sometimes ten and sometimes a half hour, before finally giving up. I confirmed that the SSH connection was still active by successfully navigating and executing other commands on the server. Despite this, SCP repeatedly failed to establish a transfer connection, which highlighted syntax issues in the command.
To simplify the process, I explored alternatives to SCP, including using rsync
. However, this also presented challenges, such as ensuring rsync
was installed and properly configured. Ultimately, I returned to the SCP command, but after checking to make sure the correct Is were used, then swapping them so the destination wasn't the source and the source wasn't the destination, then making sure the usernames on both the source and the destination were correct, I still didn't get SCP to work. These all contributed but were still not what the problem was. I never figured out why the SCP command didn't work ultimately, but what allowed it to work at last was that I had opened WSL in another Terminal tab, and was exploring the possibility of a few things there but somehow by chance, I thought to try using the SCP command from WSL on my laptop to reach over to the server and grab the files there and pull them over to the windows machine, where I then used SMB to put them back on the RAID.
I believe the final revision of the SCP command was:
scp -r * Christian@192.168.50.65:/C/Users/Christian/Desktop/Dad_Audio_Transfer/
-R means recursive, any file in said folder that this command points to, as well as any folder inside the folder this command points to, will also be copied. But the asterisk is a wildcard command. In this case, it tells the computer that this file we are currently viewing, this directory, plus every folder inside it because of the -r command, will be copied over. Usually the SCP command is laid out in the fashion of "scp" followed by options which in this case is "-r" and "*", both typed separately from each other, then the username@source host Ip address, the source file path of the files to be transferred, then the username@destination IP address, with all three of these separated by colons and no spaces between the locations. But the file path of the files to be transferred was indicated in the options section of the command with the asterisk, so the file path or name of the folder the files were in was unnecessary. And it should be understood that if there are spaces in file or directory names, those are escaped out with a backslash before the space in each case, or the whole title is quoted. There are no spaces between the three addresses, the user@source ip:directory name if it's local or the file path if it's local or not:and the user@destination ip.
In conclusion, resolving this issue required iterative troubleshooting of directory access, user credentials and IP addresses, and SCP command syntax.
This has been Truncat3d 00000000111100010100110______________end of line
No comments:
Post a Comment