Sunday 29 July 2012

Adding Storage Devices

Adding Storage in Solaris.

To install a new hard drive on a Solaris 10 system, just follow these steps:

1. Prepare the system for a reconfiguration boot by issuing the command

server# touch /reconfigure

2. Synchronize disk data and power down the system using the commands

server# sync; sync; sync; shutdown

3. Switch off power to the system and attach the new hard disk to the external
SCSI chain, or install it internally into an appropriate disk bay.

4. Check that the SCSI device ID does not conflict with any existing SCSI devices.
If a conflict exists, simply change the ID by using the switch.

5. Power on the system and use the boot command to load the kernel, if the
OpenBoot monitor appears:

ok boot

The next step—assuming that you have decided which partitions you want to
create on your drive, using the information supplied earlier—is to run the format
program. In addition to creating slices, format also displays information about
existing disks and slices and can be used to repair a faulty disk. When format is
invoked without a command-line argument.


# format

Searching for disks...done


AVAILABLE DISK SELECTIONS:
0. c1t0d0 
/pci@0,0/pci15ad,1976@10/sd@0,0
1. c1t1d0 
/pci@0,0/pci15ad,1976@10/sd@1,0
2. c1t2d0 
/pci@0,0/pci15ad,1976@10/sd@2,0
Specify disk (enter its number):2

or

# format /dev/rdsk/c1t2d0

After selecting the appropriate disk, the message
[disk formatted]
appears if the disk has previously been formatted. This is an important message, because
it is a common mistake to misidentify a target disk from the available selection of both
formatted and unformatted disks. The menu looks like this:

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
show - translate a disk address
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
volname - set 8-character volume name
! - execute , then return
quit


format>

If the disk has not been formatted, the first step is to prepare the disk to contain
slices and file systems by formatting the disk. To do so, issue the command format:

format> format
Ready to format. Formatting cannot be interrupted
and takes 46 minutes (estimated). Continue? y
Beginning format. The current time is Tue Feb 1 07:10:39 2011

Formatting...
done

Verifying media...
pass 0 - pattern = 0xc6dec6de
1020/62/26

pass 1 - pattern = 0x6db6db6d
1020/62/26

Total of 0 defective blocks repaired.

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. y

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> print
Current partition table (original):
Total disk cylinders available: 1020 + 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 - 1019 1020.00MB (1020/0/0) 2088960
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 1.00MB (1/0/0) 2048
9 unassigned wm 0 0 (0/0/0) 0


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 - 295 296.00MB (296/0/0) 606208
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 1.00MB (1/0/0) 2048
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]? 0
Enter size of partition '1' [0b, 0c, 0.00mb, 0.00gb]: 100.00mb
Enter size of partition '3' [0b, 0c, 0.00mb, 0.00gb]: 100.00mb
Enter size of partition '4' [0b, 0c, 0.00mb, 0.00gb]: 95.00mb
Warning: no space available for '5' from Free Hog partition
Warning: no space available for '6' from Free Hog partition
Warning: no space available for '7' from Free Hog partition

Part Tag Flag Cylinders Size Blocks
0 root wm 0 0 (0/0/0) 0
1 swap wu 1 - 100 100.00MB (100/0/0) 204800
2 backup wu 0 - 295 296.00MB (296/0/0) 606208
3 unassigned wm 101 - 200 100.00MB (100/0/0) 204800
4 unassigned wm 201 - 295 95.00MB (95/0/0) 194560
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 1.00MB (1/0/0) 2048
9 alternates wm 0 0 (0/0/0) 0

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

Ready to label disk, continue? y

partition> print
Current partition table (new_disks):
Total disk cylinders available: 296 + 2 (reserved cylinders)

Part Tag Flag Cylinders Size Blocks
0 unassigned wm 0 0 (0/0/0) 0
1 unassigned wm 1 - 100 100.00MB (100/0/0) 204800
2 backup wu 0 - 295 296.00MB (296/0/0) 606208
3 unassigned wm 101 - 200 100.00MB (100/0/0) 204800
4 unassigned wm 201 - 295 95.00MB (95/0/0) 194560
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 1.00MB (1/0/0) 2048
9 unassigned wm 0 0 (0/0/0) 0

partition> q


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> q


To view the disk label,
use the prtvtoc command. Here’s the output from the primary drive in an x86 system:

# prtvtoc /dev/dsk/c1t2d0s1
* /dev/dsk/c1t2d0s1 partition map
*
* Dimensions:
* 512 bytes/sector
* 32 sectors/track
* 64 tracks/cylinder
* 2048 sectors/cylinder
* 298 cylinders
* 296 accessible cylinders
*
* Flags:
* 1: unmountable
* 10: read-only
*
* First Sector Last
* Partition Tag Flags Sector Count Sector Mount Directory
1 0 00 2048 204800 206847
2 5 01 0 606208 606207
3 0 00 206848 204800 411647
4 0 00 411648 194560 606207
8 1 01 0 2048 2047



After saving the changes to the disk’s partition table, exit the format program and
create a new UFS file system on the target slice by using the newfs command:


# newfs /dev/rdsk/c1t2d0s1
newfs: construct a new file system /dev/rdsk/c1t2d0s1: (y/n)? y
/dev/rdsk/c1t2d0s1: 204800 sectors in 100 cylinders of 64 tracks, 32 sectors
100.0MB in 7 cyl groups (16 c/g, 16.00MB/g, 7680 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 32832, 65632, 98432, 131232, 164032, 196832,

# newfs /dev/rdsk/c1t2d0s3
newfs: construct a new file system /dev/rdsk/c1t2d0s3: (y/n)? y
/dev/rdsk/c1t2d0s3: 204800 sectors in 100 cylinders of 64 tracks, 32 sectors
100.0MB in 7 cyl groups (16 c/g, 16.00MB/g, 7680 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 32832, 65632, 98432, 131232, 164032, 196832,

# newfs /dev/rdsk/c1t2d0s4
newfs: construct a new file system /dev/rdsk/c1t2d0s4: (y/n)? y
/dev/rdsk/c1t2d0s4: 194560 sectors in 95 cylinders of 64 tracks, 32 sectors
95.0MB in 6 cyl groups (16 c/g, 16.00MB/g, 7680 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 32832, 65632, 98432, 131232, 164032,


After a new file system is constructed, it is ready to be mounted. First, a mount point
is created:

# mkdir /u04 /u05 /u06

followed by the appropriate mount command:

# mount /dev/dsk/c1t2d0s1 /u04
# mount /dev/dsk/c1t2d0s3 /u05
# mount /dev/dsk/c1t2d0s4 /u06


# df -h
Filesystem size used avail capacity Mounted on
/dev/dsk/c1t0d0s0 23G 7.2G 15G 33% /
/devices 0K 0K 0K 0% /devices
ctfs 0K 0K 0K 0% /system/contract
proc 0K 0K 0K 0% /proc
mnttab 0K 0K 0K 0% /etc/mnttab
swap 2.2G 916K 2.2G 1% /etc/svc/volatile
objfs 0K 0K 0K 0% /system/object
sharefs 0K 0K 0K 0% /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap1.so.1
23G 7.2G 15G 33% /lib/libc.so.1
fd 0K 0K 0K 0% /dev/fd
swap 2.2G 40K 2.2G 1% /tmp
swap 2.2G 36K 2.2G 1% /var/run
/hgfs 16G 4.0M 16G 1% /hgfs
/dev/dsk/c1t2d0s1 93M 1.0M 83M 2% /u04
/dev/dsk/c1t2d0s3 93M 1.0M 83M 2% /u05
/dev/dsk/c1t2d0s4 89M 1.0M 79M 2% /u06



At this point, the disk is available to the system for the current session. However, if
you want the disk to be available after reboot, you need to create an entry in the virtual
file systems table, which is created from the /etc/vfstab file. An entry like this,


/dev/dsk/c1t2d0s1 /dev/rdsk/c1t2d0s1 /u04 ufs 2 yes -
/dev/dsk/c1t2d0s3 /dev/rdsk/c1t2d0s3 /u05 ufs 2 yes -
/dev/dsk/c1t2d0s4 /dev/rdsk/c1t2d0s4 /u06 ufs 2 yes -




II) Adding Storage in Linux.

1) Shutdown the Linux server.
2) Add the storage disk to the linux server and boot the server.
3) Check the storage which been added as below and partition it.

# fdisk -l

# fdisk /dev/sdb

Once the device is partitioned then make a new file system using
that device.

# mkfs.ext3 /dev/sdb1

After creating the file system create an directory and mount the
device to that directory.


# mkdir /u02

# mount /dev/sdb1 /u02



Now the device has been mounted to the /u02 partition. Add the
below entry in /etc/fstab file inorder to mount the partition
after reboot.


# vi /etc/fstab

/dev/sdb1 /u02 ext3 defaults 1 2

-----------------------------------------------------------------

No comments:

Post a Comment