Date: Tue, 02 Oct 2007 16:14:22 +0100 From: Alex Zbyslaw <xfb52@dial.pipex.com> To: zszalbot@gmail.com Cc: freebsd-questions@freebsd.org Subject: Re: determing space in the / partition Message-ID: <4702604E.1000902@dial.pipex.com> In-Reply-To: <20071002135603.GA72834@wjv.com> References: <20071002120014.83D1516A47F@hub.freebsd.org> <20071002135603.GA72834@wjv.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Bill Vermillion wrote: >Think about it a moment. You you mount you have 'mount point' >that is typically directed to the fs that you have mounted there. >If nothing is mounted the mount point will get all the data. > Zbigniew, it sounds like your script is just dumping to what it assumes is a mounted USB drive. Ideally, you would get your script to check if that drive is actually mounted, to avoid this happening in the future. One way to do that is to check if the "device" associated with the /usb (or whatever you called it) subdirectory is different from the "device" for /. When the USB is mounted they will be different and you can see the device using stat(1). E.g. if I try on my system with / and /usr (separate mountpoints) I get: (cartman)133% /usr/bin/stat -f "%d" / 1072 (cartman)134% /usr/bin/stat -f "%d" /usr 1075 But /boot (on same partition as /) gives the same answer as for / (cartman)135% /usr/bin/stat -f "%d" /boot 1072 So compare your "device" for your backup directory with / and if they are the same then cancel the backup with an error "USB disk not mounted" (If it's a perl script use perl stat which does the same; most scripting languages should give you access to this information). --Alex
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4702604E.1000902>