diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/FileSize.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/FileSize.java
index 08e6b9e..f1fb0b2 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/FileSize.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/FileSize.java
@@ -35,20 +35,22 @@ public final class FileSize {
     private static final long KB = 1024;
     private static final long MB = KB * KB;
     private static final long GB = KB * MB;
+    private static final long TB = KB * GB;
+    private static final long PB = KB * TB;
 
     /**
      * Pattern for string parsing.
      */
     private static final Pattern VALUE_PATTERN =
-        Pattern.compile("([0-9]+([\\.,][0-9]+)?)\\s*(|K|M|G)B?", Pattern.CASE_INSENSITIVE);
+        Pattern.compile("([0-9]+([\\.,][0-9]+)?)\\s*(|K|M|G|T|P)i?B?", Pattern.CASE_INSENSITIVE);
 
     private FileSize() {
     }
 
     /**
      * Converts a string to a number of bytes. Strings consist of a floating point value followed by
-     * K, M, or G for kilobytes, megabytes, gigabytes, respectively. The
-     * abbreviations KB, MB, and GB are also accepted. Matching is case insensitive.
+     * K, M, G, T, or P for kilobytes, megabytes, gigabytes, terabytes, petabytes respectively. The
+     * abbreviations KB, MB, GB, TB, or PB are also accepted. Matching is case insensitive.
      *
      * @param string The string to convert
      * @return The Bytes value for the string
@@ -60,20 +62,24 @@ public final class FileSize {
         if (matcher.matches()) {
             try {
                 // Get double precision value
-                final long value = NumberFormat.getNumberInstance(Locale.getDefault()).parse(
-                    matcher.group(1)).longValue();
+                final double value = NumberFormat.getNumberInstance(Locale.getDefault()).parse(
+                    matcher.group(1)).doubleValue();
 
                 // Get units specified
                 final String units = matcher.group(3);
 
                 if (units.isEmpty()) {
-                    return value;
+                    return Math.round(value);
                 } else if (units.equalsIgnoreCase("K")) {
-                    return value * KB;
+                    return Math.round(value * KB);
                 } else if (units.equalsIgnoreCase("M")) {
-                    return value * MB;
+                    return Math.round(value * MB);
                 } else if (units.equalsIgnoreCase("G")) {
-                    return value * GB;
+                    return Math.round(value * GB);
+                } else if (units.equalsIgnoreCase("T")) {
+                    return Math.round(value * TB);
+                } else if (units.equalsIgnoreCase("P")) {
+                    return Math.round(value * PB);
                 } else {
                     LOGGER.error("FileSize units not recognized: " + string);
                     return defaultValue;
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/OptionConverter.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/OptionConverter.java
index aad31be..582f556 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/OptionConverter.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/OptionConverter.java
@@ -35,7 +35,7 @@ public final class OptionConverter {
     private static final char DELIM_STOP = '}';
     private static final int DELIM_START_LEN = 2;
     private static final int DELIM_STOP_LEN = 1;
-    private static final int ONE_K = 1024;
+    private static final long ONE_K = 1024L;
 
     /**
      * OptionConverter is a static class.
@@ -166,21 +166,27 @@ public final class OptionConverter {
         }
 
         String str = value.trim().toUpperCase(Locale.ENGLISH);
-        long multiplier = 1;
+        long multiplier = 1L;
         int index;
 
-        if ((index = str.indexOf("KB")) != -1) {
+        if ((index = str.indexOf("K")) != -1) {
             multiplier = ONE_K;
             str = str.substring(0, index);
-        } else if ((index = str.indexOf("MB")) != -1) {
+        } else if ((index = str.indexOf("M")) != -1) {
             multiplier = ONE_K * ONE_K;
             str = str.substring(0, index);
-        } else if ((index = str.indexOf("GB")) != -1) {
+        } else if ((index = str.indexOf("G")) != -1) {
             multiplier = ONE_K * ONE_K * ONE_K;
             str = str.substring(0, index);
+        } else if ((index = str.indexOf("T")) != -1) {
+            multiplier = ONE_K * ONE_K * ONE_K * ONE_K;
+            str = str.substring(0, index);
+        } else if ((index = str.indexOf("P")) != -1) {
+            multiplier = ONE_K * ONE_K * ONE_K * ONE_K * ONE_K;
+            str = str.substring(0, index);
         }
         try {
-            return Long.parseLong(str) * multiplier;
+            return Math.round(Double.parseDouble(str)*multiplier);
         } catch (final NumberFormatException e) {
             LOGGER.error("[{}] is not in proper int form.", str);
             LOGGER.error("[{}] not in expected format.", value, e);
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FileSizeTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FileSizeTest.java
index 4b7b6bb..be3ddb5 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FileSizeTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FileSizeTest.java
@@ -32,5 +32,9 @@ public class FileSizeTest {
         assertTrue("unexpected value " + value, value == EXPECTED);
         value = FileSize.parse("10 KB", 0);
         assertTrue("unexpected value " + value, value == EXPECTED);
+        value = FileSize.parse("10.3KB", 0);
+        assertTrue("unexpected value " + value, value == Math.round(10.3*1024L));
+        value = FileSize.parse("10TB", 0);
+        assertTrue("unexpected value " + value, value == 10l*1024*1024*1024*1024);
     }
 }
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/util/OptionConverterTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/util/OptionConverterTest.java
new file mode 100644
index 0000000..94e0e59
--- /dev/null
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/util/OptionConverterTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.core.util;
+
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class OptionConverterTest {
+    private final static long EXPECTED = 10 * 1024;
+    @Test
+    public void testFileSize() throws Exception {
+
+        long value = OptionConverter.toFileSize("10KB", 0);
+        assertTrue("unexpected value " + value, value == EXPECTED);
+        value = OptionConverter.toFileSize("10 KB", 0);
+        assertTrue("unexpected value " + value, value == EXPECTED);
+        value = OptionConverter.toFileSize("10.3KB", 0);
+        assertTrue("unexpected value " + value, value == Math.round(10.3*1024L));
+        value = OptionConverter.toFileSize("10TB", 0);
+        assertTrue("unexpected value " + value, value == 10l*1024*1024*1024*1024);
+    }
+}
