LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This 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


Reply
  Search this Thread
Old 09-22-2005, 02:11 PM   #1
gnu noob
Member
 
Registered: Mar 2003
Location: CA
Distribution: Manjaro
Posts: 146

Rep: Reputation: 16
Problem Creating UFS Partition


I've run out of room on my "home" partition. I have some spare space on my primary IDE.

fdisk went well but I'm having a problem with newfs:

Cylinders
Partition Status Type Start End Length %
========= ====== ============ ===== === ====== ===
1 Active Ext Win95 0 17276 17277 43
2 Linux native 17276 28926 11651 29
3 Solaris 28926 29930 1005 3
4 Solaris 29930 39484 9555 24



# newfs /dev/rdsk/c0d0p4
newfs: construct a new file system /dev/rdsk/c0d0p4: (y/n)? y
Can not determine partition size: Invalid argument

I've checked bigadmin and googled some but cannot find the answer. I'd really rather not reinstall, but I will if I have to.
 
Old 09-22-2005, 03:01 PM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
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 ...
 
Old 09-23-2005, 05:36 AM   #3
anuode
Member
 
Registered: Nov 2004
Location: china
Distribution: Mandrake 10.1 Official
Posts: 37

Rep: Reputation: 15
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?
 
Old 09-23-2005, 09:27 AM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Anuode, your solution works too, but is IMHO more complicated and risky ...
 
Old 09-23-2005, 10:59 PM   #5
anuode
Member
 
Registered: Nov 2004
Location: china
Distribution: Mandrake 10.1 Official
Posts: 37

Rep: Reputation: 15
I am not sure,I saw it here :
http://multiboot.solaris-x86.org/iv/3.html
So beautiful!
 
Old 09-24-2005, 02:29 AM   #6
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Quote:
I am not sure
My solution is done with 5 commands, without rebooting nor fiddling with the partition table.
 
Old 09-24-2005, 02:58 AM   #7
anuode
Member
 
Registered: Nov 2004
Location: china
Distribution: Mandrake 10.1 Official
Posts: 37

Rep: Reputation: 15
jlliagre

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?
 
Old 09-24-2005, 03:22 AM   #8
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
I never wrote to make the file on the target partition, create the file on one of your existing ufs partitions.
 
Old 10-14-2005, 08:31 AM   #9
complystill
LQ Newbie
 
Registered: Oct 2005
Location: Beijing, P.R.China
Distribution: Fedora, Solaris
Posts: 2

Rep: Reputation: 0
Hi buddies, I found a right way for this

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.
 
Old 10-14-2005, 12:22 PM   #10
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
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.
 
Old 10-14-2005, 12:31 PM   #11
complystill
LQ Newbie
 
Registered: Oct 2005
Location: Beijing, P.R.China
Distribution: Fedora, Solaris
Posts: 2

Rep: Reputation: 0
aha, ya, I'm just wondering why I can finally mount c0d0p1 as a single filesystem, regardless of the slices.... this explains..

so, if not to create a single ufs on the whole partition, how shall to define the slice sizes? will fdisk /dev/rdsk/c0d0s2 work?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mounting a UFS partition in linux newpenguin *BSD 5 02-22-2006 07:56 AM
Read/write to UFS partition digitalhead Linux - General 3 01-24-2006 06:07 AM
Creating ufs (freebsd) Partitions ruleman *BSD 4 05-13-2005 10:14 AM
Problem in creating filesystem for newly created partition. appas Linux - Software 2 08-21-2004 03:39 AM
problem creating swap partition during installation kristof Red Hat 11 07-03-2004 01:25 PM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 06:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration