免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4374 | 回复: 3
打印 上一主题 下一主题

solaris x86平台下收缩ufs文件系统的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-09-25 14:49 |只看该作者 |倒序浏览
VMware下solaris x86平台
新增一磁盘c1t1d0 大小5G

分区表信息如下:
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 - 648        4.97GB    (649/0/0) 10426185
  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       1 - 648        4.96GB    (648/0/0) 10410120
  8       boot    wu       0 -   0        7.84MB    (1/0/0)      16065
  9 unassigned    wm       0              0         (0/0/0)          0

建文件系统并mount到/mnt
/@mysolaris#newfs /dev/rdsk/c1t1d0s7
newfs: construct a new file system /dev/rdsk/c1t1d0s7: (y/n)? y
Warning: 7560 sector(s) in last cylinder unallocated
/dev/rdsk/c1t1d0s7:     10410120 sectors in 689 cylinders of 240 tracks, 63 sectors
        5083.1MB in 99 cyl groups (7 c/g, 51.68MB/g, 6272 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 105936, 211840, 317744, 423648, 529552, 635456, 741360, 847264, 953168,
9425488, 9531392, 9637296, 9743200, 9849104, 9955008, 10060912, 10166816,
10272720, 10378624,

/@mysolaris#mount /dev/dsk/c1t1d0s7 /mnt

/@mysolaris#df -h /mnt
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c1t1d0s7      4.9G   5.0M   4.8G     1%    /mnt

增加另一磁盘c1t2d0 大小5G,和c1t1d0一样的分区结构,但不建文件系统

现在做通过串联raid0扩展容量的试验:

/@mysolaris#umount /mnt
建串联raid0
/@mysolaris#metainit d0 2 1 c1t1d0s7 1 c1t2d0s7
d0: Concat/Stripe is setup

在/etc/vfstab中添加如下条目:
/dev/md/dsk/d0        /dev/md/rdsk/d0       /mnt              ufs     2       yes     -

mount /mnt

/@mysolaris#df -h /mnt
Filesystem             size   used  avail capacity  Mounted on
/dev/md/dsk/d0         4.9G   5.0M   4.8G     1%    /mnt

/@mysolaris#growfs -M /mnt /dev/md/rdsk/d0
/dev/md/rdsk/d0:        20820240 sectors in 1377 cylinders of 240 tracks, 63 sectors
        10166.1MB in 197 cyl groups (7 c/g, 51.68MB/g, 6272 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 105936, 211840, 317744, 423648, 529552, 635456, 741360, 847264, 953168,
19804080, 19909984, 20015888, 20121792, 20227696, 20333600, 20439504,
20545408, 20651312, 20757216,
/@mysolaris#
/@mysolaris#df -h /mnt
Filesystem             size   used  avail capacity  Mounted on
/dev/md/dsk/d0         9.8G   9.9M   9.7G     1%    /mnt

/mnt成功扩展容量

现在的疑问是,如果我不需要这样大的空间了,把c1t2d0去掉了,mount /mnt在/dev/rdsk/c1t1d0s7上,这时候空间应该还原到了5G,但是文件系统还是显示的9.8G,请问如何收缩文件系统?
当然,我知道可以format,重新来,如果不format有其他办法吗?因为我的根磁盘下的一个片遇到该问题,不能format根磁盘的。

论坛徽章:
0
2 [报告]
发表于 2008-09-26 02:01 |只看该作者
请确认你的操作过程是否正确:
官方文档的相关内容如下:

如何删除 RAID-0 卷

1. 请确保您具有超级用户权限,而且拥有所有数据的最新备份。
2.请确定不再需要该卷。如果删除某个条带或串联并重用已删除卷中的片,则该卷上的所有数据都将从系统中删除。
3.如有必要,请取消对文件系统的挂载。
# umount /filesystem

4. 要删除卷,请使用以下方法之一:
从 Solaris Management Console 中增强的存储工具中,打开“卷”节点。选择“编辑”⇒“删除”,然后按照屏幕上的说明操作。有关更多信息,请参见联机帮助。
          *
使用以下形式的 metaclear 命令删除卷:
metaclear volume-name
有关更多信息,请参见以下示例和 metaclear(1M) 手册页。

示例 9–8 删除串联
# umount d8
# metaclear d8
d8: Concat/Stripe is cleared
(编辑 /etc/vfstab 文件)

此示例说明如何删除包含一个已挂载的文件系统的串联 d8。必须先取消对该文件系统的挂载,才能删除该卷。系统会显示一条确认消息,声明该串联已删除。如果 /etc/vfstab 文件中存在与该卷相对应的项,请删除该项。如果卷已不存在,却要在该卷上挂载文件系统,会使系统出现混乱。

论坛徽章:
0
3 [报告]
发表于 2008-09-26 21:25 |只看该作者
原帖由 云杉上的蝴蝶 于 2008-9-26 02:01 发表
请确认你的操作过程是否正确:
官方文档的相关内容如下:

如何删除 RAID-0 卷

1. 请确保您具有超级用户权限,而且拥有所有数据的最新备份。
2.请确定不再需要该卷。如果删除某个条带或串联并重用已删除卷中的 ...


谢谢回复,我疑问的地方说得比较简单,是这样的:

2个5G的slice扩容后为10G:
/@mysolaris#df -h /mnt
Filesystem             size   used  avail capacity  Mounted on
/dev/md/dsk/d1         9.8G   9.9M   9.7G     1%    /mnt
/@mysolaris#
/@mysolaris#metastat
d1: Concat/Stripe
    Size: 20820240 blocks (9.9 GB)
    Stripe 0:
        Device     Start Block  Dbase   Reloc
        c1t1d0s7          0     No      Yes
    Stripe 1:
        Device     Start Block  Dbase   Reloc
        c1t2d0s7          0     No      Yes

Device Relocation Information:
Device   Reloc  Device ID
c1t1d0   Yes    id1,sd@f0b0d10e948dcd97d000430980002
c1t2d0   Yes    id1,sd@f0b0d10e948dcd97d0005d3050003
/@mysolaris#
取消挂载:
/@mysolaris#umount /mnt
清除raid0:
/@mysolaris#metaclear d1
d1: Concat/Stripe is cleared
/@mysolaris#metastat
/@mysolaris#
直接挂第一个原始片,仍然为10G:
/@mysolaris#mount /dev/dsk/c1t1d0s7 /mnt
/@mysolaris#df -h /mnt
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c1t1d0s7      9.8G   9.9M   9.7G     1%    /mnt
格式化第一个原始片,在挂载:
/@mysolaris#newfs /dev/rdsk/c1t1d0s7
newfs: /dev/rdsk/c1t1d0s7 last mounted as /mnt
newfs: construct a new file system /dev/rdsk/c1t1d0s7: (y/n)? y
/dev/dsk/c1t1d0s7 is mounted, can\'t mkfs
/@mysolaris#umount /mnt
/@mysolaris#newfs /dev/rdsk/c1t1d0s7
newfs: /dev/rdsk/c1t1d0s7 last mounted as /mnt
newfs: construct a new file system /dev/rdsk/c1t1d0s7: (y/n)? y
Warning: 7560 sector(s) in last cylinder unallocated
/dev/rdsk/c1t1d0s7:     10410120 sectors in 689 cylinders of 240 tracks, 63 sectors
        5083.1MB in 99 cyl groups (7 c/g, 51.68MB/g, 6272 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 105936, 211840, 317744, 423648, 529552, 635456, 741360, 847264, 953168,
9425488, 9531392, 9637296, 9743200, 9849104, 9955008, 10060912, 10166816,
10272720, 10378624,
/@mysolaris#mount /dev/dsk/c1t1d0s7 /mnt
此时容量才显示正确:
/@mysolaris#df -h /mnt
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c1t1d0s7      4.9G   5.0M   4.8G     1%    /mnt
/@mysolaris#
我想说的是,slice1和slice2做串联raid0后建文件系统的大小10G;
现在想去掉slice2,就必须格式化slice1重建一个5G的文件系统?不能收缩原来建好的文件系统?

[ 本帖最后由 lovehpw 于 2008-9-26 21:26 编辑 ]

论坛徽章:
10
处女座
日期:2015-01-22 16:08:50技术图书徽章
日期:2018-09-13 11:25:52技术图书徽章
日期:2018-09-13 11:25:45技术图书徽章
日期:2018-09-13 11:25:37技术图书徽章
日期:2018-09-13 11:25:29黑曼巴
日期:2018-06-04 09:03:192017金鸡报晓
日期:2017-01-10 15:19:56极客徽章
日期:2016-12-07 14:03:402015年迎新春徽章
日期:2015-03-04 09:50:28技术图书徽章
日期:2018-09-13 11:26:01
4 [报告]
发表于 2008-09-28 10:43 |只看该作者
学习中。。。。。。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP