//This article contains my personal notes regarding "low level" configuration of Solaris hosts.
I mean stuff that help the operating system boot correctly (except hardware and drivers issues to be found in [[os:solaris:hardware|this page]]: boot loaders, partitioning, mounting partitions, creating file systems... //
====== Boot sectors, boot manager ======
To restore GRUB (and be able to boot Solaris) when @## someone/something has scratched it, do:
* boot from the install CD of Solaris 10
* select "6" for a prompt, single user mode
* restore the boot loader:
installgrub -m /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c0d0s0
NB. installboot is now obsolete.
See more information on [[http://www.sun.com/bigadmin/features/articles/grub_boot_solaris.jsp|BigAdmin]].
====== Partitioning ======
Solaris cuts partition into slices. Those slices are numbered 0 to 7 and they correspond to the 's' of the device (c0t0d0s3 refers to slice number 3). Slice number 2 is reserved and refers to the entire disk by convention.
Slices of a given partition may be listed with **format**.
:!: On Solaris 10, use the command 'print' to show the current layout of a given disk.
partition> print
Current partition table (unnamed):
Total disk cylinders available: 39691 + 2 (reserved cylinders)
Part Tag Flag Cylinders Size Blocks
0 unassigned wm 0 - 27046 13.00GB (27047/0/0) 27263376
1 unassigned wm 0 0 (0/0/0) 0
2 backup wu 0 - 39690 19.08GB (39691/0/0) 40008528
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
partition> 3
Part Tag Flag Cylinders Size Blocks
3 unassigned wm 0 0 (0/0/0) 0
Enter partition id tag[unassigned]:
Enter partition permission flags[wm]:
Enter new starting cyl[0]: 27047
Enter partition size[0b, 0c, 27047e, 0.00mb, 0.00gb]: 39690e
partition> print
Current partition table (unnamed):
Total disk cylinders available: 39691 + 2 (reserved cylinders)
Part Tag Flag Cylinders Size Blocks
0 unassigned wm 0 - 27046 13.00GB (27047/0/0) 27263376
1 unassigned wm 0 0 (0/0/0) 0
2 backup wu 0 - 39690 19.08GB (39691/0/0) 40008528
3 unassigned wm 27047 - 39690 6.08GB (12644/0/0) 12745152
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
partition> label
Ready to label disk, continue? yes
partition> quit
format> volname
Enter 8-character volume name (remember quotes)[""]:secondar
Ready to label disk, continue? yes
:!: On OpenSolaris, use **verify**.
axelle@boureautic:~# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c3d0
/pci@0,0/pci-ide@12/ide@0/cmdk@0,0
Specify disk (enter its number): 0
[...]
format> verify
Primary label contents:
Volume name = < >
ascii name =
pcyl = 6375
ncyl = 6373
acyl = 2
bcyl = 0
nhead = 255
nsect = 63
Part Tag Flag Cylinders Size Blocks
0 root wm 1 - 6371 48.80GB (6371/0/0) 102350115
1 unassigned wm 0 0 (0/0/0) 0
2 backup wu 0 - 6372 48.82GB (6373/0/0) 102382245
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 7.84MB (1/0/0) 16065
9 unassigned wm 0 0 (0/0/0) 0
====== ZFS ======
//ZFS is awesome !//
===== Pools =====
The good news about ZFS is that it's as great as expected.
Storage units may span over partitions: several disks, devices, partitions and even files can be gathered in a single zfs pool, and then, from that pool virtual disk spaces can be provided the way you want.
zpool create -f pool c0d0s6 c0d0s7
Devices can easily be set for mirroring or RAIDZ. It's as simple as adding a keyword to the command. However, make sure mirroring or raidz is what you need. For instance, my c0d0s6 slice has 15G and c0d0s7 has 17G. If I mirror them, I basically "lose" 2G in the second array. That's not something I want at home (at work, the answer might be different).
zpool create -f pool raidz c0d0s6 c0d0s7
zfs list
NAME USED AVAIL REFER MOUNTPOINT
pool 87K 15,3G 24,5K /pool
zfs destroy pool
zpool create -f pool c0d0s6 c0d0s7
zfs list
NAME USED AVAIL REFER MOUNTPOINT
pool 87K 32,5G 24,5K /pool
It's very easy to set compression, quotas
zfs set compression=on pool
This is the configuration I use:
# zpool create -f pool c0d0s6 c0dà s7
# zfs create pool/axelle
# zfs create pool/opt
# zfs set mountpoint=/opt pool/opt
# zfs set compression=on pool
# zfs set mountpoint=/export/home/axelle pool/axelle
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
pool 197K 37.3G 24.5K /pool
pool/axelle 24.5K 37.3G 24.5K /export/home/axelle
pool/opt 24.5K 37.3G 24.5K /opt
Note before creating the pool, the two slices c0d0s6 & c0d0s7 should be backuped, unmounted and removed from /etc/vsftab. Then, once the pool is created, the original content can be restored.
Also, mountpoints are acceptable only if they exist: make sure /export/home/axelle exists first.
===== Snapshots =====
* Setting up snapshots: time-slider-setup
* Mounting a ZFS pool:
zfs import -r
* Listing snapshots in a given pool:
zfs list -t snapshot
* Restoring a given snapshot:
zfs rollback -rRf
====== Mounting partitions ======
To mount existing partitions:
* UFS: default file system for Solaris, no need to specify file system type: mount /dev/dsk/... /mountpoint
* FAT: use 'pcfs' file system type. If the partition is located in a primary partition (number N - for PCs between 1 and 4), you can simply mount that partition:
mount -F pcfs /dev/dsk/c0d0pN /mountpoint
However, there's another way to mount that partition: c0d0p0:. The letter ranges from c to z, and the number starts at 1. To select the first FAT partition: c0d0p0:1 or c0d0p0:c will do the trick. To select the second partition: c0d0p0:2 or c0d0p0:d. Note it's always p0.
Beware: the letter won't always match the Windows unit drive. If your first unit drive (C:\) is a NTFS, then D:\ is FAT and E:\ is FAT, the first FAT partition is D:\ ... but to mount it in Solaris use c0d0p0:1 or c0d0p0:c !
This method is particularly useful to mount partitions located within extended partition, because there's no way to address the partition directly with a c0d0pN.
* NTFS: not supported by Solaris
For automatic mounting, add an entry to /etc/vfstab:
/dev/dsk/c0d0p3 /dev/rdsk/c0d0p3 /mnt/win_e pcfs 3 yes
To mount a file as a filesystem, use lofiadm (loopback file driver). I haven't tried that yet, but [[http://blogs.sun.com/reed/entry/lofiadm_loopback_file_driver|see instructions here]].
* Samba: this is a nice solution to mount remote Windows shares.
pfexec mount -f smbfs //host/share /mntpoint
To do so, the samba client service must be started:
pfexec svcadm enable svc:/network/smb/client:default
====== Mounting a USB card ======
Plug it in, and then check where it has been mounted using **df -h**. My mobile phone is mounted in /rmdisk/noname .
====== Mounting a USB IOMEGA drive ======
Plug it in. It automatically mounts in /media/IOMEGA_HDD on my system.
====== Zones ======
My husband's installed a Solaris Zone containing Linux.
TODO
[[http://wikis.sun.com/display/chosug/Installing+a+Linux+Zone|Linux Zone]]
{{tag>solaris opensolaris usb iomega card linux zone rmdisk grub boot sector loader installgrub installboot slices device disk partition format print cylinder verify zfs pool raid mirror quota compression snapshot rollback time-slider-setup mount UFS FAT pcfs ntfs pfexec lofiadm loopback filesystem}}