 We're going to be playing around with Linux file systems and partitions and disks. Here's the deal. A couple days ago I installed an M-SATA drive on my computer. I did a little video putting it in. And now I actually have three hard drives on my computer. And now that I have three, there's some things I need to move around. There's some things I need to optimize and stuff like this. So this is what we're going to be doing and talking about here. So to be clear, I put in a solid state, an M-SATA solid state drive. It's around, on paper, it was 256 gigabytes. Here it is here. You'll notice that, of course, I just ran LSBLK to look at my block devices. It has no partitions on it. It's just this drive here. And I have two other hard drives. One other one, my SDA here. It is a, it's also a solid state drive. It's a normal size, two and a half, whatever size drive on paper. It's supposed to be one terabyte. This is what I have my main system on. And again, it's a solid state drive. So it's nice and fast and stuff like that. I actually have two partitions. One is my root partition that, of course, is mounted at root at slash. That's where I have all my operating system. It's only 30 gigabytes. I think it's around, let's see. I think it's around half full right now. Yeah, it's around half full right now. And I also, that's just because I removed a bunch of, like, Pac-Man caches and stuff like that. It originally was like pretty close to 30 gigabytes. So I was cutting it close. So I need some more room for that. And at the same time, I also have a home partition, which is nearly full right now. I need to clean a lot of stuff out of this. But it is part of my main hard drive as well. Notice additionally I have one other drive here. And this, actually I should show you. So of course all of this is, you know, my laptop. You got the M-SATA that's around here. You got the hard drive that's around here. But I also have a little base here. And ThinkPads can come with bases. I can, of course, take this laptop off. And when I get home, I can plug it into my base. Everything's already plugged into the base. But the nice thing about those bases is you can actually hook up an extra hard drive as well. So I have a two terabyte drive here that I actually keep most of my, I don't know, like videos and media and stuff on. We can actually look at the content. Notice that all of it is mounted to media. And I can check that out. We can look at the contents here. I have like the directory that's creations. That's like my YouTube videos and source files for my videos. I have a backup of my mail. And I have movies and television that I've downloaded over the years. You can actually, I mean, I have a lot of this stuff. I build up, I don't know, a lot, just a lot of space over the years. So I need an extra drive for that. So that's why I have it. Now notice, again, it is mounted to slash media. But a lot of times I want a more convenient location for that kind of stuff. So actually, you know, if you look at my main, my home directory, I have this video, videos directory. And inside of that, I actually have a movies and a television sub directories. Those are actually just shortcuts that link to this, link to that drive, link to the directories on that drive. Now I'm going to be moving some stuff around in this video and deciding how I want everything mounted. Now on Linux, when you have multiple drives, or well really even when you have one drive, there is one particular file that's highly important. And that is fstab, etsy slash fstab. I'm going to open this file up. Actually, let me move my head down a little bit because we might need the whole screen. So the fstab file, if you've ever installed Arch or any other minimal install distribution, you've seen this file, you have to generate this file. Basically what each of these lines here, they are telling Linux where to mount your drives. So for example, one of our partitions, this is the one, it's unique identifier, looks like this. Each partition is going to have a UUID, a unique identifier. And it's going to be mounted to slash, to root. Here's our home directory. And here's also my media directory. The only thing important to note here is that it has the no fail option. And that's because, you know, when I don't have my computer connected to its base, I don't want Linux to say, hey, I couldn't mount this drive, so I'm not going to bother to start. That's what that's about. If you want to learn more, you can read the Arch Wiki or something like that. And I also have a line here for mounting SD cards, which is not actually based on UUID, it's actually based on the device location, because really you only have one SD card slot. So there's no reason to have more than one. Anyway, that's not super important here. So in this video, here's what I'm thinking about doing. Let me just sort of talk through what I'm thinking about. So I want to move my operating system. So again, my operating system is on this partition. I want to move it to this M-SATA drive. Okay, I want to have a new partition on this M-SATA drive, and it's going to have my entire operating system. And there are a couple other things that I want to move over. For example, I have, actually where is it? So I have a copy of the Monero blockchain. It's at least a pruned copy of the Monero blockchain. And blockchains can get very big. Actually, let's see how big this one is in local share, bit Monero, about to type butt Monero. It's around 30 gigabytes, and it's only getting bigger. So I was thinking about on this new drive, it's 256 gigabytes. I'll have my new operating system, or I'll copy over my old operating system, and I'll have maybe a copy of the Monero blockchain. I honestly have enough space to maybe have the Ethereum blockchain and some other stuff. I was thinking about downloading offline map data, and that can take gigabytes and gigabytes, but I might be able to actually fit that on the new drive. So that's an option as well. So what I'm going to do in this video, I'm going to create a partition on this drive. I'm going to move some of that stuff over, and then I'm going to show you the process of telling your computer to boot off of a new drive and ignore this old partition. And what I think I'm going to do with this partition, I haven't totally decided yet. But what I think I'm going to do is maybe in another video, I'll have an encrypted partition that I had, I hide some more, I don't know, sensitive stuff on, maybe my old emails or something like that. But anyway, let's get this party started. So again, I'm going to become Root, and let's start by making a new partition on this drive just to do it. So I'm going to run, let's use fdisk, and I'm going to run fdisk on dev slash sdc because that's the partition we're working on. Now, this is going to allow you to delete or add partitions. I don't have any partitions here, so I can just type in in for new partitions, and I'm basically just going to press enter, enter, enter, enter, and then yes on that. So all of that is, I mean, that just was deciding how big you want your partition. I just want one partition to fill up the entire drive. I'm not going to do anything more complicated. Once you're done, run the command w, and that will write. Now, of course, I should be clear, unless you know what you're doing, don't, I'm deleting everything that's on this hard drive. There's nothing on this hard drive, but just be careful if you have partitions you might be deleting or something like that. Okay, so now I've written the changes here. So now, oops, ls, it's so hard not having control l. lsblk, I now have this new partition. What I'm going to do now is I'm going to copy over, I'm going to copy over this other partition to our new partition. And I'm going to use, the program I'm going to use for that is dd, disk destroyer, not actually what it stands for, but you just got to be careful around this program because if you don't know what you're doing, if you type the wrong thing, you might be deleting stuff you didn't intend to. So how dd works is you basically, it's for copying drives to other drives or copying directories to ISO files or vice versa. And how it usually works is you give it an input file and my input file is going to be the hard drive that I'm going to be copying. Okay, so I'm going to be copying devsda1. Okay, so I'm going to give it that partition and OF, that's output file. I'm going to give devsdc1 and this is our new partition. And of course this is a blank partition, there's nothing on it. Notice I haven't even made a file system. Actually, you know what, maybe, let's talk about that first. Before I run this dd command, you don't have to do this if you're running dd, but if you just want to make a file system, you probably know you are going to want to run makefs.extf, or ext4 and then run it on the partition you want the file system on. You don't have to do this if you're using dd, dd will move the file system over for you, but that's just a little note. Notice if you're confused, why can't I copy files over to my new partition? Because you need a file system on it, but anyway, dd gives you this automatically. So anyway, our input file again is our partition up here that we're copying and we are going to copy it to devsdc1 and I'm also going to say status equals progress. And I'm going to run this command, I'll go ahead, just double check to see everything looks good and I'm going to run this command. And this is going to take a little bit of time because it's copying over something like, I guess, 15 gigabytes of data. I mean, it's a 30 gigabyte partition, but around 15 gigabytes actually had stuff in there. In the meantime, I want to answer a brief, or respond to a brief thing that people brought up in the other video. And that is in the other video when I was installing my M-SATA SSD in this computer, a lot of people said, you got to be careful with M-SATAs on ThinkPad X220s because they only have a SATA 2 connection whereas the normal hard drive has a SATA 3 connection and that can run a lot faster. So you might not want to have your operating system on the SATA 2 connection even though that's exactly what I'm doing here. And I want to be clear, yes, that is true but when you really look at it, like SATA 2 connections, they max out, I think, at around like 3 gigabits per second whereas SATA 3s max out at around 6 gigabits per second, I think that's how it works. And the thing is, although that will make a difference, like it's going to make a difference right now when I'm transferring a whole lot of data. Actually, frankly, I don't even know if it will because there are other things that might bottleneck your speeds. But to be honest, you can look at the benchmarks, the differences between the SATA 2 connection and SATA 3 connection, they are immaterial, okay? If for normal use, unless you have hyperpowered equipment that is actually moving terabytes and terabytes of data, it's not going to make a lick of difference. It's not going to change your start speeds. It's not going to even change most of your transfer speeds. Like the cap is so much higher than the data you'll actually be transferring. It's not going to make a big difference. It might make a difference when I'm moving all these files right now. I don't even think it does. I don't know if the math works out. I mean, it's 64 megs per second. But yeah, a lot of people, that dispute a lot. I guess that concern, it's just not a big deal. I guarantee you, again, look at the benchmarks. There are benchmarks out there. It doesn't make a difference. Anyway, I'm going to stop the video right now and wait so you don't have to wait to the end of this if we're not talking about something educational and we'll continue our journey. All right, so it looks like it's about done. Now, there are a couple more things we need to do here. So first again, let's run LSBLK. And here's the thing. It looks like, so we still have our partition and it's the same size. But one weird thing that's going to happen, if you start trying to copy over, let's say you try and copy over 50 more gigabytes of data into this partition, something weird is going to happen. It's going to say there's no space on this drive. That's because there's a sense in which it is also copied over some information about the partition. Specifically, it's sort of this new partition that we've moved over. It thinks it's only 30 gigabytes. So we actually want to tell it to be resized. So the thing we're going to do now is we're going to run resize, what is it? Resize to FS. And we're going to run it on that drive that we just copied everything to, devsdc1. Okay. Oh yeah, you've got to, sorry. You've got to run e2 first. I always forget this on the drive and this will just take a second. But then, yes, fix, yes, fix. Okay. Now we can resize it. And I don't actually know how, okay, yeah. I think that's all you have to do. I feel like I was expecting it to be really long. So now with this command resize to FS, we have now told it, you're not really just 30 gigabytes. You're actually 238 gigabytes, 0.5. Okay. So that's one thing we need to do. Another thing we need to do, and this might actually, I don't actually know if you rebooted your computer right now, I think you might have some kind of error or kernel panic. I don't know because here's why. Okay. Run LSBLK but run it with the F option and look at this. So F actually lists out some more stuff including your UUIDs from all of your drives. Now UUIDs, you know, I'm not exactly sure what UUID stands for. I don't know, some kind of unique ID or something like that. I don't know what the other U stands for. Who cares? Who cares? But the important thing is every partition has to have a different UUID. When you create a file system, it's going to just create this random thing that you expect never to see in any other partition. But since we used DD to copy over this entire partition to a new thing, it actually has the same UUID. And that's going to cause problems because when your computer boots, it's going to be looking for a particular UUID. I don't exactly know what it's going to do. It might just pick whichever one it finds first. I'm not going to reboot my computer and find out we got to fix this little issue. Okay. And how you do that is with the tune to FS command. And with that, you can basically, you can look at the options actually. It allows you to do some different stuff, but the thing that we care about is the capital U option, which I don't see here. It's probably right in front of... Oh, yeah, yeah. You can change your UUID here. So what we do, again, we're working on SDC1. So we're going to say tune FS, tune to FS, capital U, and then say random. You could actually give it an actual UUID you want it to have, but that's frankly a bad idea unless you're doing something programmatic. Just say random and then say dev SDC1. Okay. Now, if you do that, say yes to continue. I don't think this should take very long. All right. So now, actually, we'll just run LSVLK with the F option. And we now see, although the UUID used to be the same as this one, it was starting with 59. It now starts with 94. Okay. Great. That's perfect. Except for it isn't perfectly perfect. Okay. So we're just getting closer. We're always getting closer. So here's the deal. Now we have our installation pretty much moved over to this partition. We could reboot, but it's not actually going to boot from this thing. There are a couple more things we have to change. Specifically, I'm actually going to mount this partition, SDC1. I'm going to mount it to MNT. Okay. So now we can actually look and see just to validate that all the stuff is supposed to be there. We can look in there and see, look at all those directories. That's probably a Linux file system. So yeah, that's what we want to see. If you saw nothing there, that would be a problem because you had some trouble copying stuff over. So now what we're going to want to do is we have to change a couple things in this file directory because it has boot information that is looking, it is looking for this partition, this UUID, and we want to change the times it mentions that to this. Okay. So I'm actually going to do something, this will probably actually be required in a minute, but I am going to run the command Rtools cheroot. I'm going to use a change root environment right now. Now Rtools cheroot, this is only going to be on the Artix Linux. For Arch Linux, it's going to be R cheroot, whatever it is. You remember in the Arch Linux installation process, basically what the cheroot command is or change root command is, is you give it a directory and you're going to jump into a shell at that directory if there is another Linux installation there. So that's what we want to do. Now on Artix, let's see, what was it? Yeah. So on Artix Linux, you're going to want to install Rtools base. That's the thing that gives you this command. On Arch, I forget what it is. I think it's like Arch install scripts. You can probably look it up. You're a big boy. You know how to do it. So I am going to run Rtools cheroot on mount. And I'm also going to say bash. I'm going to tell it to run bash just because otherwise it'll drop you into just a POSIX shell that isn't very interactive. All right. So here we are. And we are now print working directory. Actually, let's look at LSBLK from here. We are now inside of that new installation that we just moved over. And if we run LSBLK in here, it won't actually, nothing else is mounted in its opinion, right? So anyway, we are now in our new installation. So there are a couple things we need to change. One of them is sort of the thing I talked about earlier. That is FSTab. Okay. So again, in FSTab, I'm using NeoVim. I forget. We need to change this UUID, which is the root device, to our new root device UUID. So I'm going to go out of this and again I'm going to run LSBLK with F option. Why does that not show up? Why is it not giving the UUID? I'm not quite sure. I'm going to run it on this machine. That must be some weird incompatibility with the change root environment. So I'm going to copy the UUID from our new partition and I'm going to go into that FSTab file and I'm going to paste that in. Okay. So I've pasted it in. Be sure that you're doing it in the, what was I saying, in the new install, not the old one. You don't need to change that. Wait, why am I? That's not the one I need to change. It's this one I need to change. Silly me. See, when you're talking at the camera, sometimes you forget stuff. Okay. So I'm going to get rid of this. So now it is equal to this new UUID. Everything else I'm going to keep exactly the same. That should work for now. So I'm going to save that. Additionally, if we're in this environment, there are a couple other things we need to change. One of them is our grub installation. We want to reinstall grub and we want to recreate a grub config. And the reason why is if you look in your grub config on this new installation, you can look for UUID and you will see that it's using this old UUID and it's used a couple times, like here as well. So we're going to want to do two things. First off, let's install grub. Actually, just to be clear, you want to run grub install on devsdc. Do not run it on devsdc1. And I should also say this is going to be different if you're using a UEFI device. You'll have to do some things that are run a slightly different command. You can look it up on the ArchWiki, but in my case, since I'm using legacy boot, I'm just going to be running it on devsdc, not devsdc1. I'm just going to run that. Hopefully there will be no error reported. And then I'm going to say grub makeconfig and that is going to remake that config that I just opened that had the wrong UUIDs. Okay, so grub, yeah, make our config. And that'll take just one second. Warning, who cares about that error message. And then just to double check, let's look at that grub config. Let's look at our UUID. Oh, look at that. Our UUID now begins with 94. It's our new root. Okay, so now what I'm, here's what I'm going to do. I'm going to exit out of all of this. I'm now going to restart my computer and here's what I expect to see. Actually, let me go ahead and unmount that drive just because why not? Here's what I expect to see. I expect to see this will not be mounted anymore because we're not going to be booting off of this system. We're going to be booting off of this one. This is going to be mounted to root. This is not going to be mounted. And then the other stuff should be basically the same because we're using an FS tab that is looking for those directories. So now our file systems or UUIDs, whatever. Okay, so now I'm going to reboot and let's hope it works. All right, I'm back and everything looks exactly the same, but that's what we expect. Let's see if it's worked. Look at that. So now our root is actually our new installation. We could actually delete our old installation on this wimpy 30 gigabyte drive or 30 gigabyte partition. It doesn't even matter. We could do a lot of different things with it. So now we're basically there. I do want to be totally clear. On some of your computers, you might need to, in the BIOS settings, manually say, okay, start from my MSata driver, whichever drive you're moving to, you want to boot from that. Obviously not your own. Because it might be that your BIOS is going to be looking for this, some way to boot off this drive before it gets to this. You just want to make sure that it has, the drive you want has priority. Okay, so anyway. So now we have that. Now I'm going to start moving over the things that I want. So as I mentioned before, so I have a copy of the Monero blockchain and I want to move it over to, I want to move it over to like this. It's currently on my home partition taking up 30 gigabytes of space. I want to move it to this place because now there's so much room. I think where I'm going to move it, I'm going to become root here. I think I'm going to move it to user share and then bit Monero or something like that. And notice its location now is local share bit Monero. User share I think is usually where you have like files and directories that multiple people will be using and stuff like that. And theoretically the Monero blockchain if I had other users on this computer, which I don't, but theoretically that would be the place to put it. So that's where I'm going to move it. And that of course is part of the root file system now on this new partition. So let's go ahead and move that. So I'm going to say move, actually let's be conservative here. Let's say, no, let's not be conservative. Let's just copy over. Let's, or move it over. So I'm going to move bit Monero to user share. Bit Monero. I don't think it'll make a difference, but I'll give it the V option so we can see the stuff that's happening. Just want to make sure that everything's good there. So this will take a little bit of time. I don't know. I mean, it's actually going to take a good bit of time because it's 30 gigabytes. So I might have to, yeah, I'll stop the video here and I'll come back in a second. As well, this is loading. Maybe I should tell you what Monero is. So Monero in case you don't know, in case you're a boomer. Monero is a cryptocurrency. So there's a lot of misunderstandings about cryptocurrencies. Like there's this idea that, oh, because they're used by like, I don't know, drug dealers and stuff that they're all secret. You know, cryptocurrencies, like block, excuse me, blockchain. Bitcoin, for example, you can look up on the blockchain all the transactions that have ever occurred on Bitcoin. It's not like, just because it's called crypto, that doesn't mean it's like hidden in any way. Like every transaction on Bitcoin is public. You don't necessarily have names attached to the addresses, but if someone has their public address out there, you can pretty easily figure out who's transferring and stuff like that. Monero is very cleverly made, but Monero is like the one cryptocurrency that you cannot monitor and it's very nice because of that and other reasons. Look at that. I spilled water all over my shirt. Sorry, the Chad Guzzle. I can't help myself. All right, so anyway, that has copied over. So there are a couple of things I want to do. Firstly, let's just look at that. Actually, what are the permissions of this directory? Did it copy over permissions? Okay, yeah, it still belongs to Luke. So I don't need administrative permissions to make changes to it. I am going to, this is not necessarily germane to my video, but you notice that I was looking at this alias that's MD since, you know, I don't like having things in my home directory, so of course I moved everything to local share or somewhere where I don't have to, you know, LSA and see all the junk. I'm actually going to change this. I'm going to change this alias here. So now that it is no longer home share, blah, blah, blah, it's now user share. You know what? Is it actually pronounced the user? I never really thought about it. I've never heard something like, I know it's a total new friend thing to pronounce this as et cetera, or something like that. It's Etsy, kids. It's Etsy. But I never really thought about USR. Is that, will it pronounce that user? Am I stupid for not knowing that? Okay, so now we've moved over that kind of stuff. I think I might end the video here, but I'll tell you the kind of stuff that I might do in another video because it's more of a specific thing. I may have mentioned that I'm thinking about getting rid of this here partition. You notice that, you know, I don't really encrypt many of my partitions. I'm not a big fan of encryption. I'm not too worried that my hard drive is going to get stolen or something like that, and I frankly don't have that much sensitive stuff. I don't have that much sensitive stuff on my computer, to be honest. But I think in another video, I will turn this partition into an encrypted partition, and I'll probably put my mail and maybe some other stuff in there. And I think I said at the beginning of the video, or maybe I did, I might start, I might have like the Ethereum blockchain offline and stuff like that. So other recommendations, let me just give some recommendations. I alluded to this earlier, let's say you don't have much storage space on your machine, and you want to be able to, you know, have a hard drive that has a whole bunch of stuff, like maybe your movies and music and stuff like this, but you get confused of like, oh, where should I have it mounted? Or what kind of stuff should I do with it there? It doesn't really matter where you mount stuff. Now, I mentioned before, I mount this drive to media. In any Unix Linux file system, it doesn't really matter because it's so easy to make symbolic links from places. As I said, I have links in my video directory that link directly to there. And in fact, in many respects, it's better to use links for multiple reasons. One of them being if I accidentally delete my home directory, it actually is not going to delete this stuff. It's going to delete the links. It's not going to delete the actual files. So it's actually sort of nice if you have one thing I sort of recommend to people, if you just have like a big external drive or a big extra hard drive you want to attach to your computer, if you just have directories in there that's like, you know, music, movies, email, whatever else, and then link those to more sensible locations, that is probably the best thing you can possibly do because a lot of people will do weird stuff where they take a drive and partition it into like 20 different folders and then they manually mount it in FSTab. Don't do that. That is too complicated. What you really want to do is you want to mount it to one place. Don't make more partitions than you need to and then link it to the places you think that normal people will expect to see them. That's definitely what I recommend. So anyway, that's about it. I might do that video on encrypting a hard drive and mounting it and stuff like that soon and I'll see you guys next time.