Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Repartitioning Hard Disk

Status
Not open for further replies.

alayaho

IS-IT--Management
Feb 21, 2002
27
0
0
ID
Hello,

I am not too familiar with repartitioning disks in UnixWare. I need to increase the size of one of my partitions without losing data stored on the disk. The computer is running UnixWare 7.1.1.

1) How can I view the existing partitions and unallocated space?

2) How can I resize the partition without losing any data stored on the disk?

3) The hard disk is mirrored. Will this be a problem or does UnixWare just treat both drives as one?

4) I have made a master backup using Lone-Tar. Should this be enough to recover the data if I mess up the repartitioning?

5) What tools / software should I have or get to do these tasks?

Thanks a lot for your help.
 
I don't think that you can repartition your harddisks in Unixware since Unixware uses the information straight from the vtoc file. In Solaris you can because you use a virtual file system, so it is easy to adjust the amount of space, but in SCO it is all hard coded I believe.
 
Take a look at this, this is from SCO's website (found this just after I submitted my post):

KB Article Name: How can I set up extra filesystems or slices on my boot disk?


Slices and filesystems can be created manually. This requires the use of prtvtoc(1M) and edvtoc(1M). Creating filesystems also requires using mkfs(1M). There are three steps in the process of creating slices:

I. Use prtvtoc -f to dump the information on
the current disk layout to a file.

II. Edit the file to include the new slice information

III. Use edvtoc(1M) to write the new disk layout.

If filesystems are required on the slices, there are 3 more steps:

IV. Reboot the system to update the vtoc driver with the
vtoc changes that were just written to disk.

V. Use mkfs(1M) to create the filesystems.

VI Edit the /etc/vfstab file so the filesystems are
mounted at boot time.

NOTE: Even if filesystems are not created, rebooting may be necessary to access raw slices, if they were previously unused or non-existent.
Following are detailed instructions on the first few steps.

I. The slice information for a disk is stored in the Volume Table of Contents, or VTOC. In order to see the VTOC information for the boot drive, use the command:


prtvtoc -f /tmp/vtoc.boot /dev/rdsk/0s0

This will create the file "/tmp/vtoc.boot" that has the vtoc information in it. Following is a sample VTOC file from a 24GB system. Slice 0 represents the whole disk.
NOTE: You must use the -f option to create the file. If you use shell redirection to create it, the format will be wrong.


#SLICE TAG FLAGS START SIZE
0 0x5 0x201 63 49962087
1 0x2 0x200 4257225 4209030
2 0x3 0x201 80325 4176900
3 0x4 0x200 8466255 514080
4 0xb 0x200 8980335 321300
5 0x0 0x0 0 0
6 0x0 0x0 0 0
7 0x1 0x201 63 34
8 0xd 0x201 97 15968
9 0x0 0x0 0 0
10 0x9 0x200 16065 64260
11 0xa 0x200 9301635 385560
12 0xb 0x200 9687195 514080
13 0x4 0x200 10201275 128520
14 0x0 0x0 0 0
15 0xf 0x201 10329795 16065

Slice 1 is the root filesystem as identified by the tag 0x2. This should not be changed.
Slice 2 is the swap area, as identified by the tag 0x3. This is reserved for swap. The location and size of this slice may be changed, but care should be taken not to overwrite any other slices.

Slice 3 is a user filesystem, as identified by the tag 0x4. This should not be changed.

Slice 4 is the home filesystem, as identified by the tag 0xb. This should not be changed.

Slice 5 is unused as identified by the tag 0x0 and size of 0. A slice may be created here.

Slice 6 is unused as identified by the tag 0x0 and size of 0. A slice may be created here.

Slice 7 is the boot slice, or boot sector, as identified by the tag 0x1. This should not be changed.

Slice 8 is reserved for remapped sectors, as identified by the tag 0xd. This should not be changed.

Slice 9 is unused as identified by the tag 0x0 and size of 0. A slice may be created here.

Slice 10 contains the boot filesystem, which is mounted on /stand, as identified by the tag 0x9. This should not be changed.

Slice 11 is reserved for the /var filesystem, as identified by the tag 0xa. This should not be changed.

Slice 12 is reserved for the /home2 filesystem, as identified by the tag 0xb. This can be changed, but any data on it will be lost.

Slice 13 is reserved for the /tmp filesystem, as identified by the tag 0x4. /tmp is usually either a memfs, or part of the root fs. If that is the case, a new slice may be created here.

Slice 14 is unused as identified by the tag 0x0 and size of 0. A slice may be created here.

Slice 15 contains the Volume Management private slice, as identified by the tag 0xf. This should not be changed.

So, the information we need before going on to the next step is the following:

(A) The last block on the disk is 49962150. This can be calculated by multiplying cylinders * heads * sectors/track from the 'prtvtoc -p' output. (3110 * 255 * 63) It should match the end of slice zero which is calculated by adding the start to the size. (63 + 49962087)

Also, multiplying this number by 512, should give you approximately the capacity of the drive in bytes. In this example, 49962150 * 512 is 25580620800, approximately 24GB.

(B) The last block in use on the drive is 10345860. This was calculated by finding the slice with the highest beginning cylinder, in this case slice 15, and adding the beginning block to the size. (10329795 + 16065)

(C) The unused space on the disk is 39616290 blocks. This was calculated by subtracting the end of the last slice from the size of the disk. (49962150 - 10345860)

II. The second step is to edit the file created by prtvtoc(1M) to represent the slices you want to create, then run edvtoc(1M) to write the new VTOC to the disk. If you want to use the slices for UnixWare filesystems, the filesystems are limited to 2GB. NOTE: If you are using UnixWare7, then this limitation will not apply. If you are using software that supports I/O to a raw slice greater than 2GB, then you may create the slice here also.

Continuing with the above example of a 24GB disk, we will divide the remaining blocks into new 2GB slices. A gigabyte is defined as 1024 * 1024 * 1024 or 1073741824. Thus, 2 gigabytes is 2147483648 bytes or 4194304 512-byte blocks.

The remaining space on the disk is 39616290 blocks. We can divide this into 9 slices of 4194304 blocks with the 10th slice having 1867554 blocks.

To create a slice, we need to provide the following information:


1. The TAG. This will be 0x4 if you intend to create a
filesystem. If you intend to leave it as raw space, it
will be 0x7.

2. The FLAGS. This should be 0x200.

3. The START block.

** NOTE - put your START blocks on cylinder boundaries. **
If your START block isn't aligned, then mkfs can fail.
To calculate the cylinder boundaries, use
"prtvtoc -p /dev/rdsk/0s0" to get the cylinders, heads, and
sectors/track for your drive. Then get the cylinder size
in sectors by multiplying (heads) x (sectors/track).

For example, say prtvtoc -p /dev/rdsk/0s0 gives you
cylinders: 1106, heads: 255, sectors/track: 63.
Then the cylinder size is 16065 (255 X 63), and you
would use even multiples of 16065 for all of your START
blocks and SIZE values.

4. The SIZE.

** Should also be a multiple of the cylinder size. **

Below is the file created by prtvtoc after it has been edited to include the new slice information. Notice that slices 5, 6, 9, and 14 have been used. The rest of the new slices are in slices 16-21.

#SLICE TAG FLAGS START SIZE
0 0x5 0x201 63 49962087
1 0x2 0x200 4257225 4209030
2 0x3 0x201 80325 4176900
3 0x4 0x200 8466255 514080
4 0xb 0x200 8980335 321300
5 0x4 0x200 10345860 4209030
6 0x4 0x200 14554890 4209030
7 0x1 0x201 63 34
8 0xd 0x201 97 15968
9 0x4 0x200 18763920 4209030
10 0x9 0x200 16065 64260
11 0xa 0x200 9301635 385560
12 0xb 0x200 9687195 514080
13 0x4 0x200 10201275 128520
14 0x4 0x200 22972950 4209030
15 0xf 0x201 10329795 16065
16 0x4 0x200 27181980 4209030
17 0x4 0x200 31391010 4209030
18 0x4 0x200 35600040 4209030
19 0x4 0x200 39809070 4209030
20 0x4 0x200 44018100 4209030
21 0x4 0x200 48227130 1735020


NOTE: If you wanted to just create one large raw slice for use by a database program, the file would look like the following. Note that the entire slice is in slice 5. The type is set to 0x7.

#SLICE TAG FLAGS START SIZE
0 0x5 0x201 63 49962087
1 0x2 0x200 4257225 4209030
2 0x3 0x201 80325 4176900
3 0x4 0x200 8466255 514080
4 0xb 0x200 8980335 321300
5 0x7 0x200 10345860 39616290
6 0x0 0x0 0 0
7 0x1 0x201 63
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top