I took the code from rc.sysinit to make bigger image.gz to add stuff to it.
I pad the new file with 4 MB of free space above the original file & added stuff.
"dd" makes new file, but losetup-FULL reports: ioctl: LOOP_SET_FD: Device or resource busy.
"fsck" says: fsck.ext2: Bad magic number in super-block..... (of course).
And of course everything goes bad after that, here's the make image part of the code:
dd if=/dev/zero of=${P}/image_NEW bs=1K count=$KB # make new image file
sleep 2
losetup-FULL /dev/loop4 ${P}/image_NEW
sleep 2
mkfs -t ext2 /dev/loop4 $KB # make ext2 file sys. on it
sleep 2
fsck -Cpt ext2 ${P}/image_NEW
if [ $? -eq 4 ];then # check & repair image
echo "Repairing Image's filesystem..."
fsck -y -t ext2 ${P}/image_NEW
fi
All commands are from rc.sysinit with only the file & size variables changed.
I chose /dev/loop4 to be sure it'd be unused, Puppy uses 2 loops, & the old & new images use 2.
I ran the code in a test file & same losetup error, BUT fsck reported file okay!
Strangly I added code to delete the mount dirs. after a failed attempt.
First it checks if they're mounted & umounts if they are.
I tried: rm -f, rm -r, rm -d, rmdir -f, rm -r & rmdir -f, nothing works!
Making bigger image.gz, losetup error. (Solved)
Making bigger image.gz, losetup error. (Solved)
Last edited by sunburnt on Wed 23 Aug 2006, 05:33, edited 1 time in total.
resize2fs command resizes the fs to make the fs size same as the image file.
losetup-FULL is the error... so /dev/loop4 or the image_NEW file are busy, or mount dir.?
I put "sleep 2" inbetween the commands, no help, & Barry doesn't use them here.
I assume because the new image is bad then there's the error:
mount: Mounting /mnt/home/0/0/image_NEW on /mnt/img-new failed: Invalid argument
It's the same mount command as the original image except the file name & mount dir.
I tried padding the free space even more & now it reports:
mkfs.ext2: Filesystem larger than apparent device size.
This is exactly the same code I use in LanPuppy to make the SAVE file, & no problems.
I don't think LanPuppy's erroring making the SAVE file, & the file works fine.
losetup-FULL is the error... so /dev/loop4 or the image_NEW file are busy, or mount dir.?
I put "sleep 2" inbetween the commands, no help, & Barry doesn't use them here.
I assume because the new image is bad then there's the error:
mount: Mounting /mnt/home/0/0/image_NEW on /mnt/img-new failed: Invalid argument
It's the same mount command as the original image except the file name & mount dir.
I tried padding the free space even more & now it reports:
mkfs.ext2: Filesystem larger than apparent device size.
This is exactly the same code I use in LanPuppy to make the SAVE file, & no problems.
I don't think LanPuppy's erroring making the SAVE file, & the file works fine.
I changed to a different set of commands & I'm not getting any errors.
I don't know why the code in rc.sysinit won't work but this is what is working:
dd if=/dev/zero of=${P}/image_NEW bs=1K count=$KB # make new image file
mke2fs -F -m 0 -b 1024 ${P}/image_NEW # make ext2 file sys. on it
fsck -Cpt ext2 ${P}/image_NEW # check & repair image
I don't know why the code in rc.sysinit won't work but this is what is working:
dd if=/dev/zero of=${P}/image_NEW bs=1K count=$KB # make new image file
mke2fs -F -m 0 -b 1024 ${P}/image_NEW # make ext2 file sys. on it
fsck -Cpt ext2 ${P}/image_NEW # check & repair image