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 12-01-2009, 11:45 AM   #1
persistentd
LQ Newbie
 
Registered: Nov 2009
Posts: 3

Rep: Reputation: 0
E297: Write error in swap file


I am trying to do a simple edit using vi on a large .sh file 818532 in size. I have loads of swap so I can't understand why I get the write error.

Swap 4192956K total, 2270396k used and 1922560k free

Am I missing something obvious.

Smaller files can be edited without any problems.

The OS is Linux Redhat 5

I assume it's a space issue as the temp .swp file that is generated is 1051811840 but this seems far bigger that the original file?

Is there another way to edit a large file as this just doesn't seem logical :-(

Last edited by persistentd; 12-01-2009 at 11:58 AM. Reason: Extra information provided
 
Old 12-01-2009, 12:27 PM   #2
ShadowCat8
Member
 
Registered: Nov 2004
Location: San Bernardino, CA
Distribution: Gentoo, Arch, (RedHat4.x-9.x, FedoraCore 1.x-4.x, Debian Potato-Sarge, LFS 6.0, etc.)
Posts: 261

Rep: Reputation: 52
Quote:
Originally Posted by persistentd View Post
I am trying to do a simple edit using vi on a large .sh file 818532 in size. I have loads of swap so I can't understand why I get the write error.

Swap 4192956K total, 2270396k used and 1922560k free

Am I missing something obvious.

Smaller file can be edited without any problems.

The OS is Linux Redhat 5
Okay, a couple of things.
  1. What is the exact error output you are getting?
  2. Do you have any filesystem quotas in place?
  3. What is the output of 'df'?
  4. What are the permissions on the directory that contains the file you are editing?
  5. Are you sure of the version of Red Hat? Are you running RHEL5?

It sounds like you might be filling up a partition when trying to edit the file. I have been able to edit up to 250MB files in vi in the past. You just have to make sure that the filesystem you do the edit within has the space to write another copy of the file, like vi does when it creates it's ./.<filename>.swp file.

The reason for question #5 is because Red Hat Linux 5 hasn't been directly available for years (though I still have one of the old boxes with CDs in my closet) and was last updated on 16-Apr-1999. Red Hat's Enterprise Linux 5 is a fairly recent distro release, originally released in 14-Mar-2007, with update3 released in January of this year. Just trying to cut down the possible confusion.

[NOTE: It seems you edited the post as I was writing this as your current post has much more than what I have above, which I got from clicking 'Quote'. From what I see, I am not sure your original number was correct. Are you sure the original .sh file is just shy of 800KB? I can't see vi going to over 1GB for an 800KB file. 800MB, maybe?]

If you have the desktop up, you can try editing the file in gedit.

Last edited by ShadowCat8; 12-01-2009 at 12:48 PM. Reason: Respondihng to the added question.
 
Old 12-01-2009, 01:40 PM   #3
persistentd
LQ Newbie
 
Registered: Nov 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks, yes it looks like I am filling up the partition.

error is 0297 error writing to swap

The df output shows

/dev/sda5 1.9G for size 820Mb used 1019Mb available 45% used

no quotas that I am aware of

perms of directory are dwxr-xr-w so I can write to the folder.

The original file is 821638013 and the only file in the folder.

The version of RedHat Enterprise Linux cat /proc/version shows Redhat 4.1.2-42 uname gives me 2.6.18-92.1.22.e15

I was wondering if I should temporarily amend the .rc file for vim so I don't use all the space, but this doesn't sound like the best thing to do.

How much free space do you think I need, is there a rough rule of thumb, eg file size time 2 ?

I suppose the easiest solution is to find somewhere with a couple of gb os free space and then it should just work.
 
Old 12-01-2009, 03:21 PM   #4
persistentd
LQ Newbie
 
Registered: Nov 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Thankyou for the help.

I managed to find an area with about 30gb free and I was able to change the file. It took about 5 mins to save and the swap seemed to be about 1.5 times the orginal file size.
 
Old 12-01-2009, 05:00 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,285

Rep: Reputation: 4165Reputation: 4165Reputation: 4165Reputation: 4165Reputation: 4165Reputation: 4165Reputation: 4165Reputation: 4165Reputation: 4165Reputation: 4165Reputation: 4165
What about just using sed instead if it's a simple edit ?.
 
  


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
E297: Write error in swap file kumarrbt Linux - General 3 08-25-2014 11:52 PM
Write-error on swap-device error on package install slack 12.2 chickenlinux Slackware 11 01-25-2009 09:14 PM
VIM E514 & E297 Write Error hollie2119 Linux - General 1 02-01-2007 03:58 PM
Getting the error "E297 : Write error in swap file " sudhir_gunda Linux - General 3 12-29-2003 09:07 AM
"E297: Write error in swap file" :-( sudhir_gunda Linux From Scratch 2 12-29-2003 02:41 AM

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

All times are GMT -5. The time now is 10:25 AM.

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
Open Source Consulting | Domain Registration