Analytics


Google

Friday, October 2, 2009

Mounting a new drive in Sun Solaris

If you are creating a new virtual drive in VMWare or installing a new disk, you need to first detech the disk. This can be done with the command:

#devfsadm -v

Once you detect the disk you can then format the disk using the format command:

#format

Screen example shown below:



# format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
0. c1t0d0

/pci@0,0/pci15ad,1976@10/sd@0,0
1. c1t1d0
testVol
/pci@0,0/pci15ad,1976@10/sd@1,0
Specify disk (enter its number):
1
selecting c1t1d0:
testVol
[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
!
- execute , then return
quit

format> partition


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
!
- execute , then return
quit

partition> modify
Select partitioning base:
0. Current partition table (original)
1. All Free Hog
Choose base (enter number) [0]?
1

Part Tag Flag Cylinders Size Blocks
0 root wm 0 0 (0/0/0) 0
1 swap wu 0 0 (0/0/0) 0
2 backup wu 0 - 1301 9.97GB (1302/0/0) 20916630
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 usr 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 alternates wm 0 0 (0/0/0) 0

Do you wish to continue creating a new partition
table based on above table[yes]?

Free Hog partition[6]?
Enter size of partition '0' [0b, 0c, 0.00mb, 0.00gb]:
Enter size of partition '1' [0b, 0c, 0.00mb, 0.00gb]:
Enter size of partition '3' [0b, 0c, 0.00mb, 0.00gb]:
Enter size of partition '4' [0b, 0c, 0.00mb, 0.00gb]:
9.9gb
Enter size of partition '5' [0b, 0c, 0.00mb, 0.00gb]:
Enter size of partition '7' [0b, 0c, 0.00mb, 0.00gb]:

Part Tag Flag Cylinders Size Blocks
0 root wm 0 0 (0/0/0) 0
1 swap wu 0 0 (0/0/0) 0
2 backup wu 0 - 1301 9.97GB (1302/0/0) 20916630
3 unassigned wm 0 0 (0/0/0) 0
4 unassigned wm 1 - 1293 9.90GB (1293/0/0) 20772045
5 unassigned wm 0 0 (0/0/0) 0
6 usr wm 1294 - 1301 62.75MB (8/0/0) 128520
7 unassigned wm 0 0 (0/0/0) 0
8 boot wu 0 - 0 7.84MB (1/0/0) 16065
9 alternates wm 0 0 (0/0/0) 0

Okay to make this the current partition table[yes]?
Enter table name (remember quotes):
"testDisk"

Ready to label disk, continue? yes

partition> quit


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
!
- execute , then return
quit
format>
save
Saving new disk and partition definitions
Enter file name["./format.dat"]:

format> quit


Next create a file system:

# newfs c1t1d0s4

note that you use the device name you see in the format screen and add s4 for the slice 4 (or partition 4).

Screenshot below:



newfs: /dev/rdsk/c1t1d0s4 last mounted as
newfs: construct a new file system /dev/rdsk/c1t1d0s4: (y/n)? y
Warning: 820 sector(s) in last cylinder unallocated
/dev/rdsk/c1t1d0s4: 20772044 sectors in 3381 cylinders of 48 tracks, 128 sectors
10142.6MB in 212 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,
19858720, 19957152, 20055584, 20154016, 20252448, 20350880, 20449312,
20547744, 20646176, 20744608






checking the disk is optional:

# fsck /dev/rdsk/c1t1d0s4


** /dev/rdsk/c1t1d0s4
** Last Mounted on
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3a - Check Connectivity
** Phase 3b - Verify Shadows/ACLs
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cylinder Groups
2 files, 9 used, 10228265 free (17 frags, 1278531 blocks, 0.0% fragmentation)




Next make the mount mount - using mkdir
# mkdir tmpMount

Finally, mount the new disk

# mount /dev/dsk/c1t1d0s4 /tmpMount





No comments: