Monday 28 May 2012

Moving /usr, /var & /opt to a different partition in Solaris


1. Add new hard drive to make new partitions

2. Boot server with cdrom in single user mode # boot cdrom –s

3. Mount the partition where we are copying from # mount –o rw /dev/dsk/c1t0d0s0 /mnt

4. Mount the partition where we are copying to # mount –o rw /dev/dsk/c1t2d0s0 /mnt/test

5. Go to /mnt/test folder – # cd /mnt/test

6. Run this command to copy stuff # ufsdump 0f - /mnt/usr | ufsrestore rf –

7. Go to # cd /mnt/test/usr and run “mv * ..”

8. The above step copy all files form usr sub folder to root folder

9. Go to # cd /mnt/test

10. Make a dir local # mkdir /mnt/test/local

11. Type cd /

12. # umount /mnt/test

13. DO above steps from 4 to 9 for moving var folder

14. Creat a subfolder “run” under /var folder on new partition /mnt/test # mkdir /mnt/test/run . This is very critical for coming root in multiuser mode.

15. Type cd /

16. #umount /mnt/test

17. Do above steps for moving “opt” folder for steps 4 to 12 except step 10

18. Type cd / ; #umount /mnt/test

19. Now go to the /mnt folder (Which is the main root file system)

20. Move directories to # mv usr usr.bak ; # mv var var.bak ; # mv opt opt.bak to roll back all changes if needed

21. Create usr, var and opt folders # mkdir usr, #mkdir var; #mkdir opt

22. Some time the newly created usr folder needs these parameters to set # chown root /mnt/usr; #chgrp sys /mnt/sys; #chmod 755 /mnt/usr

23. Modify the vfstab file # EDITOR=vi; # export vi; # TERM=vt100; # export TERM; # vi /mnt/etc/vfstab and do respect changes

24. Do not forget “-“ mount option at the end and it looks like

25. “ /dev/dsk/c1t2d0s0 /dev/rdsk/c1t2d0s0 /usr ufs 1 no - “

26. Reboot or STOP +a boot -ar

No comments:

Post a Comment

Tweets by @sriramperumalla