LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 07-17-2018, 10:29 PM   #1
sysmicuser
Member
 
Registered: Mar 2010
Posts: 458

Rep: Reputation: 0
resize2fs gives error for decimal value


Hi Guys,

Need your guidance to understand why I am getting an error for resize2fs command.

Code:
[root@localhost ~]# resize2fs $(cat /etc/fstab |grep "/home"|awk '{print $1}') 2.4G
resize2fs 1.41.12 (17-May-2010)
resize2fs: Invalid new size: 2.4G
The original size of /home was 2.9GB. I want to resize it to be 2.4GB so I can use 500MB for swap space.

When I did with just 2GB it worked fine! why not for 2.4GB then?

Code:
[root@localhost ~]# resize2fs $(cat /etc/fstab |grep "/home"|awk '{print $1}') 2G
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/mapper/vg_localhost-lv_home to 524288 (4k) blocks.
The filesystem on /dev/mapper/vg_localhost-lv_home is now 524288 blocks long.
Please find the evidence below which indicates the size of /home was 2.9GB

Code:
 df -h /home
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_localhost-lv_home
                      2.9G  7.8M  2.7G   1% /home
Your assistance is much appreciated.

Thank you very much.
 
Old 07-17-2018, 11:53 PM   #2
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,763

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
Although it doesn't explicitly say so in the man page, I suspect the size parameter needs to be an integer.

Two thoughts: set one of the -d debug-flags to see what's happening
or
use megabytes instead of gigabites: 2400M (I think that's the same as 2.4G)

see
Code:
man resize2fs
 
Old 07-17-2018, 11:58 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,161

Rep: Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125
Maybe the devs had better things to concentrate on.
Surely you can figure out how to supply an integral parameter.
 
Old 07-18-2018, 12:04 AM   #4
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,763

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
Quote:
Originally Posted by syg00 View Post
Maybe the devs had better things to concentrate on.
I hear that! Executing code to resize partitions is scary enough...I can't imagine writing it
 
Old 07-18-2018, 12:56 AM   #5
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
The size must be in cylinders. The program takes the numerical value and converts it to the nearest whole number of cylinders. One cylinder is 512 B/Sector x 64 sectors/track x 255 heads = 8,355,840 Bytes. 4k/sector drives use a different geometry, and GPT uses still a different geometry. The bottom line is, when you specify a certain size for a filesystem, it never is exactly that size.
 
Old 07-18-2018, 01:09 AM   #6
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,763

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
Quote:
Originally Posted by AwesomeMachine View Post
The size must be in cylinders. The program takes the numerical value and converts it to the nearest whole number of cylinders. One cylinder is 512 B/Sector x 64 sectors/track x 255 heads = 8,355,840 Bytes. 4k/sector drives use a different geometry, and GPT uses still a different geometry. The bottom line is, when you specify a certain size for a filesystem, it never is exactly that size.
Without disagreeing with what you say about calculating cylinders, I don't agree that the size used in the command must be in cylinders...man page says:
Code:
       The  size  parameter  specifies the requested new size of the filesystem.  If no units are specified, the units of the size parameter shall be the
       filesystem blocksize of the filesystem.  Optionally, the size parameter may be suffixed by one of the following the units designators:  's',  'K',
       'M', or 'G', for 512 byte sectors, kilobytes, megabytes, or gigabytes, respectively.  The size of the filesystem may never be larger than the size
       of the partition.  If size parameter is not specified, it will default to the size of the partition.
 
1 members found this post helpful.
  


Reply



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] resize2fs - yum install error pshlinuxq Linux - Newbie 22 02-20-2018 02:41 PM
[SOLVED] decimal constant is so large that it is unsigned error? Shahid nx Linux - Newbie 13 04-17-2013 09:31 AM
decimal constant is so large that it is unsigned error? Shahid nx Linux - Newbie 3 04-17-2013 02:22 AM
[SOLVED] BC provides incorrect decimal results, but only on the last two decimal places... standard_output Linux - Newbie 4 06-27-2012 05:30 PM
Receiving an error when using resize2fs on /tmp Jenny2 Linux - Newbie 2 12-09-2009 09:45 AM

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

All times are GMT -5. The time now is 12:06 PM.

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
Open Source Consulting | Domain Registration