sean finney on 29 Feb 2012 16:24:51 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] VI without a swapfile?


On Mon, Feb 27, 2012 at 08:02:53PM -0500, Jeff Bailey wrote:
> Without getting into all the gory details, I have a loopback
> filesystem mounted (a file containing a filesystem) which is
> considered 100% full (according to "df").

Depending on what exactly you're doing, you may not be able to
do anything from within the filesystem.  I.e. the loopback may be
implicitly read-only depending on filesystem type, the source file
for the loopback device, etc.

That said...

> I need to edit a file on that mount.  "vi" complains about not being
> able to create a swapfile, but allows me to edit.  The problem is
> that I can't save an edited version, even if all I do is delete
> lines.  I think this stems from the fact that vi tries to save a
> backup copy, and fails since there's no room.

have you tried ":set noswapfile" ?  I have an old .vimrc hack from mct
for editing gpg-encrypted files that uses this option.

> I've done some googling (and will do more), but does anyone know
> anything about preventing vi from creating a duplicate file (editing
> in place, or whatever you want to call it).

If in doubt, copy/edit the file elsewhere and then copy it back into
place.  If the filesystem is indeed not implicitly readonly and is in
fact just "full", then you should be able to unlink/replace the file
with the new copy (cp -f or cp --remove-destination for example).

if the loopback filesystem is has "reserved" blocks, and is really really
full then you may need to either lower this reserved amount or copy in
the file as root.  This is a situation where "cat newfile > existingfile"
might fail (i.e. it will happily let you truncat the file, but still
insist it's out of space).


	sean
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug