Add disks, partitions, mounting, and automatic mounting on the Solaris System

Source: Internet
Author: User

I. hardware environment

Solaris10u9 installed in VM VirtualBox

Ii. Experiment steps

1. Find the corresponding system in VM VirtualBox, right-click and select "Storage", right-click "Controller: SATA"-> "add virtual hard disk"->

"Create a new virtual hard disk"-> VDI-> Dynamic Allocation-> 1 GB. Start Solaris.

2. Here, we can use SecureCRT to remotely connect to Solaris. By default, Solaris does not allow remote logon. We need to modify the configuration file and pay attention to the backup during modification.

# Cd/etc/ssh

# Cp sshd_config sshd_config.bk

# Vi sshd_config

In row 3, change PermitRootLogin no to yes. After saving and exiting, svcadm refresh ssh refresh the ssh protocol configuration file. Now, we can change the network in the VM VirtualBox to "Host-Only adapter". You can use ifconfig-a to view the IP address of the current machine, then use SecureCRT to connect. (If the connection fails, check whether the ip addresses of the Host ip address and VirtualBox Host-Only Network are in one CIDR block)

3. Now let's look at the current hard disk.

Format

What should we do if the hard disk we just added is not displayed?

Devfsadm

We use this command to let the machine detect newly added devices. Now, use format to check the hard disk I just added. In my experiment, the new hard disk is c0t3d0.

Next, Specify disk (enter its number): 2

At the format prompt, "No fdisk table exists..." will appear on fdisk, which means that the partition table cannot be found on Solaris. We select "y" to continue writing to a partition table. Fdisk is the default Partition Table written to the hard disk. Each hard disk only needs to be executed once when it is added for the first time.

Next, press p and select a partition table. Run the partition prompt and press p to print the current table. Partitions 2, 8, and 9 cannot be used here.

Now I want to partition 0,

Partition> 0

Enter partition id tag [unassigned]: Enter (default)

Enter partition permission flags [wm]: Press Enter (default read/write permission)

Enter new starting cy1 [0]: 0 (start cylindrical)

Enter partition size [0b, 0c, 0e, 0.00 mb, 0.00 gb]: 500 mb (partition size 0)

Now partition 0 is complete. print it and check that partition 0 has MB. Now, I repeat the same action to allocate 500 mb for the No. 1 partition. Be sure to select the right option for the start cylindrical partition.

Now I want to save the operation we just made,

Partition> l (lower case L)

Ready to label disk, continue? Y

Okay. Now we quit.

Next we will format the partition.

Df-h to view the mounting information.

/Dev/dsk/c0t0d0s0 19G 3.9G 15G 21%/

This indicates that/is mounted to/dev/dsk/c0t0d0s0.

Mkdir/disk2: Create a disk2 folder under the root. After formatting the partition, Mount partition 0 to/disk2.

Okay, you don't need to talk about it. format it below.

# Newfs/dev/rdsk/c0t3d0s0

Newfs: construct a new file system/dev/rdsk/c0t3d0s0 :( y/n )? Y

This is a bare device. It must be an rdsk instead of a dsk. For details, see du Niang.

Before mounting, I first create a file in/disk2,

Echo "Hello World">/disk2/file1

Now I mount the formatted partition 0 to disk2.

Mount/dev/dsk/c0t3d0s0/disk2

When mount:/dev/dsk/c0t3d0s0 is already mounted or/disk2 is busy appears, it must be returned to another directory, not in the/disk2 directory.

After the mounting is successful, we have cd/disk2, which does not contain file1, because a new partition is mounted. Now we can create another file here.

Echo "Programming is interesting"> file2

So does file1 still exist? Yes. We can unmount the partition to see the result.

Umount/disk2

Now cd/disk2, we found that there is another file1, and cat file1 is also correct, it is "Hello World ".

4. Next, let's look at the topic: start mounting.

After the above steps are completed, we can mount them at will, but after we restart, we found that the original mounted directory was not mounted yet? We can use df-h to view the mounting information.

You can modify the/etc/vfstab configuration file to enable the mounting on the machine. Before modification, we 'd better back up the data.

Cp/etc/vfstab. bk

Then, vi/etc/vfstab

Add the last line:

/Dev/dsk/c0t3d0s0/dev/rdsk/c0t3d0s0/disk2 ufs 3 yes-

Parameter description: du Niang or Google. Save and exit. After reboot is restarted, you will find that the disk has been automatically mounted.

(Note: unmount may fail. You can use fuser-k/disk2 to kill irrelevant users and then unmout. fuser is the meaning of fuck user --!)

Recommended: Add a NIC record for Solaris In the vmwarevm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.