How to correctly allocate size while creating FileSystem

Hello - I am finding difficulty in creating and allocating correct size to File Systems on solarix x86 box. Please see below contents I followed on screen and in the end It shows that /app file system is created of size 135GB , I wanted it to be 30gb as mentioned during 'format' command in 'Enter Partitiion size' :

root@unknown # df -k
Filesystem kbytes used avail capacity Mounted on
/dev/dsk/c0t0d0s0 15496821 7472292 7869561 49% /
/devices 0 0 0 0% /devices
ctfs 0 0 0 0% /system/contract
proc 0 0 0 0% /proc
mnttab 0 0 0 0% /etc/mnttab
swap 17574616 808 17573808 1% /etc/svc/volatile
objfs 0 0 0 0% /system/object
/usr/lib/libc/libc_hwcap2.so.1
15496821 7472292 7869561 49% /lib/libc.so.1
fd 0 0 0 0% /dev/fd
swap 17573844 36 17573808 1% /tmp
swap 17573840 32 17573808 1% /var/run
root@unknown # format
Searching for disks...done

AVAILABLE DISK SELECTIONS:
0. c0t0d0 <DEFAULT cyl 17832 alt 2 hd 255 sec 63>
/pci@0,0/pci1022,7450@2/pci1000,3060@3/sd@0,0
1. c0t2d0 <DEFAULT cyl 17846 alt 2 hd 255 sec 63>
/pci@0,0/pci1022,7450@2/pci1000,3060@3/sd@2,0
2. c0t3d0 <DEFAULT cyl 17845 alt 2 hd 255 sec 63>
/pci@0,0/pci1022,7450@2/pci1000,3060@3/sd@3,0
Specify disk (enter its number): 0
selecting c0t0d0
[disk formatted]
Warning: Current Disk has mounted partitions.
/dev/dsk/c0t0d0s0 is currently mounted on /. Please see umount(1M).
/dev/dsk/c0t0d0s1 is currently used by swap. Please see swap(1M).

FORMAT MENU:
disk - select a disk
type - select (define) a disk type
partition - select (define) a partition table
current - describe the current disk
format - format and analyze the disk
fdisk - run the fdisk program
repair - repair a defective sector
label - write label to the disk
analyze - surface analysis
defect - defect list management
backup - search for backup labels
verify - read and display labels
save - save new disk/partition definitions
inquiry - show vendor, product and revision
volname - set 8-character volume name
!<cmd> - execute <cmd>, then return
quit
format> p

PARTITION MENU:
0 - change `0' partition
1 - change `1' partition
2 - change `2' partition
3 - change `3' partition
4 - change `4' partition
5 - change `5' partition
6 - change `6' partition
7 - change `7' partition
select - select a predefined table
modify - modify a predefined partition table
name - name the current table
print - display the current table
label - write partition map and label to the disk
!<cmd> - execute <cmd>, then return
quit
partition> p
Current partition table (original):
Total disk cylinders available: 17832 + 2 (reserved cylinders)

Part Tag Flag Cylinders Size Blocks
0 root wm 524 - 2482 15.01GB (1959/0/0) 31471335
1 swap wu 1 - 523 4.01GB (523/0/0) 8401995
2 backup wm 0 - 17831 136.60GB (17832/0/0) 286471080
3 unassigned wm 2483 - 4441 15.01GB (1959/0/0) 31471335
4 unassigned wm 0 0 (0/0/0) 0
5 unassigned wm 0 0 (0/0/0) 0
6 unassigned wm 0 0 (0/0/0) 0
7 unassigned wm 0 0 (0/0/0) 0
8 boot wu 0 - 0 7.84MB (1/0/0) 16065
9 unassigned wm 0 0 (0/0/0) 0

partition> 3
Part Tag Flag Cylinders Size Blocks
3 unassigned wm 2483 - 4441 15.01GB (1959/0/0) 31471335

Enter partition id tag[unassigned]: usr
Enter partition permission flags[wm]:
Enter new starting cyl[2483]: 2483
Enter partition size[31471335b, 1959c, 4441e, 15366.86mb, 15.01gb]: 30gb

partition> p
Current partition table (unnamed):
Total disk cylinders available: 17832 + 2 (reserved cylinders)

Part Tag Flag Cylinders Size Blocks
0 root wm 524 - 2482 15.01GB (1959/0/0) 31471335
1 swap wu 1 - 523 4.01GB (523/0/0) 8401995
2 backup wm 0 - 17831 136.60GB (17832/0/0) 286471080
3 usr wm 2483 - 6399 30.01GB (3917/0/0) 62926605
4 unassigned wm 0 0 (0/0/0) 0
5 unassigned wm 0 0 (0/0/0) 0
6 unassigned wm 0 0 (0/0/0) 0
7 unassigned wm 0 0 (0/0/0) 0
8 boot wu 0 - 0 7.84MB (1/0/0) 16065
9 unassigned wm 0 0 (0/0/0) 0

partition>q

root@unknown # newfs /dev/rdsk/c0t0d0s2
newfs: construct a new file system /dev/rdsk/c0t0d0s2: (y/n)? y
Warning: 5208 sector(s) in last cylinder unallocated
/dev/rdsk/c0t0d0s2: 286471080 sectors in 46627 cylinders of 48 tracks, 128 sectors
139878.5MB in 2915 cyl groups (16 c/g, 48.00MB/g, 5824 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 98464, 196896, 295328, 393760, 492192, 590624, 689056, 787488, 885920,
Initializing cylinder groups:
..........................................................
super-block backups for last 10 cylinder groups at:
285576352, 285674784, 285773216, 285871648, 285970080, 286068512, 286166944,
286265376, 286363808, 286462240
root@unknown # mount /dev/dsk/c0t0d0s2 /app
root@unknown # df -k /app
Filesystem kbytes used avail capacity Mounted on
/dev/dsk/c0t0d0s2 141066718 65553 139590498 1% /app
root@unknown #

Please advice, what is wrong I am doing above?

I'm not 100% sure but I think you havn't saved your changes to the partiiton table there, so it's reverting back to the previous size.
Try saving the changes (I think it's using 'label' before you quit)

Edit:

Also, leave slice 2 alone, don't newfs it or your could clobber the entire disk. You want to newfs slice _3_

Still the same problem - Please see IF its correct?

partition> p
Current partition table (original):
Total disk cylinders available: 17832 + 2 (reserved cylinders)

Part Tag Flag Cylinders Size Blocks
0 root wm 524 - 2482 15.01GB (1959/0/0) 31471335
1 swap wu 1 - 523 4.01GB (523/0/0) 8401995
2 backup wm 0 - 17831 136.60GB (17832/0/0) 286471080
3 unassigned wm 2483 - 4441 15.01GB (1959/0/0) 31471335
4 unassigned wm 0 0 (0/0/0) 0
5 unassigned wm 0 0 (0/0/0) 0
6 unassigned wm 0 0 (0/0/0) 0
7 unassigned wm 0 0 (0/0/0) 0
8 boot wu 0 - 0 7.84MB (1/0/0) 16065
9 unassigned wm 0 0 (0/0/0) 0

partition> 3
Part Tag Flag Cylinders Size Blocks
3 unassigned wm 2483 - 4441 15.01GB (1959/0/0) 31471335

Enter partition id tag[unassigned]: usr
Enter partition permission flags[wm]:
Enter new starting cyl[2483]: 2483
Enter partition size[31471335b, 1959c, 4441e, 15366.86mb, 15.01gb]: 30gb
partition> label
Ready to label disk, continue? y

partition> q
root@unknown # newfs /dev/rdsk/c0t0d0s2
newfs: /dev/rdsk/c0t0d0s2 last mounted as /app
newfs: construct a new file system /dev/rdsk/c0t0d0s2: (y/n)? y
Warning: 5208 sector(s) in last cylinder unallocated
/dev/rdsk/c0t0d0s2: 286471080 sectors in 46627 cylinders of 48 tracks, 128 sectors
139878.5MB in 2915 cyl groups (16 c/g, 48.00MB/g, 5824 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 98464, 196896, 295328, 393760, 492192, 590624, 689056, 787488, 885920,
Initializing cylinder groups:
..........................................................
super-block backups for last 10 cylinder groups at:
285576352, 285674784, 285773216, 285871648, 285970080, 286068512, 286166944,
286265376, 286363808, 286462240
root@unknown # mount /dev/dsk/c0t0d0s2 /app
root@unknown # df -k
Filesystem kbytes used avail capacity Mounted on
/dev/dsk/c0t0d0s0 15496821 7472293 7869560 49% /
/devices 0 0 0 0% /devices
ctfs 0 0 0 0% /system/contract
proc 0 0 0 0% /proc
mnttab 0 0 0 0% /etc/mnttab
swap 17573728 808 17572920 1% /etc/svc/volatile
objfs 0 0 0 0% /system/object
/usr/lib/libc/libc_hwcap2.so.1
15496821 7472293 7869560 49% /lib/libc.so.1
fd 0 0 0 0% /dev/fd
swap 17572956 36 17572920 1% /tmp
swap 17572952 32 17572920 1% /var/run
/dev/dsk/c0t0d0s2 141066718 65553 139590498 1% /app
root@unknown #

You're still doing the newfs on slice 2 (/dev/rdsk/c0t0d0s2) - that's the entire disk :frowning: You want to newfs slice 3 (/dev/rdsk/c0t0d0s3)

I have two solaris boxes, and both of them having some problem while rebooting. Only changes were done before rebooting was creation of four new filesystem's u01 - u04.
Problem on 1) - I noticed that when the box was rebooting, it was complaining about the U01->U04 mounts (i.e. fsck probs) - so I disabled these via vsftab and rebooted...When the problems were occurring, the server was not rebooting properly and starting up in maintenance mode. How do I fix it?

Problem on 2) - is reporting a Bad PBR Sig at the GRUB bootloader process... this is a pretty basic stage to die at.

Any ideas?

Thank you!

Did you create any of those volumes on slice 2? If so, you've probably overwritten the boot section of the disk.

What I was trying to get at in the earlier posts was that slice 2 is the entire disk, if you run newfs over this, you will slightly break all the slices (aka partitions) on the entire disk. If you then mount that volume and start putting data on it etc, you will do more and more damage until it is no longer bootable.

What do you suggest must I do now :frowning: ?

Presumably there is a volume on slice 2 then?

It's not a good situation but nor is it game over yet, you've got two options, neither one is going to recover 100% of your data though sorry :frowning:

Read the whole thing before you decide what to do - you have a few tough calls to make

Option 1: Forget the OS etc and try to save what was written to the volume on slice 2
Option 2: Forget what was written to the volume and slice 2 and try and save everything else.

If you need the data on slice 2, that makes option 1 preferable, if you need the data on one or more of the other slices, option 2 looks better.
If you have been using the volume on slice 2 heavily, you have a better chance of success with option 1
If you haven't filled the volume on slice 2 with much and havn't done lots of I/O on it, option 2 is likely to save more data.

It would probably be a good idea to get a second opinion on my suggested fix as it's going to do more damage to some of your data in an attempt to save other data. In other words, once you do this, there's no going back.

If you elect to go with option 2, try this:

  1. Start by booting off a cd or the network to get something we can work with
  2. Once you have a command prompt, try and mount /dev/dsk/c0t0d0s0 (or whever your root filesystem is) onto /a (this is available when booted off a cd for this purpose)
  3. If this fails reporting errors on the disk, run fsck over it - you'll lose a bit of data but hopefully not too much. Then try mounting again
  4. Go into /a/etc and edit the vfstab, comment out any volumes that are on slice 2 (look for 's2' in the device name)
  5. umount /a
  6. Run 'format' and select the disk that is damaged
  7. Display the partition table (I think it's 'p' 'p' from memory)
  8. Check that slice 2 starts at cylinder 0 and ends at the largest cylinder number possible - this step isn't vital but we might as well get things as normal as possible)
  9. If you have to make a change to do this, save the changes
  10. Exit out of format and back to the command prompt
  11. fsck /opt, /usr and /var - whichever of these are on seperate slices
  12. Attempt to boot from the disk

Any data written to the filesystem you created on slice 2 will be destroyed by doing this.

This won't be a silver bullet, most of the damage will not be reversable unfortunatly and the system may never boot again.
However, it might get the system bootable which will make restoring from backup much easier.

Whatever happens you should be looking at a total rebuild as soon as possible after this.

If you need that data on slice 2, option 1 is for you, try this:

  1. As in option 2, boot from a cd
  2. Attempt to mount slice 2 on /a
  3. If it fails, run fsck over that device and try again
  4. Run format and select this disk
  5. Edit the partition table and set the starting cylinder and size of all partitions except slice 2 to 0 (effectively deleting them)
  6. Save your changes and exit format
  7. Whatever you do, DO NOT attempt to boot from any part of this disk

This will destroy any surviving data on all slices other than 2.

Once you've got slice 2 salvaged, you can put the disk in another machine or install an OS on another disk in this machine.

It ain't gonna be fun, but never say die! Let us know how you get on and if you hit any issues, I'm sure we'll all offer all the help we can. In the end, it'll make a good story you can tell junior admins about the pitfalls of Solaris :smiley:

Good luck!

[Edit] Are you comfortable with fsck and the basics of what it does? - If not, find out a bit about it first as it will make your decision easier.