I just returned from tea to find a computer, which I’d left copying a large amount of data (~300GB worth of backups) from one raid arrray to another, displaying a friendly message:
cp: cannot create directory `./cpool/0': No space left on device.
In order to get to this state I’d done the following:
# mdadm --create -n3 -x1 /dev/md2 /dev/sdc1 /dev/sdd1 /dev/sdf1 missing
(several steps to setup lvm on and format the new device)
# cd /var/lib/backuppc
(some more steps, including adding the new mountpoint to /etc/fstab)
# mount .
# cp -a /mnt/oldbackuppc/pool ./pool
# cp -a /mnt/oldbackuppc/cpool ./cpool
In case you’ve not spotted it, after `mount`ing ‘.’ I needed to `chdir .` to get onto the new mount. As it was I was still on the device that /var is on (~40G) not my nice new 1.8TB raid device!
lamby | 27-Apr-09 at 10:20 pm | Permalink
Not sure if it will render properly here, but I have:
if [ "$(stat . -c %i 2>/dev/null)" != "$(stat "$(pwd)" -c %i) 2>/dev/null" ] \
&& ! cd “$(pwd)” >/dev/null 2>&1
then
echo “W: pwd does not exist anymore”
return 1
fi
in my {bash,zsh}rc to fix this for me.