How to make ComboFormat partition larger than a gig?

Using applications, configuring, problems
Message
Author
npierce
Posts: 858
Joined: Tue 29 Dec 2009, 01:40

#16 Post by npierce »

You're welcome.

I am happy to read that you got it working. :)

User avatar
Ghost Dog
Posts: 163
Joined: Fri 27 Jan 2012, 04:29

#17 Post by Ghost Dog »

Here's something weird:

If I make the first partition 1350 mb:

Code: Select all

#create 256M empty file...
   dd if=/dev/zero of=${WKGPATH}/image256m bs=1024 count=1382400
...it works great. But if I make it another 512mb bigger, it suffers from the same problem as before - the second partition is created with the remaining space, but is unmountable.

Code: Select all

sh-4.1# mount /dev/sdf2 /mnt/sdf2
mount: you must specify the filesystem type
The Way of the Samurai

npierce
Posts: 858
Joined: Tue 29 Dec 2009, 01:40

#18 Post by npierce »

Does partition 1 seem OK? Does it boot?

What's the output from:

Code: Select all

fdisk -l /dev/sdf
blkid /dev/sdf1
blkid /dev/sdf2

User avatar
Ghost Dog
Posts: 163
Joined: Fri 27 Jan 2012, 04:29

#19 Post by Ghost Dog »

It boots, and the first partition seems to work normally.

Code: Select all

sh-4.1# fdisk -l /dev/sdf

Disk /dev/sdf: 4089 MB, 4089446400 bytes
126 heads, 62 sectors/track, 1022 cylinders, total 7987200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1   *          32     3786239     1893104    b  W95 FAT32
/dev/sdf2         3786240     7987199     2100480    b  W95 FAT32
sh-4.1# blkid /dev/sdf1 
/dev/sdf1: UUID="5233-BBCE" TYPE="vfat"
sh-4.1# blkid /dev/sdf2 
/dev/sdf1: UUID="5233-BBCE" TYPE="vfat"
/dev/sdf: UUID="5233-BBCE" TYPE="vfat"
[and a few entries for my partitions on sda... nothing about sdf2]
The Way of the Samurai

npierce
Posts: 858
Joined: Tue 29 Dec 2009, 01:40

#20 Post by npierce »

Ghost Dog wrote:

Code: Select all

sh-4.1# blkid /dev/sdf2
/dev/sdf1: UUID="5233-BBCE" TYPE="vfat"
/dev/sdf: UUID="5233-BBCE" TYPE="vfat"
[and a few entries for my partitions on sda... nothing about sdf2]
I was going to say that the second partition must be quite corrupt for blkid to be finding information about the first partition on it, and severely corrupt if it is finding information about your hard drive on it. But I used losetup to associate a file full of zeros with a loop device and tried blkid with it. Sure enough, it reports information on all block devices. So apparently that is a quirk of blkid: when given an unformatted device, it throws up its hands and gives information about every other block device it can find. :)

So it appears that for some reason the second partition just isn't getting formatted, or is being incorrectly formatted, which is no surprise. The question is why.

I notice that /dev/sdf1 has only 1893104 blocks, which is only 1848.734 MiB, which is significantly smaller than the 1350 + 512 = 1862 that you were aiming for. (I think makebootfat may use 32 blocks for the stuff before the first partition, but that only accounts for 0.031 MiB.) So I am guessing that bootflash didn't find enough temporary space to make partition 1 the size that you asked for. (It actually creates the image in a temporary file on an already mounted filesystem (in /tmp/, /root/, or /mnt/home/) before moving it to your flash drive.)

As you know, normally bootflash creates a 256 MiB empty file. It searches for space containing 300 MiB (to allow a little room to breathe). You will see three lines in the script like this:

Code: Select all

 if [ $FREEM -lt 300 ];then
You should change the "300" in those lines to something a little bigger than the size of the file you are creating. (In this case "2000" should probably be sufficient.)

If you are not running a full install, my guess is that you have a PC with 2 GiB, and the layered filesytem in RAM had enough room to create a 1350 MiB file, but not an 1862 MiB file. But bootflash was only looking for 300 MiB of space, which it found in /tmp/ so it tried to create the file in /tmp/.

If that is what happened, then changing those three lines will allow bootflash to keep looking until it finds sufficient space at /mnt/home/, assuming that /mnt/home is a symlink to a mounted partition with sufficient space.

BUT . . .

But this may not be your only problem. While it is easy to see why the above situation could result in partition 1 being smaller than expected, I see no clear reason why it would prevent partition 2 from being formatted correctly. Perhaps mkdosfs needed some space to work and couldn't find any. Anyway, when RAM gets filled up, all bets are off as to what happens.

So changing those three lines may or may not fix partition 2, but let's eliminate that problem first, then we can revisit the lack of proper format for partition 2, if that problem still exists.

User avatar
Ghost Dog
Posts: 163
Joined: Fri 27 Jan 2012, 04:29

#21 Post by Ghost Dog »

Still the same, by the looks of it:

Code: Select all

sh-4.1# fdisk -l /dev/sdf 

Disk /dev/sdf: 4089 MB, 4089446400 bytes
126 heads, 62 sectors/track, 1022 cylinders, total 7987200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1   *          32     3884159     1942064    b  W95 FAT32
/dev/sdf2         3884160     7987199     2051520    b  W95 FAT32
sh-4.1# blkid /dev/sdf1 
/dev/sdf1: UUID="5235-232F" TYPE="vfat"
sh-4.1# blkid /dev/sdf2
/dev/sdf1: UUID="5235-232F" TYPE="vfat"
/dev/sda3: UUID="c70dd211-2aa3-4aa5-b6bd-6204f6b662a1" TYPE="swap"
/dev/sda1: UUID="702f5e62-7e1e-4eee-952d-85c04929f1a9" TYPE="ext3"
/dev/sda2: UUID="bcd58708-8b3d-4552-b2d8-15da03b76e3b" TYPE="ext3"
/dev/sdf: UUID="5235-232F" TYPE="vfat"
I'm running a full install, so it shouldn't be a RAM problem.

Like I said, weird. :)
The Way of the Samurai

User avatar
Ghost Dog
Posts: 163
Joined: Fri 27 Jan 2012, 04:29

#22 Post by Ghost Dog »

Just as an experiment, I increased the size of partition 1 to a full 2 gb and the "if [ $FREEM -lt 300 ];then" lines to 2100 mb to see if partition 2 would format. But nope.
The Way of the Samurai

npierce
Posts: 858
Joined: Tue 29 Dec 2009, 01:40

#23 Post by npierce »

Well, it looks like the change allowed partition 1 to be bigger.

Before:

Code: Select all

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1   *          32     3786239     1893104    b  W95 FAT32 
After:

Code: Select all

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1   *          32     3884159     1942064    b  W95 FAT32 
But that didn't solve the partition 2 problem.
Ghost Dog wrote:I'm running a full install, so it shouldn't be a RAM problem.
OK, that's good to know.

Try formating partition 2 manually with the following command. (If the flash drive you're testing isn't still at /dev/sdf, you will of course want to modify the command to prevent any nasty surprises.):

Code: Select all

mkdosfs -F 32 -n storage /dev/sdf2
Does that give any error messages?

If not, is it now mountable? Does blkid recognise it?

User avatar
Ghost Dog
Posts: 163
Joined: Fri 27 Jan 2012, 04:29

#24 Post by Ghost Dog »

Yep, that fixes it!

Code: Select all

sh-4.1# blkid /dev/sdf2 
/dev/sdf2: LABEL="storage" UUID="1FCB-C3D9" TYPE="vfat"
The Way of the Samurai

npierce
Posts: 858
Joined: Tue 29 Dec 2009, 01:40

#25 Post by npierce »

Good!

That's the same command that the bootflash script uses, so it is still a bit of a mystery that it doesn't get done by the script. But you got the partition fixed, which is what counts. Glad to hear it.

User avatar
Ghost Dog
Posts: 163
Joined: Fri 27 Jan 2012, 04:29

#26 Post by Ghost Dog »

No, what counts is that YOU'RE AWESOME.

I really appreciate the time you took to help me with this.
The Way of the Samurai

npierce
Posts: 858
Joined: Tue 29 Dec 2009, 01:40

#27 Post by npierce »

Glad to help, and gladder when its appreciated. Thanks.

Post Reply