Wednesday, September 10, 2008

How extend soft partition?

Objective :

1. To extend soft partition by keeping data intact.
2. To extend meta partition by keeping data intact

Audience :
Audience of the document should be well aware of Solaris commands. They should have proper knowledge of SVM concept and commands. I am assuming that the users are aware of impact of the commands and for safer side , I recommends to take backup before starting exercise.

Setup :

1. Slice used to meta database c0t0d0s7 and size is 100 Mb
2. c0t0d0s7 is 2.7 GB
3. c0t9d0s0 10 Gb

Steps :

1. Create database

bash-3.00# metadb -f -a -c 3 c0t0d0s7
bash-3.00# metadb
flags first blk block count
a u 16 8192 /dev/dsk/c0t0d0s7
a u 8208 8192 /dev/dsk/c0t0d0s7
a u 16400 8192 /dev/dsk/c0t0d0s7

2. Create meta device d10

bash-3.00# metainit d10 1 1 c0t0d0s4

d10: Concat/Stripe is setup
bash-3.00# metastat
d10: Concat/Stripe
Size: 3986352 blocks (1.9 GB)
Stripe 0:
Device Start Block Dbase Reloc
c0t0d0s4 0 No Yes

Device Relocation Information:
Device Reloc Device ID
c0t0d0 Yes id1,sd@SFUJITSU_MAG3182L_SUN18G_01585615____

3. Create new soft partition

bash-3.00# metainit d31 -p d10 1g
d31: Soft Partition is setup
bash-3.00# metastat
d31: Soft Partition
Device: d10
State: Okay
Size: 2097152 blocks (1.0 GB)
Extent Start Block Block count
0 32 2097152

d10: Concat/Stripe
Size: 3986352 blocks (1.9 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0t0d0s4 0 No Okay Yes

Device Relocation Information:
Device Reloc Device ID
c0t0d0 Yes id1,sd@SFUJITSU_MAG3182L_SUN18G_01585615____

4. Format the newly created soft partition and mount it

# newfs /dev/md/dsk/d31

newfs: construct a new file system /dev/md/rdsk/d31: (y/n)? yes
Warning: 4400 sector(s) in last cylinder unallocated
/dev/md/rdsk/d31: 2097152 sectors in 446 cylinders of 19 tracks, 248 secto
rs
1024.0MB in 28 cyl groups (16 c/g, 36.81MB/g, 17664 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 75680, 151328, 226976, 302624, 378272, 453920, 529568, 605216, 680864,
1361696, 1437344, 1512992, 1588640, 1664288, 1739936, 1815584, 1891232,
1966880, 2042528

bash-3.00# mkdir /test1
bash-3.00# mount /dev/md/dsk/d32 /test1

bash-3.00# df –h /test
Filesystem size used avail capacity Mounted on
/dev/md/dsk/d31 963M 1.0M 904M 1% /test

5. Addition of more space in d10

bash-3.00# metattach d10 c0t9d0s0
d10: component is attached

bash-3.00# metastat
d32: Soft Partition
Device: d10
State: Okay
Size: 1024000 blocks (500 MB)
Extent Start Block Block count
0 2097216 1024000

d10: Concat/Stripe
Size: 39533680 blocks (18 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0t0d0s4 0 No Okay Yes
Stripe 1:
Device Start Block Dbase State Reloc Hot Spare
c0t9d0s0 5080 No Okay Yes

d31: Soft Partition
Device: d10
State: Okay
Size: 2097152 blocks (1.0 GB)
Extent Start Block Block count
0 32 2097152

Device Relocation Information:
Device Reloc Device ID
c0t0d0 Yes id1,sd@SFUJITSU_MAG3182L_SUN18G_01585615____
c0t9d0 Yes id1,sd@x002037fffebcf385


6. Copy some data make partition full so that we can test it late for extension.

bash-3.00# df -h /test
Filesystem size used avail capacity Mounted on
/dev/md/dsk/d31 963M 960M 0K 100% /test


7. Add 2 Gb space in partition d31

bash-3.00# metattach d31 2g
d31: Soft Partition has been grown

bash-3.00# df -h /test
Filesystem size used avail capacity Mounted on
/dev/md/dsk/d31 963M 960M 0K 100% /test

( Please note partition size is still not grown.)

8. Now final step that will make partition grow without destroying data.

bash-3.00# growfs -M /test /dev/md/rdsk/d31
Warning: 3776 sector(s) in last cylinder unallocated
/dev/md/rdsk/d31: 6291456 sectors in 1336 cylinders of 19 tracks, 248 sectors
3072.0MB in 84 cyl groups (16 c/g, 36.81MB/g, 17664 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 75680, 151328, 226976, 302624, 378272, 453920, 529568, 605216, 680864,
5581600, 5657248, 5732896, 5808544, 5884192, 5959840, 6035488, 6111136,
6186784, 6262432

bash-3.00# df -h
Filesystem size used avail capacity Mounted on

/dev/md/dsk/d31 2.8G 962M 1.8G 34% /test

That’s it.

No comments: