Howto Unmirror a File System That Cannot Be Unmounted Solaris 10

Use this task to unmirror file systems, including root (/), /usr, /opt, and swap, that cannot be unmounted during normal system operation.

  1. Make sure that you have root privilege and that you have a current backup of all data.
  2. Verify that at least one submirror is in the Okay state.
  3. # metastat mirror

  4. Detach the submirror that will continue to be used for the file system.
  5. # metadetach mirror submirror

  6. Use one of the following commands, depending the file system you want to unmirror:
    • For the /usr, /opt, or swap file systems, change the file system entry in the /etc/vfstab file to use a non-Solaris Volume Manager device (slice).
    • For the root (/) file system only: run the metaroot command.
  7. # metaroot rootslice

  8. Reboot the system.
  9. # reboot

  10. Clear the remaining mirror and submirrors.
  11. # metaclear -r mirror

Example Unmirroring the root (/) File System

# metastat d0
d0: Mirror
Submirror 0: d10
State: Okay
Submirror 1: d20
State: Okay
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 40541184 blocks (19 GB)

d10: Submirror of d0
State: Okay
Size: 40541184 blocks (19 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0t0d0s0 0 No Okay Yes

d20: Submirror of d0
State: Okay
Size: 40541184 blocks (19 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0t1d0s0 0 No Okay Yes

# metadetach d0 d20
d0: submirror d20 is detached

# metaroot /dev/dsk/c0t0d0s0

# reboot

# metaclear -r d0
d0: Mirror is cleared
d10: Concat/Stripe is cleared

# metaclear d20
d20: Concat/Stripe is cleared

Example Unmirroring the swap File System

# metastat d1
d1: Mirror
Submirror 0: d11
State: Okay
Submirror 1: d21
State: Okay

# metadetach d1 d21
d1: submirror d21 is detached

Edit the /etc/vfstab file to change the entry for swap from metadevice to slice name

# vi /etc/vfstab

In this example, the /etc/vfstab file contains the following entry for the swap file system:

/dev/md/dsk/d1 – – swap – no –

Change the entry to read as follows:

/dev/dsk/c0t0d0s1 – – swap – no –

# reboot

# metaclear -r d1
d1: Mirror is cleared
d11: Concat/Stripe is cleared

# metaclear d21
d21: Concat/stripe is cleared

Howto Unmirror a File System that can be unmounted Solaris 10

Use this procedure to unmirror a file system that can be unmounted while the system is running.
To unmirror root (/), /var, /usr, or swap, or any other file system that cannot be unmounted while the system is running

  1. Make sure that you have root privilege and that you have a current backup of all data.
  2. Verify that at least one submirror is in the Okay state.
  3. # metastat mirror

  4. Unmount the file system.
  5. # umount /file-system

  6. Detach the submirror that will continue to be used for the file system.
  7. # metadetach mirror submirror

  8. Clear the mirror and remaining subcomponents.
  9. # metaclear -r mirror

  10. Edit the /etc/vfstab file to use the component detached in Step4 , if necessary.
  11. Remount the file system.

# mount /file-system

Example : Unmirroring the /opt File System

# metastat d3
d3: Mirror
Submirror 0: d13
State: Okay
Submirror 1: d23
State: Okay
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 31464192 blocks (15 GB)

d13: Submirror of d3
State: Okay
Size: 31464192 blocks (15 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0t0d0s3 0 No Okay Yes

d23: Submirror of d3
State: Okay
Size: 31464192 blocks (15 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0t1d0s3 0 No Okay Yes

# umount /opt

# metadetach d3 d13
d3: submirror d13 is detached

# metaclear -r d3
d3: Mirror is cleared
d23: Concat/Stripe is cleared

Edit the /etc/vfstab file so that the entry for /opt is changed from d3 to the underlying slice or volume

# mount /opt

Reset Password root Solaris 10

Sering sekali saya menemui kasus dimana seorang administrator lupa akan password root di salah satu mesin/server, mungkin dikarenakan banyaknya server/mesin yang mereka handle, walau sebenarnya hal ini tidak boleh terjadi 🙁

Nah dalam tulisan ini saya ingin mendokumentasikan howto tentang me-reset password root di mesin solaris 10

  1. Masuk ke OK prompt (bisa melalui halt, init 0 atau STOP + A)
  2. Booting ke cdrom dan masuk ke single user
  3. ok> boot cdrom -s

  4. Check slice root dengan command “fsck”
  5. # fsck -y /dev/rdsk/c0t0d0s0 (Letak slice root)

  6. Mount slice root ke /mnt (atau /a)
  7. # mount /dev/dsk/c0t0d0s0 /mnt

  8. Masuk ke direktori /etc
  9. # cd /mnt/etc

  10. Untuk kemudahan penggunaan terminal ada baiknya kita export terminal terlebih dahulu
  11. TERM=sun
    export TERM

  12. Edit /etc/shadow (letak password root yang telah di enkrip)
  13. # vi shadow

  14. Hapus password root yg telah di enkrip (di kolom kedua)
  15. ….
    root:(hapus):
    ….

  16. Masuk ke home directory root
  17. # cd

  18. Umount mounting slice root yang tadi di mount ke /mnt
  19. # umount /mnt

  20. Restart komputer (seharusnya nanti akan langsung masuk ke Solaris, tanpa ditanyakan password)
  21. # reboot

  22. Set ulang password root
  23. # passwd

Howto SUNWexplo Solaris 10

Download paket SUNWexplo di website sun atau bisa juga diinstall dari DVD Solaris nya.

Extract file SUNWexplo.tar.Z:

# zcat SUNWexplo.tar.Z | tar xvf –

Install paket SUNWexplo:

# pkgadd -d . SUNWexplo

Jalankan SUNWexplo untuk meng-collect data-data mesin yang terinstall Solaris.

# /opt/SUNWexplo/bin/explorer

Output dari aplikasi ini di simpan dalam direktori /opt/SUNWexplo/output/explorer.XXXX dimana XXXX ini adalah angka-angka yang menidentifikasikan serial number mesin dan nama hostname.

ACL – Solaris 10

Little documentation about ACL at Solaris 10 🙂

(-) The following example shows you how to substitute an ACL on the file named file1. The ACL permissions are configured as follows:

  • The file owner has read, write, and execute permissions
  • The group has read and write permissions
  • The other users have read-only permissions
  • The user named user1 has read, write, and execute permissions on the file
  • The ACL mask has read and write permissions
  • The user named user1 has read, write, and execute permissions

Perform the setfacl command with the following options to substitute an ACL on file1:

# setfacl -s u::rwx,g::rw-,o:r–,m:rw-,u:user1:rwx file1

Or using this command :

# setfacl -s u::7,g::6,o:4,m:6,u:user1:7 file1

(-) Command copies the ACL entries from the file named file1 to the file named file2

# getfacl file1 | setfacl -f – file2