Making bigger image.gz, losetup error. (Solved)

Using applications, configuring, problems
Post Reply
Message
Author
User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

Making bigger image.gz, losetup error. (Solved)

#1 Post by sunburnt »

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!
Last edited by sunburnt on Wed 23 Aug 2006, 05:33, edited 1 time in total.

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#2 Post by MU »

can't you run resize2fs on the gunziped image?

Did not try myself, just a guess.
Mark

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#3 Post by sunburnt »

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.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#4 Post by sunburnt »

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

Post Reply