Mon Mar 11, 2013 9:35 am
$ apt-file search install-mbr
mbr: /sbin/install-mbr
mbr: /usr/share/man/man8/install-mbr.8.gz
Mon Mar 11, 2013 10:23 am
/dev/sdc1
sending incremental file list
./
rsync: failed to set times on "/media/sdc1/.": Operation not permitted (1)
rsync: failed to modify permissions on "/media/sdc1/.": Operation not permitted (1)
README.diskdefines
md5sum.txt
ubuntu
.disk/
rsync: recv_generator: mkdir "/media/sdc1/.disk" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***
casper/
rsync: recv_generator: mkdir "/media/sdc1/casper" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***
preseed/
rsync: recv_generator: mkdir "/media/sdc1/preseed" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***
rsync: mkstemp "/media/sdc1/.README.diskdefines.qidhqU" failed: Permission denied (13)
rsync: mkstemp "/media/sdc1/.md5sum.txt.5XiYOu" failed: Permission denied (13)
rsync: mkstemp "/media/sdc1/.ubuntu.m1AJd5" failed: Permission denied (13)
sent 2073 bytes received 84 bytes 4314.00 bytes/sec
total size is 2801598846 speedup is 1298840.45
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1070) [sender=3.0.9]
sending incremental file list
rsync: mkdir "/media/sdc1/live" failed: Permission denied (13)
rsync error: error in file IO (code 11) at main.c(605) [Receiver=3.0.9]
rsync: connection unexpectedly closed (9 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [sender=3.0.9]
sending incremental file list
syslinux/
rsync: recv_generator: mkdir "/media/sdc1/syslinux" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***
sent 422 bytes received 16 bytes 876.00 bytes/sec
total size is 761831 speedup is 1739.34
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1070) [sender=3.0.9]
Mon Mar 11, 2013 10:38 am
Mon Mar 11, 2013 12:06 pm
Mon Mar 11, 2013 12:51 pm
Mon Mar 11, 2013 1:43 pm
# Show free space on usb device and size of filesystem to copy to it.
check_size () {
device_freespace=$(df -h $usb_mountpoint | awk '/dev/ { print $4 }')
filesystem_size=$(du -sh "$image_mountpoint"| awk '{ print $1 }')
alternate_size=$(ls -lh "$isofile" | awk '{ print $5 }')
TEXT="Device free space should be greater than image size
Device free space:\t\t$device_freespace
Image size:\t\t\t\t$filesystem_size
or maybe:\t\t\t\t$alternate_size
"
$DIALOG --$QUESTION --width=480 --height=220 --title="$TITLE" --${BUTTON0}="Continue"${BUTTON0NUM} --${BUTTON1}="Exit"${BUTTON1NUM} --text="$TEXT"
if [[ $? != 0 ]] ; then
echo " Exiting at check_size"
pumount /dev/${DEVICE}1
if [[ -d $image_mountpoint ]] ; then
fusermount -u "$image_mountpoint"
fi
exit 0
fi
}
Mon Mar 11, 2013 4:25 pm
The commands seem to work properly on the command line, but not in the script.
:~$ du -h "$image_mountpoint"| awk '{print $1}'
185K
159M
4.0K
159M
:~$ du -sh "$image_mountpoint"| awk '{print $1}'
159M
:~$ du -h "$isofile"|awk '{print $1}'
638M
Mon Mar 11, 2013 4:56 pm
If using iso file:
image_size=$(ls -lh "$isofile" | awk '{ print $5 }') # or du -h $isofile works, too. Not sure why I don't need the awk when it's in the script.
if copying a running live system:
image_mountpoint="/lib/live/mount/medium"
image_size=$(du -sh "$image_mountpoint")
check_size () {
device_freespace=$(df -h $usb_mountpoint) #| awk '/dev/ { print $4 }')
TEXT="Make sure you have enough space on the device to hold the image.
Device size:
$device_freespace
Image size:\t$image_size
"
$DIALOG --$QUESTION --width=680 --height=220 --title="$TITLE" --${BUTTON0}="Continue"${BUTTON0NUM} --${BUTTON1}="Exit"${BUTTON1NUM} --text="$TEXT"
if [[ $? != 0 ]] ; then
echo " Exiting at check_size"
pumount /dev/${DEVICE}1
if [[ -d $image_mountpoint ]] ; then
fusermount -u "$image_mountpoint"
fi
exit 0
fi
}
Mon Mar 11, 2013 5:10 pm
Free space is meaningless if you're going to replace an existing image with a new one
Mon Mar 11, 2013 5:21 pm