struct stat statbuf;
int ret = ::stat(tmp, &tatbuf);
ASSERT_NE(ret, -1);
// statbuf.st_size - virtual size in bytes
// statbuf.st_blocks - physical size in 512-byte blocks
So if st_blocks * 512 < st.size then you definitely have a sparse file.
Wednesday, 7 March 2012
Programmatically find out if a file is sparse
You can work out if a file is sparse using stat (or fstat etc).
Sunday, 10 July 2011
ISO format for clock applet in Ubuntu 11.04
To configure Ubuntu Unity clock indicator applet to ISO format %Y-%M-%D
From: http://sysadmin.wikia.com/wiki/Ubuntu
From: http://sysadmin.wikia.com/wiki/Ubuntu
gsettings set com.canonical.indicator.datetime custom-time-format "'%F %H:%M'"
gsettings set com.canonical.indicator.datetime time-format "'custom'"
Sunday, 24 April 2011
Compiling MosaicCK on Ubuntu 10.10
While I was trying to build /Mosaic-CK I had to add various libraries for Ubuntu 10.10 that might be non-obvious:
For Ubuntu 11.04 add:
sudo aptitude install libx11-dev libmotif-dev libpng-dev \
libjpeg-dev libxt-dev x11proto-print-dev libxprintutil-dev \
libxprintapputil-dev libxcb-xprint0-dev libprinterconf-dev \
libxpm-dev
For Ubuntu 11.04 add:
libxmu-dev
Wednesday, 15 December 2010
Open Source Digital Forensics
http://www2.opensourceforensics.org/home
Looks like it would be a good resource for anyone needing to rescue a machine or investigate one.
Looks like it would be a good resource for anyone needing to rescue a machine or investigate one.
Friday, 19 November 2010
cgroups per tty on Ubuntu 10.04
I had some problems following http://www.webupd8.org/2010/11/alternative-to-200-lines-kernel-patch.html on Ubuntu 10.04, even following the Ubuntu instructions.
With similar changes to the /usr/local/sbin/cgroup_clean and .bashrc files.
I think the problem is that cgroup was already mounted at /cgroups with default options, and that refused to allow a second mount, or allow non-root users to write to it.
So I altered the mount in fstab from 'defaults' to 'cpu', and make the /etc/rc.local script just do the subdir creation:
mkdir -m 0777 /cgroup/user
echo "/usr/local/sbin/cgroup_clean" > /cgroup/release_agentWith similar changes to the /usr/local/sbin/cgroup_clean and .bashrc files.
Friday, 23 April 2010
Memory Info
How to find out physical memory information:
Windows
Use cpu-z from http://www.cpuid.com/cpuz.php
Linux
Windows
Use cpu-z from http://www.cpuid.com/cpuz.php
Linux
Use:
dmidecode | grep -1 DIMM
From http://fixunix.com/hardware/262119-how-get-physical-dimm-count-under-linux.html
Subscribe to:
Posts (Atom)