LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 02-14-2016, 02:25 PM   #16
Otherworlds
Member
 
Registered: Feb 2016
Posts: 49

Original Poster
Rep: Reputation: Disabled

OK thanks I'll try that sounds like it should work, thanks alot everyone!
 
Old 02-15-2016, 05:28 AM   #17
Otherworlds
Member
 
Registered: Feb 2016
Posts: 49

Original Poster
Rep: Reputation: Disabled
So i tried what rknichols said, and I ran into a few more errors. First I purposely this time went into recovery mode in order to umount /home.. I started with a fresh VM install btw... Then I typed resize2fs /dev/sda8 to 45G (target size is still 50G) Then the system told me "please run e2fsck -f /dev/sda8 first" Then I did that and ran again resize2fs /dev/sda8 45G and it went through this time.. Then I went into parted keeping default /dev/sda selected, and ran resizepart 8 50GEnd partition (/dev/sda8 is the filesystem I want to shrink in order to make a separate new partition) and pressed q to save.. The system then told me "You may need to update /etc/fstab" I then typed mount -a (I read this command updates /etc/fstab without having to reboot) When I entered mount -a it gave me this output "[918.317270] EXT4-fs (sda8) : mounted filesystem with ordered data mode. Optsnull)" I think so far so good. I then ran fsck -f /dev/sda8 and got this error "/dev/sda8 is mounted. e2fsck:cannot continue, aborting" I then ran the resize2fs /dev/sda8 command.. Despite the fsck error I'm pretty sure it did shrink the /dev/sda8 size. I say I THINK because at the time of writing THIS specific sentence I made a new VM with a 20G target size, and forgot to look at the previous size... I'll have to try it again, but I think it worked. Assuming it worked, where did the rest of the memory go?? Would it be under type primary,logical or extended?

Last edited by Otherworlds; 02-15-2016 at 07:51 AM.
 
Old 02-15-2016, 07:56 AM   #18
Otherworlds
Member
 
Registered: Feb 2016
Posts: 49

Original Poster
Rep: Reputation: Disabled
UPDATE:Ok I found where free space is located by typing print free in parted... And I did have success in the test stated in the previous post, however I'm having a hard time repeating the process successfully...Do the Parted End size and first resize2fs command need more rounding,like are they shaky variables?? Should I give both the End and resize2fs more space to improve chances of not corrupting?

Last edited by Otherworlds; 02-15-2016 at 08:03 AM.
 
Old 02-15-2016, 09:15 AM   #19
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 3,580

Rep: Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566
First, "mount -a" does not update /etc/fstab. Wherever you read that was either wrong or you misunderstood what you read. But, there was no change to /etc/fstab needed -- that's just a generic reminder from parted any time you make a partitioning change. What "mount -a" does is to mount any of /etc/fstab's automount partitions (those that do not have a "noauto" option) that are not currently mounted. That mounted /dev/sda8 on /home, so your subsequent fsck refused to run. That wasn't really necessary anyway; it's just a check to make sure all is well at that point. Since the ext4 filesystem allows online expansion, your resize2fs succeeded even with the filesystem mounted.

Without knowing exactly what you did and what errors you encountered when you were "having a hard time repeating the process successfully", it's difficult to say what you were doing wrong.

Last edited by rknichols; 02-15-2016 at 09:17 AM. Reason: verb tense
 
Old 02-15-2016, 11:32 AM   #20
DavidMcCann
Senior Member
 
Registered: Jul 2006
Location: London
Distribution: CentOS, Salix
Posts: 4,674

Rep: Reputation: 1485Reputation: 1485Reputation: 1485Reputation: 1485Reputation: 1485Reputation: 1485Reputation: 1485Reputation: 1485Reputation: 1485Reputation: 1485
Quote:
Originally Posted by Otherworlds View Post
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..
You don't need a graphics card for a GUI: if the computer can draw characters, it can draw pictures. On this aged machine, the graphics is handled by the northbridge chip on the motherboard. Your subsequent adventures are precisely why I'd never dare to use the CLI for something as complex as handling partitions!
 
Old 02-15-2016, 11:55 AM   #21
Otherworlds
Member
 
Registered: Feb 2016
Posts: 49

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rknichols View Post
First, "mount -a" does not update /etc/fstab. Wherever you read that was either wrong or you misunderstood what you read. But, there was no change to /etc/fstab needed -- that's just a generic reminder from parted any time you make a partitioning change. What "mount -a" does is to mount any of /etc/fstab's automount partitions (those that do not have a "noauto" option) that are not currently mounted. That mounted /dev/sda8 on /home, so your subsequent fsck refused to run. That wasn't really necessary anyway; it's just a check to make sure all is well at that point. Since the ext4 filesystem allows online expansion, your resize2fs succeeded even with the filesystem mounted.

Without knowing exactly what you did and what errors you encountered when you were "having a hard time repeating the process successfully", it's difficult to say what you were doing wrong.
Thank you for replying, I made like 20VM's already trying to do this, but in last 15 VM's I been only allocated 100GB to my VM'S. That gave my /dev/sda8 partition a size of 81G and Available 77G.. I ran commands e2fsck -f /dev/sda8, as it tells me to do before I can run resize2fs /dev/sda8 45G (still using a target of 50G).Then I go in parted and resizepart 8 50G, q to save... So far so good no errors at all... After I run fsck -f /dev/sda8 I get error "reading block 10518528 (invalid argument). Ignore error <y>?" I press y to ignore then "Force rewrite <y>?" I press y then "Superblock has an invalid journal (inode 8). Clear <y>?" I press again then "*** ext3 journal has been deleted - filesystem is now ext2 only *** Superblock has_journal flag is clear, but a journal is present. Clear <y>?" I press y " The filesystem size (according to the superblock) is 11796480 blocks. The physical size of the device is 7595191 blocks. Either the superblock or the partition table is likely to be corrupt ! Abort <y>?" I press y again "Error writing block 10518528 (Invalid argument). Ignore error <y>?" I press y and then "dev/sda8: **** FILE SYSTEM WAS MODIFIED ****"
Root@host:~#

I have no idea where to go from here, I'll dive into it reading dmesgs and blocks if I have to, but I hoping for a simple fix, thanks if u can help if not thanks anyway!

Last edited by Otherworlds; 02-15-2016 at 11:57 AM.
 
Old 02-15-2016, 11:59 AM   #22
Otherworlds
Member
 
Registered: Feb 2016
Posts: 49

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by DavidMcCann View Post
You don't need a graphics card for a GUI: if the computer can draw characters, it can draw pictures. On this aged machine, the graphics is handled by the northbridge chip on the motherboard. Your subsequent adventures are precisely why I'd never dare to use the CLI for something as complex as handling partitions!
May I ask what partitioning tool you use?
 
Old 02-15-2016, 05:24 PM   #23
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 3,580

Rep: Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566
Quote:
Originally Posted by Otherworlds View Post
The physical size of the device is 7595191 blocks.
That works out to about 31GB at a block size of 4096. Looks like you reduced the partition size by 50GB instead of resizeing it to 50GB. What does "parted -l" say after the resize?

Note the the second argument to resizepart is the ending location on the disk, not the partition size.

Last edited by rknichols; 02-15-2016 at 05:49 PM. Reason: Add: "Note that ..."
 
Old 02-15-2016, 05:38 PM   #24
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 3,580

Rep: Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566
Quote:
Originally Posted by DavidMcCann View Post
You don't need a graphics card for a GUI: if the computer can draw characters, it can draw pictures.
gparted requires a graphics server.
 
Old 02-15-2016, 06:09 PM   #25
linuxteen
LQ Newbie
 
Registered: Feb 2016
Distribution: PclinuxOS 64bit && Crux linux 3.2 in a VM
Posts: 12

Rep: Reputation: Disabled
@ Otherworlds

Slightly off topic

Using LVM makes resizing partitions or logical volumes easier using the CLI. Extending the size is straight forward. Shrinking is a little more trickier, butt doable.

Just a though in case you want to give LVM a try in the future perhaps in a virtual machine.

Youtube has many videos on LVM usage.
 
Old 02-16-2016, 11:30 AM   #26
DavidMcCann
Senior Member
 
Registered: Jul 2006
Location: London
Distribution: CentOS, Salix
Posts: 4,674

Rep: Reputation: 1485Reputation: 1485Reputation: 1485Reputation: 1485Reputation: 1485Reputation: 1485Reputation: 1485Reputation: 1485Reputation: 1485Reputation: 1485
Quote:
Originally Posted by rknichols View Post
gparted requires a graphics server.
That doesn't mean it needs a graphics card. As I said, this computer uses old-fashioned motherboard graphics, provided by the northbridge chip, and that is adequate for anything but video games. I was using gparted only last week, to re-format a new usb stick to ext2.
 
Old 02-16-2016, 11:43 AM   #27
rokytnji
LQ 5k Club
 
Registered: Mar 2008
Location: Waaaaay out West Texas
Distribution: AntiX 17 , ChromeOS
Posts: 5,197
Blog Entries: 20

Rep: Reputation: 2462Reputation: 2462Reputation: 2462Reputation: 2462Reputation: 2462Reputation: 2462Reputation: 2462Reputation: 2462Reputation: 2462Reputation: 2462Reputation: 2462
Fits on a floppy and works on old kits. It evens renames partitions from primary to logical.

http://partitionlogic.org.uk/

I am not advertising. This floppy has bailed me out in certain situations.
If no floppy drive. It will run off a cd.
 
Old 02-16-2016, 12:02 PM   #28
Otherworlds
Member
 
Registered: Feb 2016
Posts: 49

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rknichols View Post
That works out to about 31GB at a block size of 4096. Looks like you reduced the partition size by 50GB instead of resizeing it to 50GB. What does "parted -l" say after the resize?

Note the the second argument to resizepart is the ending location on the disk, not the partition size.
When I type parted -l after the parted resizepart 8 45G command,(the first post I made is not relevant anymore btw as its a old install with a different size) it gave number 8 a start of 18.9gB, End 50gB,and a size of 31.1gB... Before I used Parted it was a start of 18.9gB, End 107gB, and size 88.5gB...

Last edited by Otherworlds; 02-16-2016 at 12:14 PM.
 
Old 02-16-2016, 12:15 PM   #29
Otherworlds
Member
 
Registered: Feb 2016
Posts: 49

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by linuxteen View Post
@ Otherworlds

Slightly off topic

Using LVM makes resizing partitions or logical volumes easier using the CLI. Extending the size is straight forward. Shrinking is a little more trickier, butt doable.

Just a though in case you want to give LVM a try in the future perhaps in a virtual machine.

Youtube has many videos on LVM usage.
I'll keep that in mind, thank you
 
Old 02-16-2016, 12:59 PM   #30
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 3,580

Rep: Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566
Quote:
Originally Posted by Otherworlds View Post
When I type parted -l after the parted resizepart 8 45G command,(the first post I made is not relevant anymore btw as its a old install with a different size) it gave number 8 a start of 18.9gB, End 50gB,and a size of 31.1gB
A size of 31.1 GB is not sufficient to hold a 45GB filesysem. If the start is at 18.9GB, the end needs to be 68.9GB to give you a 50GB partition.

If the fsck after that resize indicates any problem at all, you did something wrong and should restore the previous partitioning. Really, that fsck should be run with the "-n" option so that fsck will not attempt to "fix" anything, which will only cause unrecoverable damage to whatever data was on the filesystem.

Last edited by rknichols; 02-16-2016 at 01:03 PM. Reason: Add fsck warning
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Is it safe to resize my Slackware partitions after removing my Mint 10 partitions? Robert.Thompson Slackware 19 02-18-2011 12:47 PM
How to resize image in CLI with keeping palette and type as original ts4053 Linux - Software 1 01-05-2010 09:35 AM
[SOLVED] Very simple CLI question togo59 Linux - Newbie 7 12-14-2009 12:29 PM
simple CLI question about size of HD? Lleb_KCir Linux - General 4 06-10-2004 10:00 PM
Simple Newb Question: How do I check what version of Redhat is Installed from the CLI praefex Linux - General 1 01-27-2004 08:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration