create file of particular size in python
up vote
27
down vote
favorite
I want to create a file of particular size (say, 1GiB).
The content is not important since I will fill stuff into it.
What I am doing is:
f = open("E:\sample", "wb")
size = 1073741824 # bytes in 1 GiB
f.write("" * size)
But this takes too long to finish. It spends me roughly 1 minute.
What can be done to improve this?
python file
|
show 4 more comments
up vote
27
down vote
favorite
I want to create a file of particular size (say, 1GiB).
The content is not important since I will fill stuff into it.
What I am doing is:
f = open("E:\sample", "wb")
size = 1073741824 # bytes in 1 GiB
f.write("" * size)
But this takes too long to finish. It spends me roughly 1 minute.
What can be done to improve this?
python file
4
1073741824 bytes != 1GB. Use an SSD instead of a mechanical HDD? Write to local disk rather than a network share?
– Johnsyweb
Jan 11 '12 at 8:17
3
@Johnsyweb why? isn't that1024 * 1024 * 1024
?
– onemach
Jan 11 '12 at 9:05
2
@onemach 1 GB = 10^9 B. 1 GiB = 2^30 B.
– glglgl
Jan 11 '12 at 9:38
2
xkcd - Kilobyte
– Imran
Jan 11 '12 at 16:47
2
@glglgl: Given how few people use gibibyte as a term, possibly due to how ridiculous it sounds (including many file system displays that summarize using base-2 GB instead of base-10 GB), getting pedantic about GiB is just that: Being pedantic. Hard drive manufacturers use base-10 to advertise larger sizes; almost no one else does.
– ShadowRanger
Oct 30 '15 at 17:14
|
show 4 more comments
up vote
27
down vote
favorite
up vote
27
down vote
favorite
I want to create a file of particular size (say, 1GiB).
The content is not important since I will fill stuff into it.
What I am doing is:
f = open("E:\sample", "wb")
size = 1073741824 # bytes in 1 GiB
f.write("" * size)
But this takes too long to finish. It spends me roughly 1 minute.
What can be done to improve this?
python file
I want to create a file of particular size (say, 1GiB).
The content is not important since I will fill stuff into it.
What I am doing is:
f = open("E:\sample", "wb")
size = 1073741824 # bytes in 1 GiB
f.write("" * size)
But this takes too long to finish. It spends me roughly 1 minute.
What can be done to improve this?
python file
python file
edited Jan 11 '12 at 13:49
glglgl
64.9k788163
64.9k788163
asked Jan 11 '12 at 8:09
onemach
2,26532746
2,26532746
4
1073741824 bytes != 1GB. Use an SSD instead of a mechanical HDD? Write to local disk rather than a network share?
– Johnsyweb
Jan 11 '12 at 8:17
3
@Johnsyweb why? isn't that1024 * 1024 * 1024
?
– onemach
Jan 11 '12 at 9:05
2
@onemach 1 GB = 10^9 B. 1 GiB = 2^30 B.
– glglgl
Jan 11 '12 at 9:38
2
xkcd - Kilobyte
– Imran
Jan 11 '12 at 16:47
2
@glglgl: Given how few people use gibibyte as a term, possibly due to how ridiculous it sounds (including many file system displays that summarize using base-2 GB instead of base-10 GB), getting pedantic about GiB is just that: Being pedantic. Hard drive manufacturers use base-10 to advertise larger sizes; almost no one else does.
– ShadowRanger
Oct 30 '15 at 17:14
|
show 4 more comments
4
1073741824 bytes != 1GB. Use an SSD instead of a mechanical HDD? Write to local disk rather than a network share?
– Johnsyweb
Jan 11 '12 at 8:17
3
@Johnsyweb why? isn't that1024 * 1024 * 1024
?
– onemach
Jan 11 '12 at 9:05
2
@onemach 1 GB = 10^9 B. 1 GiB = 2^30 B.
– glglgl
Jan 11 '12 at 9:38
2
xkcd - Kilobyte
– Imran
Jan 11 '12 at 16:47
2
@glglgl: Given how few people use gibibyte as a term, possibly due to how ridiculous it sounds (including many file system displays that summarize using base-2 GB instead of base-10 GB), getting pedantic about GiB is just that: Being pedantic. Hard drive manufacturers use base-10 to advertise larger sizes; almost no one else does.
– ShadowRanger
Oct 30 '15 at 17:14
4
4
1073741824 bytes != 1GB. Use an SSD instead of a mechanical HDD? Write to local disk rather than a network share?
– Johnsyweb
Jan 11 '12 at 8:17
1073741824 bytes != 1GB. Use an SSD instead of a mechanical HDD? Write to local disk rather than a network share?
– Johnsyweb
Jan 11 '12 at 8:17
3
3
@Johnsyweb why? isn't that
1024 * 1024 * 1024
?– onemach
Jan 11 '12 at 9:05
@Johnsyweb why? isn't that
1024 * 1024 * 1024
?– onemach
Jan 11 '12 at 9:05
2
2
@onemach 1 GB = 10^9 B. 1 GiB = 2^30 B.
– glglgl
Jan 11 '12 at 9:38
@onemach 1 GB = 10^9 B. 1 GiB = 2^30 B.
– glglgl
Jan 11 '12 at 9:38
2
2
xkcd - Kilobyte
– Imran
Jan 11 '12 at 16:47
xkcd - Kilobyte
– Imran
Jan 11 '12 at 16:47
2
2
@glglgl: Given how few people use gibibyte as a term, possibly due to how ridiculous it sounds (including many file system displays that summarize using base-2 GB instead of base-10 GB), getting pedantic about GiB is just that: Being pedantic. Hard drive manufacturers use base-10 to advertise larger sizes; almost no one else does.
– ShadowRanger
Oct 30 '15 at 17:14
@glglgl: Given how few people use gibibyte as a term, possibly due to how ridiculous it sounds (including many file system displays that summarize using base-2 GB instead of base-10 GB), getting pedantic about GiB is just that: Being pedantic. Hard drive manufacturers use base-10 to advertise larger sizes; almost no one else does.
– ShadowRanger
Oct 30 '15 at 17:14
|
show 4 more comments
3 Answers
3
active
oldest
votes
up vote
34
down vote
accepted
WARNING This solution gives the result that you might not expect. See UPD ...
1 Create new file.
2 seek to size-1 byte.
3 write 1 byte.
4 profit :)
f = open('newfile',"wb")
f.seek(1073741824-1)
f.write(b"")
f.close()
import os
os.stat("newfile").st_size
1073741824
UPD:
Seek and truncate both create sparse files on my system (Linux + ReiserFS). They have size as needed but don't consume space on storage device in fact. So this can not be proper solution for fast space allocation. I have just created 100Gib file having only 25Gib free and still have 25Gib free in result.
Minor Update:
Added b
prefix to f.write("")
for Py3 compatibility.
cool, works fine
– onemach
Jan 11 '12 at 13:02
If your system supports it, thetruncate()
solution might - strictly seen - be better, as this solution here consumes 1 allocation block for this file although it would not be necessary.
– glglgl
Jan 11 '12 at 13:50
2
Doesn't that generate a sparse file, though? (This may be what was needed, but it's not quite the same)
– Arafangion
Jan 11 '12 at 13:51
6
In python 3 it'sf.write(b"")
– qed
May 30 '14 at 14:32
Works on MacOS High Sierra from a file size enumeration point of view, even though it doesn't affect the overall system size. Great for writing tests for large files, which is exactly what I'm doing :)
– brandonscript
Feb 8 at 16:49
add a comment |
up vote
23
down vote
The question has been answered before. Not sure whether the solution is cross platform, but it works in Windows (NTFS file system) flawlessly.
with open("file.to.create", "wb") as out:
out.truncate(1024 * 1024 * 1024)
This answer uses seek
and write
:
with open("file.to.create", "wb") as out:
out.seek((1024 * 1024 * 1024) - 1)
out.write('')
7
Docs: Note that if a specified size exceeds the file’s current size, the result is platform-dependent: possibilities include that the file may remain unchanged, increase to the specified size as if zero-filled, or increase to the specified size with undefined new content.
– Janne Karila
Jan 11 '12 at 8:38
@JanneKarila In this casefile.to.create
is an empty file, so the specified size will always exceed the file's current size?
– qed
May 30 '14 at 14:34
@qed Yes it will.
– Janne Karila
May 30 '14 at 15:36
add a comment |
up vote
0
down vote
As Arafangion user mentions in his comment, the answers provided so far generate sparse files. To generate a non-sparse file in python (which actually takes up the desired disk space) I use the following code from this other answer:
import os
file_name = 'test_file'
file_size = 1024 # size in bytes
with open(file_name, "wb") as f:
f.write(os.urandom(file_size))
To check if a file is sparse in Linux is use commands ls -lhs
and du -h <filename>
, compare first column of ls -lhs
with output of du -h
and if different the file is sparse:
$ ls -lhs
185548 -rw-r--r-- 1 root root 181.2M Nov 6 22:23 test
$du -h test
182M test
In the example above test
is a sparse file.
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
34
down vote
accepted
WARNING This solution gives the result that you might not expect. See UPD ...
1 Create new file.
2 seek to size-1 byte.
3 write 1 byte.
4 profit :)
f = open('newfile',"wb")
f.seek(1073741824-1)
f.write(b"")
f.close()
import os
os.stat("newfile").st_size
1073741824
UPD:
Seek and truncate both create sparse files on my system (Linux + ReiserFS). They have size as needed but don't consume space on storage device in fact. So this can not be proper solution for fast space allocation. I have just created 100Gib file having only 25Gib free and still have 25Gib free in result.
Minor Update:
Added b
prefix to f.write("")
for Py3 compatibility.
cool, works fine
– onemach
Jan 11 '12 at 13:02
If your system supports it, thetruncate()
solution might - strictly seen - be better, as this solution here consumes 1 allocation block for this file although it would not be necessary.
– glglgl
Jan 11 '12 at 13:50
2
Doesn't that generate a sparse file, though? (This may be what was needed, but it's not quite the same)
– Arafangion
Jan 11 '12 at 13:51
6
In python 3 it'sf.write(b"")
– qed
May 30 '14 at 14:32
Works on MacOS High Sierra from a file size enumeration point of view, even though it doesn't affect the overall system size. Great for writing tests for large files, which is exactly what I'm doing :)
– brandonscript
Feb 8 at 16:49
add a comment |
up vote
34
down vote
accepted
WARNING This solution gives the result that you might not expect. See UPD ...
1 Create new file.
2 seek to size-1 byte.
3 write 1 byte.
4 profit :)
f = open('newfile',"wb")
f.seek(1073741824-1)
f.write(b"")
f.close()
import os
os.stat("newfile").st_size
1073741824
UPD:
Seek and truncate both create sparse files on my system (Linux + ReiserFS). They have size as needed but don't consume space on storage device in fact. So this can not be proper solution for fast space allocation. I have just created 100Gib file having only 25Gib free and still have 25Gib free in result.
Minor Update:
Added b
prefix to f.write("")
for Py3 compatibility.
cool, works fine
– onemach
Jan 11 '12 at 13:02
If your system supports it, thetruncate()
solution might - strictly seen - be better, as this solution here consumes 1 allocation block for this file although it would not be necessary.
– glglgl
Jan 11 '12 at 13:50
2
Doesn't that generate a sparse file, though? (This may be what was needed, but it's not quite the same)
– Arafangion
Jan 11 '12 at 13:51
6
In python 3 it'sf.write(b"")
– qed
May 30 '14 at 14:32
Works on MacOS High Sierra from a file size enumeration point of view, even though it doesn't affect the overall system size. Great for writing tests for large files, which is exactly what I'm doing :)
– brandonscript
Feb 8 at 16:49
add a comment |
up vote
34
down vote
accepted
up vote
34
down vote
accepted
WARNING This solution gives the result that you might not expect. See UPD ...
1 Create new file.
2 seek to size-1 byte.
3 write 1 byte.
4 profit :)
f = open('newfile',"wb")
f.seek(1073741824-1)
f.write(b"")
f.close()
import os
os.stat("newfile").st_size
1073741824
UPD:
Seek and truncate both create sparse files on my system (Linux + ReiserFS). They have size as needed but don't consume space on storage device in fact. So this can not be proper solution for fast space allocation. I have just created 100Gib file having only 25Gib free and still have 25Gib free in result.
Minor Update:
Added b
prefix to f.write("")
for Py3 compatibility.
WARNING This solution gives the result that you might not expect. See UPD ...
1 Create new file.
2 seek to size-1 byte.
3 write 1 byte.
4 profit :)
f = open('newfile',"wb")
f.seek(1073741824-1)
f.write(b"")
f.close()
import os
os.stat("newfile").st_size
1073741824
UPD:
Seek and truncate both create sparse files on my system (Linux + ReiserFS). They have size as needed but don't consume space on storage device in fact. So this can not be proper solution for fast space allocation. I have just created 100Gib file having only 25Gib free and still have 25Gib free in result.
Minor Update:
Added b
prefix to f.write("")
for Py3 compatibility.
edited Jul 26 at 17:07
Community♦
11
11
answered Jan 11 '12 at 8:17
Shamanu4
2,17221927
2,17221927
cool, works fine
– onemach
Jan 11 '12 at 13:02
If your system supports it, thetruncate()
solution might - strictly seen - be better, as this solution here consumes 1 allocation block for this file although it would not be necessary.
– glglgl
Jan 11 '12 at 13:50
2
Doesn't that generate a sparse file, though? (This may be what was needed, but it's not quite the same)
– Arafangion
Jan 11 '12 at 13:51
6
In python 3 it'sf.write(b"")
– qed
May 30 '14 at 14:32
Works on MacOS High Sierra from a file size enumeration point of view, even though it doesn't affect the overall system size. Great for writing tests for large files, which is exactly what I'm doing :)
– brandonscript
Feb 8 at 16:49
add a comment |
cool, works fine
– onemach
Jan 11 '12 at 13:02
If your system supports it, thetruncate()
solution might - strictly seen - be better, as this solution here consumes 1 allocation block for this file although it would not be necessary.
– glglgl
Jan 11 '12 at 13:50
2
Doesn't that generate a sparse file, though? (This may be what was needed, but it's not quite the same)
– Arafangion
Jan 11 '12 at 13:51
6
In python 3 it'sf.write(b"")
– qed
May 30 '14 at 14:32
Works on MacOS High Sierra from a file size enumeration point of view, even though it doesn't affect the overall system size. Great for writing tests for large files, which is exactly what I'm doing :)
– brandonscript
Feb 8 at 16:49
cool, works fine
– onemach
Jan 11 '12 at 13:02
cool, works fine
– onemach
Jan 11 '12 at 13:02
If your system supports it, the
truncate()
solution might - strictly seen - be better, as this solution here consumes 1 allocation block for this file although it would not be necessary.– glglgl
Jan 11 '12 at 13:50
If your system supports it, the
truncate()
solution might - strictly seen - be better, as this solution here consumes 1 allocation block for this file although it would not be necessary.– glglgl
Jan 11 '12 at 13:50
2
2
Doesn't that generate a sparse file, though? (This may be what was needed, but it's not quite the same)
– Arafangion
Jan 11 '12 at 13:51
Doesn't that generate a sparse file, though? (This may be what was needed, but it's not quite the same)
– Arafangion
Jan 11 '12 at 13:51
6
6
In python 3 it's
f.write(b"")
– qed
May 30 '14 at 14:32
In python 3 it's
f.write(b"")
– qed
May 30 '14 at 14:32
Works on MacOS High Sierra from a file size enumeration point of view, even though it doesn't affect the overall system size. Great for writing tests for large files, which is exactly what I'm doing :)
– brandonscript
Feb 8 at 16:49
Works on MacOS High Sierra from a file size enumeration point of view, even though it doesn't affect the overall system size. Great for writing tests for large files, which is exactly what I'm doing :)
– brandonscript
Feb 8 at 16:49
add a comment |
up vote
23
down vote
The question has been answered before. Not sure whether the solution is cross platform, but it works in Windows (NTFS file system) flawlessly.
with open("file.to.create", "wb") as out:
out.truncate(1024 * 1024 * 1024)
This answer uses seek
and write
:
with open("file.to.create", "wb") as out:
out.seek((1024 * 1024 * 1024) - 1)
out.write('')
7
Docs: Note that if a specified size exceeds the file’s current size, the result is platform-dependent: possibilities include that the file may remain unchanged, increase to the specified size as if zero-filled, or increase to the specified size with undefined new content.
– Janne Karila
Jan 11 '12 at 8:38
@JanneKarila In this casefile.to.create
is an empty file, so the specified size will always exceed the file's current size?
– qed
May 30 '14 at 14:34
@qed Yes it will.
– Janne Karila
May 30 '14 at 15:36
add a comment |
up vote
23
down vote
The question has been answered before. Not sure whether the solution is cross platform, but it works in Windows (NTFS file system) flawlessly.
with open("file.to.create", "wb") as out:
out.truncate(1024 * 1024 * 1024)
This answer uses seek
and write
:
with open("file.to.create", "wb") as out:
out.seek((1024 * 1024 * 1024) - 1)
out.write('')
7
Docs: Note that if a specified size exceeds the file’s current size, the result is platform-dependent: possibilities include that the file may remain unchanged, increase to the specified size as if zero-filled, or increase to the specified size with undefined new content.
– Janne Karila
Jan 11 '12 at 8:38
@JanneKarila In this casefile.to.create
is an empty file, so the specified size will always exceed the file's current size?
– qed
May 30 '14 at 14:34
@qed Yes it will.
– Janne Karila
May 30 '14 at 15:36
add a comment |
up vote
23
down vote
up vote
23
down vote
The question has been answered before. Not sure whether the solution is cross platform, but it works in Windows (NTFS file system) flawlessly.
with open("file.to.create", "wb") as out:
out.truncate(1024 * 1024 * 1024)
This answer uses seek
and write
:
with open("file.to.create", "wb") as out:
out.seek((1024 * 1024 * 1024) - 1)
out.write('')
The question has been answered before. Not sure whether the solution is cross platform, but it works in Windows (NTFS file system) flawlessly.
with open("file.to.create", "wb") as out:
out.truncate(1024 * 1024 * 1024)
This answer uses seek
and write
:
with open("file.to.create", "wb") as out:
out.seek((1024 * 1024 * 1024) - 1)
out.write('')
edited May 23 '17 at 12:25
Community♦
11
11
answered Jan 11 '12 at 8:18
Imran
42.9k2085116
42.9k2085116
7
Docs: Note that if a specified size exceeds the file’s current size, the result is platform-dependent: possibilities include that the file may remain unchanged, increase to the specified size as if zero-filled, or increase to the specified size with undefined new content.
– Janne Karila
Jan 11 '12 at 8:38
@JanneKarila In this casefile.to.create
is an empty file, so the specified size will always exceed the file's current size?
– qed
May 30 '14 at 14:34
@qed Yes it will.
– Janne Karila
May 30 '14 at 15:36
add a comment |
7
Docs: Note that if a specified size exceeds the file’s current size, the result is platform-dependent: possibilities include that the file may remain unchanged, increase to the specified size as if zero-filled, or increase to the specified size with undefined new content.
– Janne Karila
Jan 11 '12 at 8:38
@JanneKarila In this casefile.to.create
is an empty file, so the specified size will always exceed the file's current size?
– qed
May 30 '14 at 14:34
@qed Yes it will.
– Janne Karila
May 30 '14 at 15:36
7
7
Docs: Note that if a specified size exceeds the file’s current size, the result is platform-dependent: possibilities include that the file may remain unchanged, increase to the specified size as if zero-filled, or increase to the specified size with undefined new content.
– Janne Karila
Jan 11 '12 at 8:38
Docs: Note that if a specified size exceeds the file’s current size, the result is platform-dependent: possibilities include that the file may remain unchanged, increase to the specified size as if zero-filled, or increase to the specified size with undefined new content.
– Janne Karila
Jan 11 '12 at 8:38
@JanneKarila In this case
file.to.create
is an empty file, so the specified size will always exceed the file's current size?– qed
May 30 '14 at 14:34
@JanneKarila In this case
file.to.create
is an empty file, so the specified size will always exceed the file's current size?– qed
May 30 '14 at 14:34
@qed Yes it will.
– Janne Karila
May 30 '14 at 15:36
@qed Yes it will.
– Janne Karila
May 30 '14 at 15:36
add a comment |
up vote
0
down vote
As Arafangion user mentions in his comment, the answers provided so far generate sparse files. To generate a non-sparse file in python (which actually takes up the desired disk space) I use the following code from this other answer:
import os
file_name = 'test_file'
file_size = 1024 # size in bytes
with open(file_name, "wb") as f:
f.write(os.urandom(file_size))
To check if a file is sparse in Linux is use commands ls -lhs
and du -h <filename>
, compare first column of ls -lhs
with output of du -h
and if different the file is sparse:
$ ls -lhs
185548 -rw-r--r-- 1 root root 181.2M Nov 6 22:23 test
$du -h test
182M test
In the example above test
is a sparse file.
add a comment |
up vote
0
down vote
As Arafangion user mentions in his comment, the answers provided so far generate sparse files. To generate a non-sparse file in python (which actually takes up the desired disk space) I use the following code from this other answer:
import os
file_name = 'test_file'
file_size = 1024 # size in bytes
with open(file_name, "wb") as f:
f.write(os.urandom(file_size))
To check if a file is sparse in Linux is use commands ls -lhs
and du -h <filename>
, compare first column of ls -lhs
with output of du -h
and if different the file is sparse:
$ ls -lhs
185548 -rw-r--r-- 1 root root 181.2M Nov 6 22:23 test
$du -h test
182M test
In the example above test
is a sparse file.
add a comment |
up vote
0
down vote
up vote
0
down vote
As Arafangion user mentions in his comment, the answers provided so far generate sparse files. To generate a non-sparse file in python (which actually takes up the desired disk space) I use the following code from this other answer:
import os
file_name = 'test_file'
file_size = 1024 # size in bytes
with open(file_name, "wb") as f:
f.write(os.urandom(file_size))
To check if a file is sparse in Linux is use commands ls -lhs
and du -h <filename>
, compare first column of ls -lhs
with output of du -h
and if different the file is sparse:
$ ls -lhs
185548 -rw-r--r-- 1 root root 181.2M Nov 6 22:23 test
$du -h test
182M test
In the example above test
is a sparse file.
As Arafangion user mentions in his comment, the answers provided so far generate sparse files. To generate a non-sparse file in python (which actually takes up the desired disk space) I use the following code from this other answer:
import os
file_name = 'test_file'
file_size = 1024 # size in bytes
with open(file_name, "wb") as f:
f.write(os.urandom(file_size))
To check if a file is sparse in Linux is use commands ls -lhs
and du -h <filename>
, compare first column of ls -lhs
with output of du -h
and if different the file is sparse:
$ ls -lhs
185548 -rw-r--r-- 1 root root 181.2M Nov 6 22:23 test
$du -h test
182M test
In the example above test
is a sparse file.
answered Nov 8 at 13:32


dmbarreiro
11
11
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f8816059%2fcreate-file-of-particular-size-in-python%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
4
1073741824 bytes != 1GB. Use an SSD instead of a mechanical HDD? Write to local disk rather than a network share?
– Johnsyweb
Jan 11 '12 at 8:17
3
@Johnsyweb why? isn't that
1024 * 1024 * 1024
?– onemach
Jan 11 '12 at 9:05
2
@onemach 1 GB = 10^9 B. 1 GiB = 2^30 B.
– glglgl
Jan 11 '12 at 9:38
2
xkcd - Kilobyte
– Imran
Jan 11 '12 at 16:47
2
@glglgl: Given how few people use gibibyte as a term, possibly due to how ridiculous it sounds (including many file system displays that summarize using base-2 GB instead of base-10 GB), getting pedantic about GiB is just that: Being pedantic. Hard drive manufacturers use base-10 to advertise larger sizes; almost no one else does.
– ShadowRanger
Oct 30 '15 at 17:14