Mounting the new filesystem
Following the letter of the law now you should fsck your new filesystem prior to mounting it – feel free. What you really want to do however is mount it so that you check it out. You can actually mount a filesystem on ANY directory, though it ought to be an empty one. There is an empty directory just for this purpose – /mnt;
sun# mount /dev/dsk/c0t1d0s5 /mnt sun# df -k /mnt Filesystem kbytes used avail capacity Mounted on /dev/dsk/c0t1d0s5 2100583 10 2100573 0% /mnt sun# ls -l /mnt total 62 drwxrwxrwx 4 root root 512 Jan 2 1999 lost+found sun# umount /mnt
Here we are using /mnt as a mount point. More about these in The Filesystem explained – Mount Points
When you are content umount the filesystem with ‘umount /mnt’. Now you need to make things permanent – /etc/vfstab.
Swap Partitions – a.k.a. Swap Device
Solaris uses multiple swap partitions in parallel and shifting some of the paging load off the main system disk can make a big difference. By convention swap partitions should be placed on partition #1. This is however only a convention – nothing relies on it.
Notes: | The slightest hiccup on a disk holding a swap partition can cause the system to crash. If you have any doubts about your new disk do not use it for this purpose. |
It doesn’t make any sense to put multiple swap partitions on a single disk – this can actually degrade performance. |
Once you have a partition free and available, you activate it by using the ‘swap -a’ command.
Be very careful here if you get this wrong and specify a partition that has a filesystem on it, well it won’t after this command !
Assuming you have adhered to the convention and defined partition #1 as the swap area then for our example disk the command would be;
sun (ksh) # swap -a /dev/dsk/c0t1d0s1 sun (ksh) #
In classic Unix style swap remains silent if all is well. You can confirm your swap partition is now live with swap -l;
sun (ksh)# swap -l swapfile dev swaplo blocks free /dev/dsk/c0t3d0s1 32,25 8 205624 165408 /dev/dsk/c0t1d0s1 32,9 8 236992 236992
You now need to add it to vfstab.
/etc/vfstab
We are going to make our new filesystem available under a new directory called /data. This doesn’t exist yet so we create it with ‘mkdir /data’. After editing /etc/vfstab the new entry looks like this;
/dev/dsk/c0t1d0s5 /dev/rdsk/c0t1d0s5 /data ufs 3 yes -
The seven fields of vfstab are;
- Block device – used for ‘mount’, and ‘swap’
- Character (raw) device – used by fsck. (for swap partitions this should be «-«)
- Mount point for the file system (for swap partitions ths should be «-«)
- Filesystem type. ‘ufs’ for a filesystem, ‘swap’ for a swap partition.
- fsck pass number. See below
- mount at boot time ? YES|NO
- mount options. See the manual pages for mount(1m) and mount_ufs(1m) for a full list.
After saving it, you should be able to do a ‘mount -a’ and have your new filesystem mounted under /data.. You’ll likely see some warnings about other filesystems already being mounted – these can be safely ignored