LinuxQuestions.org
Visit Jeremy's Blog.
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, 11:29 PM   #1
sysmicuser
Member
 
Registered: Mar 2010
Posts: 423

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-18-2018, 12:53 AM   #2
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.7.1908
Posts: 4,274

Rep: Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495
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-18-2018, 12:58 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,409

Rep: Reputation: 3056Reputation: 3056Reputation: 3056Reputation: 3056Reputation: 3056Reputation: 3056Reputation: 3056Reputation: 3056Reputation: 3056Reputation: 3056Reputation: 3056
Maybe the devs had better things to concentrate on.
Surely you can figure out how to supply an integral parameter.
 
Old 07-18-2018, 01:04 AM   #4
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.7.1908
Posts: 4,274

Rep: Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495
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, 01:56 AM   #5
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,511

Rep: Reputation: 1006Reputation: 1006Reputation: 1006Reputation: 1006Reputation: 1006Reputation: 1006Reputation: 1006Reputation: 1006
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, 02:09 AM   #6
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.7.1908
Posts: 4,274

Rep: Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495
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


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

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

All times are GMT -5. The time now is 04:30 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration