Solaris格式化新磁盘-阿里云开发者社区

开发者社区> 开发与运维> 正文

Solaris格式化新磁盘

简介:
# df -k  
文件系统              千字节    用了    可用 容量      挂接在
/dev/dsk/c0d0s0      7879079 3957379 3842910    51%    /
/devices                   0       0       0     0%    /devices
ctfs                       0       0       0     0%    /system/contract
proc                       0       0       0     0%    /proc
mnttab                     0       0       0     0%    /etc/mnttab
swap                 1108972     960 1108012     1%    /etc/svc/volatile
objfs                      0       0       0     0%    /system/object
sharefs                    0       0       0     0%    /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap1.so.1
                     7879079 3957379 3842910    51%    /lib/libc.so.1
fd                         0       0       0     0%    /dev/fd
swap                 1108092      80 1108012     1%    /tmp
swap                 1108036      24 1108012     1%    /var/run
/dev/dsk/c0d0s7      1478063    1505 1417436     1%    /export/home
这里只用了一张盘c0d0.  现在格式化第二张盘c2d0
# format
Searching for disks...done

AVAILABLE DISK SELECTIONS:
       0. c0d0 <DEFAULT cyl 1302 alt 2 hd 255 sec 63>
          /pci@0,0/pci-ide@7,1/ide@0/cmdk@0,0
       1. c2t0d0 <DEFAULT cyl 4093 alt 2 hd 128 sec 32>
          /pci@0,0/pci1000,30@10/sd@0,0
Specify disk (enter its number): 1     #这里选择第二张盘。
selecting c2t0d0
[disk formatted]

FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        fdisk      - run the fdisk program
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> p
WARNING - This disk may be in use by an application that has
          modified the fdisk table. Ensure that this disk is
          not currently in use before proceeding to use fdisk.
format> fdisk
No fdisk table exists. The default partition for the disk is:
  a 100% "SOLARIS System" partition
Type "y" to accept the default partition,  otherwise type "n" to edit the
 partition table.
# 在partition之前,必须建立fdisk分区。我们可以选YES,让整张盘都成SOLARIS fdisk分区。
#这里我们选No,看会怎么样.
n
             Total disk size is 4095 cylinders
             Cylinder size is 4096 (512 byte) blocks
                                               Cylinders
      Partition   Status    Type          Start   End   Length    %
      =========   ======    ============  =====   ===   ======   ===
          1       Active    Solaris2          1  3890    3890     95
          2                 Solaris2       3891  4053     163      4
 

SELECT ONE OF THE FOLLOWING:
   1. Create a partition
   2. Specify the active partition
   3. Delete a partition
   4. Change between Solaris and Solaris2 Partition IDs
   5. Exit (update disk configuration and exit)
   6. Cancel (exit without updating disk configuration)
Enter Selection: 5  
#在这里我们建了两个Solaris2 fdisk.因为Solaris这里每次总是把上一条记录抹去,所以过程没记录下来。
#选择5保存退出。
format> p

PARTITION MENU:
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        7      - change `7' partition
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        !<cmd> - execute <cmd>, then return
        quit
partition> p
Current partition table (original):
Total disk cylinders available: 3888 + 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 - 3887        7.59GB    (3888/0/0) 15925248
  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        2.00MB    (1/0/0)        4096
  9 unassigned    wm       0               0         (0/0/0)           0
partition> 0
Part      Tag    Flag     Cylinders        Size            Blocks
  0 unassigned    wm       0               0         (0/0/0)           0
Enter partition id tag[unassigned]: usr   
Enter partition permission flags[wm]: 
Enter new starting cyl[1]: 3
Enter partition size[0b, 0c, 3e, 0.00mb, 0.00gb]: 3072mb
partition> p
Current partition table (unnamed):
Total disk cylinders available: 3888 + 2 (reserved cylinders)
Part      Tag    Flag     Cylinders        Size            Blocks
  0        usr    wm       3 - 1538        3.00GB    (1536/0/0)  6291456
  1 unassigned    wm       0               0         (0/0/0)           0
  2     backup    wu       0 - 3887        7.59GB    (3888/0/0) 15925248
  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        2.00MB    (1/0/0)        4096
  9 unassigned    wm       0               0         (0/0/0)           0
partition> 1
Part      Tag    Flag     Cylinders        Size            Blocks
  1 unassigned    wm       0               0         (0/0/0)           0
Enter partition id tag[unassigned]: usr
Enter partition permission flags[wm]: 
Enter new starting cyl[1]: 1539
Enter partition size[0b, 0c, 1539e, 0.00mb, 0.00gb]: 3887e
partition> p
Current partition table (unnamed):
Total disk cylinders available: 3888 + 2 (reserved cylinders)
Part      Tag    Flag     Cylinders        Size            Blocks
  0        usr    wm       3 - 1538        3.00GB    (1536/0/0)  6291456
  1        usr    wm    1539 - 3887        4.59GB    (2349/0/0)  9621504
  2     backup    wu       0 - 3887        7.59GB    (3888/0/0) 15925248
  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        2.00MB    (1/0/0)        4096
  9 unassigned    wm       0               0         (0/0/0)           0
format> label  #标记磁盘
Ready to label disk, continue? yes
format> save 
Saving new disk and partition definitions
Enter file name["./format.dat"]:
format> quit
#这样就有两个磁盘分区C2t0d0s0 c2t0d0s1,格式化之后,即可以挂载目录.
 
本文转自 anranran 51CTO博客,原文链接:http://blog.51cto.com/guojuanjun/321054


版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

分享:
开发与运维
使用钉钉扫一扫加入圈子
+ 订阅

集结各类场景实战经验,助你开发运维畅行无忧

其他文章