Solaris / OpenSolarisThis forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
Rep:
The problem here is you cannot have two Solaris fdisk (i.e. primary) partitions.
Solaris ufs filesystems are designed to be created on slices which are subdivisions of "the" Solaris partition. Newfs is expecting c0d0s* names, not c0d0p*.
However, newfs is accepting to create a partition on a lofs mounted file, so a trick I'm using to build an ufs filesystem on a primary partition is to first create a file of the same size that the partition (or smaller but not bigger), to mount this file as a device with lofs (man lofiadm), to newfs the device and finally to copy (dd) this file to the partition device.
After that, Solaris has no problem mounting the partition as ufs.
Another trick is to use a sparse file (mkfile -n) instead of a whole one, as it's hard to find free space on a filesystem a large as the size of a partition ...
When we decide to remove one of the operating systems or just free one of the partitions and dedicate it for Solaris we can get into troubles if that free space is on the same hard disk drive where Solaris is installed. The problem is the second Solaris partition can not be addressed using usual Solaris addressing schema.
Solaris partition can not be resized, besides, the hole and the Solaris partition need not to be placed side by side. One workaround is to backup all the data, repartition and restore data. We can even copy file systems as a whole, but a spare hard disk drive is necessary.
The simple solution makes use of the fact that besides Solaris slices we can mount 3 partitions. Consider the following partitioning:
1. p1 - primary partition where Solaris is installed,
2. p2 - primary partition with other operating system,
3. empty space,
on the drive c0t0d0. We begin with creating a new Solaris partition within an empty space, which will become p3:
fdisk /dev/rdsk/c0t0d0p0
fmthard and newfs use slices as addresses, therefore to modify VTOC on p3 we need to hide p1 first. Reboot into DOS and run your favorite disk editor capable of modifying MBRs e.g. Ranish PM to change the identifier of p1, so that Solaris would not recognize it. For safety make a backup of the MBR before. Now, reboot Solaris from its installation CD, stop the installation after the Open Windows session is started, and open a terminal window. At the moment p3 is the first Solaris partition on c0t0d0, so run format and create exactly one slice 0 in p3, so that it starts in 0-th sector and fills entire p3, much like slice 2. New UFS file system is created with:
newfs /dev/rdsk/c0t0d0s0
New file system is ready to mount. Restore the identifier of p1 back to 0x82, reboot Solaris as usual, and mount p3:
mount /dev/dsk/c0t0d0p3
p3 acts like a single slice and that is the trick. The interesting question arises: where is the VTOC of p3 now?
I think that your method will work and is easier !
But ,can you tell me how to make a file on a partition that you can't access from Solaris before you solve the problem?
I met the same problem and googled to this article, jlliagre's reply hinted me, and I had read that solaris use slice 2 to identify the whole disk/partition, so I tried newfs /dev/rdsk/c0d0s2, it works.
And maybe it's so bad that in x86 box we can only have one solaris partition in one disk, because there can only specify one slice 2. but it's not my situation, I only alocated one solaris partition in the ide disk, and the c0d0s2 can just tell newfs to work well, instead of creating lofs and dd.
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
Rep:
Well, using s2 to create a filesystem is bad idea, as you overwrite the first block of the partition. You could have achieved almost the same by setting s0 to the maximum available space.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.