Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm working on a computer with very little memory (128MB) - for my application I need to format large drives (4TB)

I'm able to format greater than 2TB disks, up to about 2.5TB, but beyond that I'm given the below

mke2fs 1.42-WIP (16-Oct-2011)
/dev/sda1: Memory allocation failed while setting up superblock

I realize I'm really out there in terms of reasonable - are there any tricks? (block sizes, etc)

any idea how I can get very large disks to format?

share|improve this question
    
Put some more RAM in it. –  Michael Hampton Sep 28 '12 at 0:39

2 Answers 2

Add some swap: http://www.cyberciti.biz/faq/linux-add-a-swap-file-howto/

dd if=/dev/zero of=/swapfile1 bs=1024 count=524288
mkswap /swapfile1
swapon /swapfile1

That'll make 512MB of swap and enable it. You'll need to edit your /etc/fstab to make it stay after a reboot, though.

share|improve this answer

An even better approach would be to use the -D flag. From the man pages:

 Use direct I/O when writing to the  disk.   This  avoids  mke2fs
 dirtying  a  lot  of buffer cache memory, which may impact other
 applications running on a busy server.  This option  will  cause
 mke2fs  to run much more slowly, however, so there is a tradeoff
 to using direct I/O.

Worked for me with an initramfs and 512MB.

share|improve this answer
1  
Better than what? This is unlikely to solve the problem shown in the question. –  Michael Hampton Aug 20 at 23:09
    
This is better than adding swap space. Also, it's better than "Put some more RAM in it." :-) (albeit probably slower) –  Nate Aug 26 at 16:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.