Episode: 1228 Title: HPR1228: Utilizing Maximum Space on a Cloned BTRFS Partition Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr1228/hpr1228.mp3 Transcribed: 2025-10-17 21:59:15 --- Howdy folks, this is 5150 for Hacker Public Radio and I'm just jumping in here real quick for, forget everything to describe the project that has taken the last three hours of my life. And I'm doing this without a script so I'm just going to jump in. Here we go. I've had an SSD sitting around for a long time to put in the computer I have in the kitchen. And unlike most people this SSD is actually a little bigger than the spedding drive that it's replacing since you may remember from previous podcasts. The computer I use in the kitchen is a form of point of sale system with only an 80 gig hard drive. So I started out this evening. Well I had some paperwork projects to do and I thought I thought to myself well I'll get this. I'm going to find the clone that drive and then it can be running while I'm doing this other paperwork. Well I do a lot of stuff that way. I get off on stuff I would rather do than the stuff that I ought to be doing. I don't think I'm unique in that respect hardly in this community. So I really can't clone the drive from the running operating system. And I was moving that SSD. Well the first thing I did was edited my flash-et-c-slash-f-stab to comment out the reference to the swap partition because obviously with an SSD being a sold-state drive you can't have all those little constant reads and writes so you don't want to have a swap partition because that's going to increase the likelihood of drive failure. I also looked up at the same time the mounting options that would enable trim on the device. Trim is usually able by default on Windows computers and essentially tries to even out the wear over the entire drive. So instead of writing to the exact same sector all the time it moves your bits and bytes around and then usually an SSD in the firmware will have a reserved amount. Actually your SSD drive is maybe 10-20% larger than advertised. So as memory locations fail they could actually move those sectors around. And I did find out it seems for my group partition is XT4 and my home partition is BTRFS and the only reason I installed butterFS in the first place is I sort of had this idea when I got the system of eventually replacing the spinning drive with an SSD and I got on Linux questions and asked what's the best file system for an SSD and everybody came back well the only weren't Roy supports trim right now is butterFS so go with that. I entrust that for my group partition so I made that the XT4. Turns out now both butterFS and XT4 can support trim and it looks like in the boot at least the F-STAB switch that you want to put on the line for either one is discard but I've article I found from boot I think it's a Debbie and article rather than boot it really strongly suggested not doing that because that's going to that'll slow the drive down if you enable trim and this is not the latest greatest fastest SSD I mean if you find SSDs out on the market yeah you can find them right now like I did for about half the price in dollars of the megabyte so this is a 120 gig 50 dollar drive after the rebate but the new ones out there now for a firmware are probably a little more stable a little faster so you pay your money and you take your chance so right now I'm going to leave trim support disabled okay so the next step jump in there with my clone Zilla CD of course still the original hard drive still on the box and the SSD mounted externally got nice little thing from monoprice one of those little cradles that sits on your desk you just drop in say to drive right in there and sort of hot I'm not sure I'd like to try that hot swapable but it's it's certainly easy enough to plug and unplug and this is first time I've actually tried at riding to a disc mounted that way so I have that going and I got in clone Zilla and there are options I mean there are distant image partition image which I didn't do probably should I mean that's the back up and in image somewhere else then you can do image onto the partition and that way you're not messing with the system with your hard drive in there and I also didn't do what else you're supposed to do is back up the hard drive in the first place because Roy these days the only way to back up a hard drive is to another hard drive of the same or equal volume so I figured long as I didn't get crossed up in and source and target I probably didn't have a very good chance of messing up the data on my original hard drive okay so I started off and I knew I wanted to do partition to partition because if you do disc to disc it'll do all the partitions proportional in other words so if I'm going from an 80 gig hard drive to 120 gig hard drive it's going to just increase the size of my root partition by two thirds and my home partition by two thirds and what my swap partition which I didn't want by two thirds I didn't want that I wanted to create a root partition of approximately the same size actually I should have looked at a little better for start off because my roots 12 gig I've only got root in home and of course swap but my roots 12 gig and I'm I'm using nine of it now so I may think better the later date of not giving myself another couple gig there and then I went from about a 50 gig partition to the rest of the drive which is a little over 100 gig and those swap but I found out that the volume of volume or disc to disc selection that will format the target drive with the new partitions but partition to partition doesn't so in other words if you're going to clone a partition to another partition you've got to set it up that partition up first so I and still going back and operating since I don't you know I want to be I don't want to change anything my existing operating system now that I've started messing with it I could have done it that way instead I but and I've been hit I'll let you know I don't have very good luck making USB boot sticks work that may be another article so I I burned a G-Parted CD put that in there and created all my 12 my 12 gig XT for a boot partition on the new new drive and the XT root partition the XT or so I'm sorry but butter FS home partition for the remainder of the drive and then the rest of the drug and you know no swap so okay went back in clones there no problem okay I'm going to do partition to partition and you know SDA1 to SDB1 and did that and SDA2 to SDB2 and did that so of course you do it you have to go through it twice and you know no problem and I thought I've I've had this trouble before that it wants to clone a partition of the exact same size not so I better check it I so I booted back into the G-Parted and you know sure enough that the root partition was close enough to the same size that it that it worked out but the home partition you look at normally there is the yep when you look at the partition graphically you've got the yellow part that accounts for the use space and the white part that accounts for empty space and then I had a gray part that was like 40% of the desk unusable space or 40% of the partition and there there's a little explanation point on SDB2 so I click on it and it says yeah 40 gig is unutilized but you can fix it by going into from the main G-Parted menu partition and then from the drop down menu check not so much boys and girls because as you may know BTRFS partition still don't support FS check okay so what do we do there is supposedly a BTRFS check command out there I think you'd install that wasn't supported on my G-Parted CD and there's a lot of people saying that might get a little funky out there because it's a it's a brand new command okay so this this is what you do I did try to shrink the volume back to about the original size in G-Parted and of course you rescan and then you then I tried to expand it and then we expanded that gray area unusable was still there so that doesn't gonna work okay but there are bunch of BTRFS command line functions and they were supported in the G-Parted CD I just had to do a little bit of research online to figure out how to use them so the first thing you have to do of course to get out of the graphical G-Parted open or terminal you have to mount the partition that you want to shrink or grow or expand the max size because a lot of examples online what they're actually wanting to do is going from a larger spinning drive to an SSD and they got to shrink everything down to fit so that's the most common so it's but for the BTRFS resize command to work you have to mount the drive at a mount point so you can't just do BTRFS resize options slash dev slash sdb2 that's an on starter so what you do is you know most people are probably going to want to mount something in media so you can make a directory at media even though it's on a CD but you can create that in the file systems and you got to be root so assuming the Debian world sudo space make your space slash media slash BTRFS that's what I called it you call it what you want okay then you know the command is mount to the device and then space then the mount point so sudo mount space slash dev slash sdb2 space slash media slash BTRFS okay now there's various various arguments arguments for size in the BTRFS resize command and if it's bored you can you can look at this just doing a man BTRFS but you can shrink your partition by a certain amount you can expand your partition by a certain amount and it's like you know plus 2g minus 2g etc and you can tell it just I want this big you can go sudo space BTRFS space file system base resize space 10g space slash media slash BTRFS in my case and it it would have shrank or expanded as necessary that partition take up exactly 10 gig what I wanted to do was expand the file system to the maximum size of that partition so I wanted to utilize the entire partition so it's a little bit different case but it sudo space BTRFS space file system space resize space max space slash media slash BTRFS and then execute that and then of course you want to unmount so you you mount space slash devs slash sdb2 or you mount the mount point you mount space slash media slash BTRFS in my case again and then I went back in G parted boom Bob your uncle you know no no gray I just have yellow and a whole bunch of white space so I have I haven't flopped the drives rail and tried to boot yet but it looks like we've got the procedure for fixing the desk after doing a partition to partition copy or clone in clone zilla and it looks like I think you'd have the same problem if it was xt4 or whatever I mean the problem is you're you're going if you're going from a smaller partition to a bigger partition you don't wind up with unusable space in that bigger partition the only difference is FS check will fix it for I gather for any other file system other in BTRFS so if you deal with BTRFS you go do a little more research and really since if I wind up not engaging the trim then I'm not sure going with BTRFS was the best idea I haven't any trouble with it so far but that lack of an SFS check is beginning to be troubling for me so I hope this made sense I hope it someday helped somebody out so that they don't have to spend a lot of time looking stuff up and in any case this has been 5150 for hacker public radio you can find my contact information at thebigredswitch.drupleguardance.com and I'll catch you the next time you have been listening to Hacker Public Radio or Techer Public Radio does our we are a community podcast network that releases shows every weekday Monday through Friday today's show like all our shows was contributed by a HBR listener like yourself if you ever consider recording a podcast then visit our website to find out how easy it really is Hacker Public Radio was founded by the digital dog pound and the infonomicum computer cloud HBR is funded by the binary revolution at binref.com all binref projects are crowd- Exponsored by linear pages from shared hosting to custom private clouds go to lunar pages.com for all your hosting needs. Unless otherwise stasis today's show is released under a creative commons attribution share a line lead us our license