[SOLVED] Simple question: How do I resize my partitions using CLI?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello everyone I would like to resize dev/sda8 to make another partition using the command line, can anyone please tell me how to do this? Thanks in advance!
Last edited by Otherworlds; 02-17-2016 at 07:45 PM.
Hello everyone I would like to resize dev/sda8 to make another partition using the command line, can anyone please tell me how to do this? Thanks in advance! I realize the numbers are sorta crunched up, I apologize it's just how it came it out...facepalm for double post mybad...
Last edited by Otherworlds; 02-17-2016 at 07:47 PM.
Yeah I actually am using parted, but when I press resizepart it asks for partition number? Then when I press 8, as I think that is the partition "/dev/sda8 logical" it then says that partition doesn't exsist??
Last edited by Otherworlds; 02-17-2016 at 07:48 PM.
Hi again a new problem arose when I went to resize /dev/sda8 and rebooted my system, it popped me in emergency mode, is this normal?? I don't understand because I'm pretty sure /dev/sda8 is the bulk of free space that's avaliable on my hard drive.... Do I do something wrong? Luckily it's a virtual machine, but I'm desperately trying to learn how to partition so any help would be appreciated thanks again!!! Another note to add, when I partitioned with resize part using parted I put 50G End...
Last edited by Otherworlds; 02-14-2016 at 09:47 AM.
Distribution: Debian 8 Cinnamon/Xfce/gnome classic Debian live usb
Posts: 508
Rep:
Quote:
Originally Posted by Otherworlds
Hi again a new problem arose when I went to resize /dev/sda8 and rebooted my system, it popped me in emergency mode, is this normal?? I don't understand because I'm pretty sure /dev/sda8 is the bulk of free space that's avaliable on my hard drive.... Do I do something wrong? Luckily it's a virtual machine, but I'm desperately trying to learn how to partition so any help would be appreciated thanks again!!! Another note to add, when I partitioned with resize part using parted I put 50G End...
I always use gparted. It's a gui.
It shows a diagram of your partitions on the disk, their locations and how much space is used up on each partition.
To make changes, you simply click the fields on the gui, input numbers for the sizes etc and then press 'apply'. Really simple to use.
Use 'apt-get install gparted' and have a look through it.
I saw a tutorial on parted and it's way too complicated.
It appears that you made the partition smaller without first resizing the filesystem that was in it. First, you need to use parted again to expand sda8 back to its original size. Then run "fsck -f /dev/sda8" to check the filesystem. That should allow /home to be mounted again.
You cannot shrink a filesystem while it is mounted. It is best to boot your VM from separate media, either the gparted live CD or, my own favorite, SystemRescueCd, which includes gparted and a lot of other useful tools for recovery. Rather than parted, I suggest using gparted, which is really a very different tool (not just a GUI front end for parted) and is capable of resizing a partition and its filesystem at the same time. That's a lot easier than caclulating what size to make a filesystem so that it will fit into its new, smaller partition.
This shows everything you'll ever need to know about gparted: http://www.dedoimedo.com/computers/gparted.html
I'd also endorse the idea of getting SystemRescueCD. For me, having that in the cupboard is as essential as having backups.
This shows everything you'll ever need to know about gparted: http://www.dedoimedo.com/computers/gparted.html
I'd also endorse the idea of getting SystemRescueCD. For me, having that in the cupboard is as essential as having backups.
Just to add my tuppence, I use a bootable USB stick which I created and populate with YUMI - it contains useful software such as Gparted Live, MiniTool Partition Wizard, memtools86+, Boot Repair Disk, Macrium Reflect Free, Darik's Boot & Nuke etc. You can just add these ISOs to the stick as you go along using YUMI, which provides a menu interface at bootup to choose from the various ISOs. A very useful tool indeed.
I should add to my post above that, in case anyone is wondering, I use the Linux software GParted Live for general work and resizing partitions with ext2/3/4 filesystems, while I use the Windows software MiniTools Partition Wizard for resizing partitions with NTFS filesystems. I know that theoretically both programs should cope with both sorts of filesystem, but I've had a much better success rate doing it that way.
I'm really trying to just stick to the command line because I don't want a GPU enabled... I would use gparted as long as it doesn't require a GUI (correct me if I'm wrong, but I don't think I can use a GUI without a graphics card) I think rknichols already hinted it doesn't require a GUI, but for reassurance could I get some more feedback on this, thank you..
Distribution: Debian 8 Cinnamon/Xfce/gnome classic Debian live usb
Posts: 508
Rep:
Quote:
Originally Posted by hydrurga
Just to add my tuppence, I use a bootable USB stick which I created and populate with YUMI - it contains useful software such as Gparted Live, MiniTool Partition Wizard, memtools86+, Boot Repair Disk, Macrium Reflect Free, Darik's Boot & Nuke etc. You can just add these ISOs to the stick as you go along using YUMI, which provides a menu interface at bootup to choose from the various ISOs. A very useful tool indeed.
On the Yumi bootloader, can you add a DVD copy of a Debian.iso?
If so, then I could select the .iso file and it would run the launcher to install an OS on my hard disk.
On the Yumi bootloader, can you add a DVD copy of a Debian.iso?
If so, then I could select the .iso file and it would run the launcher to install an OS on my hard disk.
Debian Live is supported (although I also use a number of unsupported ISOs that work fine so don't shy away if your specific ISO is "unsupported").
@Otherworlds: Hoping you get resolution to your problem. You should be able to do everything you wanted to do with parted and resizefs but I'm not au-fait enough with those tools (yet) to advise you.
To be extra safe, you should first boot off a live cd/dvd/usb stick containing a partition backup program (I use Macrium Reflect Free because I come originally from a Windows background and that's what I'm used to) and backup any partitions that you are going to play with. In fact, backing up the whole disk, if possible, is a good idea.
gparteddoes require a GUI. Sorry, wasn't aware you had no graphics card.
To do this without a GUI, first restore the original partition size and run "fsck -f /dev/sda8" to ensure the filesystem is OK.
Next, resize the filesytem to something a bit less than the target 50GB size:
Code:
resize2fs /dev/sda8 45G
Use parted or other partitioning tool to resize the partition to 50G.
Run "fsck -f /dev/sda8" again to make sure the filesystem is still within the partition.
Finally, run "resize2fs /dev/sda8" (without a size argument) to expand the filesystem to fill its 50GB partition.
You'll need to do all this while /home is unmounted. You cannot shrink a mounted filesystem. The multiple resize2fs operations are recommended because it is difficult to calculate the size to make the filesystem so that it will fill its new partition exactly. There is too much roundoff, discrepancy between GB and GiB, etc., and what you need is an exact number.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.