当你为solaris分配了一个12G虚拟硬盘,但是过了一段时间发现不够用,想把它扩大到15G,VMware是支持动态分配硬盘的,但是solaris没有lvm管理硬盘,所以不能用其他磁盘管理软件动态扩展当前硬盘,通常的做法是新增加一块15G的硬盘,然后格式化新硬盘,最后把之前12G硬盘中的数据拷贝到新硬盘中,然后删除原来的硬盘,这种做法是最原始的做法,下面介绍下在原有的硬盘基础上动态扩展硬盘空间。

 

 (root_HOSTNAME)@/ #
 
 
AVAILABLE DISK SELECTIONS:
       0. c0t0d0 <DEFAULT cyl 4174 alt 2 hd 255 sec 63>
          /pci@0,0/pci1000,30@10/sd@0,0
       1. c0t1d0 <DEFAULT cyl 1563 alt 2 hd 255 sec 63>
          /pci@0,0/pci1000,30@10/sd@1,0
Specify disk (enter its number): 1
selecting c0t1d0
 
==>
 
partition> p
Current partition table (original):
Total disk cylinders available: 1563 + 2 (reserved cylinders)
 
Part      Tag    Flag     Cylinders        Size            Blocks
 0 unassigned    wm       0               0         (0/0/0)           0
 1 unassigned    wm       0               0         (0/0/0)           0
 2     backup    wu       0 - 1562       11.97GB    (1563/0/0) 25109595
 3 unassigned    wm       0               0         (0/0/0)           0
 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>
 
==>
 
(root_HOSTNAME)@/ # newfs /dev/rdsk/c0t1d0s2
newfs: construct a new file system /dev/rdsk/c0t1d0s2: (y/n)? y
Warning: 934 sector(s) in last cylinder unallocated
/dev/rdsk/c0t1d0s2:     25109594 sectors in 4087 cylinders of 48 tracks, 128 sectors
        12260.5MB in 256 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,
 24189728, 24288160, 24386592, 24485024, 24583456, 24681888, 24780320,
 24878752, 24977184, 25075616
(root_HOSTNAME)@/ # mount /dev/dsk/c0t1d0s2 /data
 
 
 
/dev/dsk/c0t1d0s2       12G    12M    12G     1%    /data
 
 
Copy some files under /data
Example:
(root_HOSTNAME)@/data # mkfile 3g 3g
(root_HOSTNAME)@/data # cp -rp /etc/* .

 

 

 

 

 

--> Add to 15G

 

 

 

 

Delete existing partition
-> 3
 

 

 

Create partition again
->1
 

 

 

 

 

 

 

Update disk configuration and exit
->5

 

 

 

 

 

Label disk

 

 

 

(root_HOSTNAME)@/ # df -h
Filesystem             size   used avail capacity Mounted on

/dev/dsk/c0t1d0s2       12G   3.0G   8.7G    26%    /data

Using growfs command to extend file system

 
-->
(root_HOSTNAME)@/ # growfs -M /data /dev/rdsk/c0t1d0s2
Warning: 1054 sector(s) in last cylinder unallocated
/dev/rdsk/c0t1d0s2:     31407074 sectors in 5112 cylinders of 48 tracks, 128 sectors
        15335.5MB in 320 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:
 30481184, 30579616, 30678048, 30776480, 30874912, 30973344, 31071776,
 31170208, 31268640, 31367072
(root_HOSTNAME)@/ # df -h /data
Filesystem             size   used avail capacity Mounted on
/dev/dsk/c0t1d0s2       15G   3.0G    12G    21%    /data
(root_HOSTNAME)@/ # cd /data
(root_HOSTNAME)@/data # ls
3g                    cron                  esd.conf              grpck
TIMEZONE              css.conf              fddi.cfg              halt
TIMEZONE.temp         dacf.conf             ff                    hba.conf
aliases               datemsk               fmthard               hostname.vmxnet3s0
auto_home             dcopy                 format                hosts
auto_master           defaultrouter         format.dat            ima.conf
autopush              device.tab            fsck                  inetd.conf
bootrc                devlink.tab           fsdb                  init
bootsign              dgroup.tab            fstyp                 initpipe
cfgadm                driver_aliases        fuser                 lost+found
chroot                driver_classes        getty
clri                  dumpadm.conf          gnome-vfs-mime-magic
coreadm.conf          dumpdates             group
(root_HOSTNAME)@/data #