Solaris在线扩大文件系统
先给硬盘建一个分区如下:
Current partition table (original):
Total disk cylinders available: 812 + 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 - 811 25.38GB (812/0/0) 53215232
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
partition>
partition> 0
Part Tag Flag Cylinders Size Blocks
0 unassigned wm 0 0 (0/0/0) 0
Enter partition id tag:
Enter partition permission flags:
Enter new starting cyl:
Enter partition size: 128mb
partition> p
Current partition table (unnamed):
Total disk cylinders available: 812 + 2 (reserved cylinders)
Part Tag Flag Cylinders Size Blocks
0 unassigned wm 0 - 3 128.00MB (4/0/0) 262144
1 unassigned wm 0 0 (0/0/0) 0
2 backup wu 0 - 811 25.38GB (812/0/0) 53215232
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
partition> l
Ready to label disk, continue? y
partition> q
newfs /dev/rdsk/c3t1d1s0
挂起来:
newfs: /dev/rdsk/c3t1d1s0 last mounted as /test
newfs: construct a new file system /dev/rdsk/c3t1d1s0: (y/n)? y
/dev/rdsk/c3t1d1s0: 262144 sectors in 4 cylinders of 32 tracks, 2048 sectors
128.0MB in 4 cyl groups (1 c/g, 32.00MB/g, 15040 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 67616, 135200, 202784,
mkdir /test
mount /dev/dsk/c3t1d1s1 /test
df -h /test
Filesystem size usedavail capacityMounted on
/dev/dsk/c3t1d1s0 121M 1.0M 108M 1% /test
df -o i /test
Filesystem iused ifree%iusedMounted on
/dev/dsk/c3t1d1s0 4 60156 0% /test
mkfile 64m /test/testfile
ls -l /test/testfile
-rw------T 1 root other 67108864 Apr6 15:28 /test/testfile
df -o i /test
Filesystem iused ifree%iusedMounted on
/dev/dsk/c3t1d1s0 5 60155 0% /test
现在来改分区大小
Current partition table (original):
Total disk cylinders available: 812 + 2 (reserved cylinders)
Part Tag Flag Cylinders Size Blocks
0 unassigned wm 0 - 3 128.00MB (4/0/0) 262144
1 unassigned wm 0 0 (0/0/0) 0
2 backup wu 0 - 811 25.38GB (812/0/0) 53215232
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
partition> 0
Part Tag Flag Cylinders Size Blocks
0 unassigned wm 0 - 3 128.00MB (4/0/0) 262144
Enter partition id tag:
Enter partition permission flags:
Enter new starting cyl:
Enter partition size: 256mb
partition> p
Current partition table (unnamed):
Total disk cylinders available: 812 + 2 (reserved cylinders)
Part Tag Flag Cylinders Size Blocks
0 unassigned wm 0 - 7 256.00MB (8/0/0) 524288
1 unassigned wm 0 0 (0/0/0) 0
2 backup wu 0 - 811 25.38GB (812/0/0) 53215232
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
partition> l
Ready to label disk, continue? y
partition> q
/usr/lib/fs/ufs/mkfs -G -M /test /dev/rdsk/c3t1d1s0 524288
/dev/rdsk/c3t1d1s0: 524288 sectors in 8 cylinders of 32 tracks, 2048 sectors
256.0MB in 8 cyl groups (1 c/g, 32.00MB/g, 15040 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 67616, 135200, 202784, 270368, 337952, 405536, 473120,
再查下大小,呵呵,变了,文件也没问题。
df -h /test
Filesystem size usedavail capacityMounted on
/dev/dsk/c3t1d1s0 241M 65M 164M 29% /test
df -o i /test
Filesystem iused ifree%iusedMounted on
/dev/dsk/c3t1d1s0 5120315 0% /test
ls -l /test/testfile
-rw------T 1 root other 67108864 Apr6 15:28 /test/testfile
再来一次:)
Current partition table (original):
Total disk cylinders available: 812 + 2 (reserved cylinders)
Part Tag Flag Cylinders Size Blocks
0 unassigned wm 0 - 7 256.00MB (8/0/0) 524288
1 unassigned wm 0 0 (0/0/0) 0
2 backup wu 0 - 811 25.38GB (812/0/0) 53215232
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
partition> 0
Part Tag Flag Cylinders Size Blocks
0 unassigned wm 0 - 7 256.00MB (8/0/0) 524288
Enter partition id tag:
Enter partition permission flags:
Enter new starting cyl:
Enter partition size: 512mb
partition> p
Current partition table (unnamed):
Total disk cylinders available: 812 + 2 (reserved cylinders)
Part Tag Flag Cylinders Size Blocks
0 unassigned wm 0 -15 512.00MB (16/0/0) 1048576
1 unassigned wm 0 0 (0/0/0) 0
2 backup wu 0 - 811 25.38GB (812/0/0) 53215232
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
partition> l
Ready to label disk, continue? Y
/usr/lib/fs/ufs/mkfs -G -M /test /dev/rdsk/c3t1d1s0 1048576
/dev/rdsk/c3t1d1s0: 1048576 sectors in 16 cylinders of 32 tracks, 2048 sectors
512.0MB in 16 cyl groups (1 c/g, 32.00MB/g, 15040 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 67616, 135200, 202784, 270368, 337952, 405536, 473120, 540704, 608288,
675872, 743456, 811040, 878624, 946208, 1013792,
df -h /test
Filesystem size usedavail capacityMounted on
/dev/dsk/c3t1d1s0 482M 65M 405M 14% /test
呵呵,不过有个问题,在slice 0下面再创一个分区slice 3,slice0下面还有自由空间也不能扩展文件系统了,虽然照着提示做了fsck和lockfs也还是不行。删了slice3后也还是不行。再把整个disk重新化分区,又可以扩展了。
format> verify
Primary label contents:
Volume name =
ascii name=
pcyl =814
ncyl =812
acyl = 2
nhead = 32
nsect = 2048
Part Tag Flag Cylinders Size Blocks
0 unassigned wm 0 -31 1024.00MB (32/0/0) 2097152
1 unassigned wm 0 0 (0/0/0) 0
2 backup wu 0 - 811 25.38GB (812/0/0) 53215232
3 unassigned wm 400 - 407 256.00MB (8/0/0) 524288
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
format> q
icilszx06:root /35 > /usr/lib/fs/ufs/mkfs -G -M /test /dev/rdsk/c3t1d1s0 2097152
inode blocks/cyl group (922488) >= data blocks (4096)
number of cylinders per cylinder group (1) must be increased.
Note that cgsize may have been adjusted to allow struct cg to fit.
Filesystem is currently inconsistent.It must be repaired with fsck(1M)
before being used.Use the following command to do this:
fsck /dev/rdsk/c3t1d1s0
You will be told that the filesystem is already mounted, and asked if you
wish to continue.Answer `yes' to this question.
One problem should be reported, that the summary information is bad.
You will then be asked if it should be salvaged.Answer `yes' to
this question.
The filesystem is currently mounted read-only and write-locked.After
running fsck, unlock the filesystem and re-enable writing with
the following command:
lockfs -u /test
partition> p
Current partition table (unnamed):
Total disk cylinders available: 812 + 2 (reserved cylinders)
Part Tag Flag Cylinders Size Blocks
0 unassigned wm 0 -31 1024.00MB (32/0/0) 2097152
1 unassigned wm 0 0 (0/0/0) 0
2 backup wu 0 - 811 25.38GB (812/0/0) 53215232
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
partition> l
Ready to label disk, continue? y
partition> q
/usr/lib/fs/ufs/mkfs -G -M /test /dev/rdsk/c3t1d1s0 2097152
/test: Invalid argument
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/7000/showart_96096.html ---“在slice 0下面再创一个分区slice 3,slice0下面还有自由空间也不能扩展文件系统了”
那作用就不大了。
页:
[1]