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

I created a swap file with root on a running server, using swapfile creation guides which I found on the net (http://blog.serverbuddies.com/adding-additional-swap-space-to-your-linux-server/m Create swap file on a running Linux machine, and http://www.cyberciti.biz/faq/linux-add-a-swap-file-howto/)

I made sure that I have plenty of disk space

df -h

showed

[root@host /]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/md2             1016G  338G  628G  35% /
/dev/md1              496M  116M  356M  25% /boot
/dev/md3              1.7T  169G  1.5T  11% /home

, and after issuing the command

dd if=/dev/zero of=/swapfile bs=1024 count=8290304

The putty terminal became unresponsive, and the server became unresponsive as well (apache and other services crashed, network connections were closed). So, I executed a hardware reset, and everything is back and working fine. I can see the /swapfile with a zero size, and /var/log/messages has no info on this event. Is it safe to delete that file and reattempt creating it? Also why would a server crash at all with a dd command? I had no swap file prior to this config attempt.

UPDATE: Based on symcbean's answer I run the command again with success! The load did go up to 20 while dd was running, so that may have caused issues the last time...

[root@host /]# dd if=/dev/zero of=/swapfile1 bs=1024 count=8290304
8290304+0 records in
8290304+0 records out
8489271296 bytes (8.5 GB) copied, 135.989 s, 62.4 MB/s
share|improve this question
1  
Show us the output of df -H. –  Iain Apr 8 '13 at 8:45
    
Thx, added the info –  giorgio79 Apr 8 '13 at 8:57
1  
why not use mkswap command instead. –  Drt Apr 8 '13 at 9:32
    
Good call. All the guides I found used dd :D –  giorgio79 Apr 8 '13 at 14:23

1 Answer 1

up vote 1 down vote accepted

Short answer is that writing the swapfile should not have caused the symptoms you describe even if all the space was used up.

There may be something in your logs describing what happenned here. Running an fsck against your root partition might be a good idea.

share|improve this answer
    
Ok thx. I attempted again. This time with success. I did notice the load went up to 20 during the time dd was running, so that may have been an issue the last time. –  giorgio79 Apr 8 '13 at 9:10

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.