out of space on /root

Simos Xenitellis simos.lists at googlemail.com
Mon Mar 6 10:57:25 UTC 2017


On Mon, Mar 6, 2017 at 8:53 AM, Xen <list at xenhideout.nl> wrote:
> Bob schreef op 06-03-2017 7:33:
>>
>> Using Ubuntu 16.10.  The system ran out of space on /root.  I found that
>> /var/log/syslog was 27gb in size.  I deleted all the syslog.* files and
>> got the
>> system sort of working and copied /var/log/syslog to my home directory
>> (/home
>> is on a different partition than /root).  I then deleted the syslog file
>> and
>> rebooted.  Now things are working OK.  I would like to find out what
>> caused
>> this problem but can not look at the syslog file as it is too large.  Any
>> ideas
>> on how to display this file?
>
>
> In general commands such as:
>
> cat "file" | tail -n 500
>
> will get you the last 500 lines.

Preferably, you can write straight ahead

tail -100 /var/log/syslog

What does it do?

1. "tail" shows the last "n" lines of a text file.
2. "-100" and "-n 100" are equivalent, both show the last 100 lines.
Substitute with any other number.
3. I think it is more performant not to start with "cat" because "cat"
would go reading through all the file
before "tail" will be able to prune all but the last 100 lines.
Perhaps "tail" has some optimizations to ignore reading the majority
of the 27GB syslog,
so it is better to to just "tail".

Simos

>
> You can make that 500 figure as large as you want.
>
> Maybe with a file so large a better command would be
>
> tail -n 500 "file" so that tail can do random seeks, but I'm not sure.
>
>
> The above command will read the entire file from disk before tail will
> filter out the last 500 lines.
>
> What you can easily do is to use the "split" command to first reduce it into
> smaller bits.
>
> The idiomatic expression:
>
>
> cat "file" | split -b 500M
>
> would do the trick, although again, you can better directly name a file:
>
>
> split -b 500M "filename".
>
> Both should work (tail and split with a direct filename). If you use split,
> you will need the same amount of space you are already using.
>
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-users




More information about the ubuntu-users mailing list