Help - create new filesystem

Help - create new filesystem

Post by Paul Donalds » Tue, 29 Jan 2002 23:24:31



This posting has two questions at the end but I'll first try to give
some system information that may help in answering them.

I have a Solaris 7 SPARC box that I am installing an application on.
The installation tells me that it is recommended that I mount separate
/var/abc and /var/abc/log filesystems.

If I try:

# mount /dev/dsk/c0t0d0s0 /var/abc

then it fails with the message:

mount: /dev/dsk/c0t0d0s0 is already mounted, /var/abc is busy, or the
allowable number of mount points has been exceeded.

The output from
# cat /etc/mnttab
is:
/dev/dsk/c0t0d0s0 / ufs rw,suid,dev=2200000,largefiles 101196681
(there are other lines [fd, swap, auto_home etc] but I hope I am not
wrong in assuming that this is the only line relevant to this
question).

The output (again partial) from
# cat /etc/vfstab
is:
/dev/dsk/c0t0d0s0 /dev/rdsk/c0t0d0s0 / ufs 1 no -

So I think whoever installed Solaris on the machine chose to use one
single partition covering the whole disk. What I want to do is to use
part of the disk for another filesystem. But if I was to try:

# newfs /dev/rdsk/c0d0s0

then I guess I would be told there is already a filesystem on that
partition (I'm scared to try in case it does something drastic)?

[incidentally, my book always uses c0d0s0 in its examples, but the
results of my commands show c0t0d0s0; I can't find a description in my
book of how this breaks down - why do I have a 't' and the book
doesn't?]

I had a look at the output of 'format' out of curiosity. I was
surprised to get the choice of two disks (it's not my system, I
assumed it only had one disk):

0. c0t0d0
1. c0t1d0

I selected "1" and was told that the disk was formatted but I didn't
get a warning that the current disk had mounted partitions.
Partition->Print displayed 8 partitions, only number 2 was not
unassigned (it was tagged "backup").

(Eventually) my questions are:
(1) If I only had the one disk, would I be able to create and mount
the new filesystem without loss of data or re-installing?
(2) Given I appear to have 2 disks, can I create and mount a
filesystem on the second disk? I'm not sure if I can do this given
that the root filesystem is on the other disk and any new filesystem
is, from what I can understand, a "child" of the root filesystem.

Any help greatly appreciated,
Paul

 
 
 

Help - create new filesystem

Post by Logan Sh » Wed, 30 Jan 2002 04:50:02




>(there are other lines [fd, swap, auto_home etc] but I hope I am not
>wrong in assuming that this is the only line relevant to this
>question).

The ones you care about the are the ones that have any sort of
"/dev/dsk" entry -- those are the ones that are connected to
real partitions.

Quote:>The output (again partial) from
># cat /etc/vfstab
>is:
>/dev/dsk/c0t0d0s0 /dev/rdsk/c0t0d0s0 / ufs 1 no -

/etc/vfstab is a better place to look.  One way to look at only the
ones you care about is to do "grep '^/dev/dsk' /etc/vfstab".

Quote:>So I think whoever installed Solaris on the machine chose to use one
>single partition covering the whole disk.

That's possible, but you haven't given enough evidence for anyone
reading your article to conclude that.  (Are there other filesystems in
/etc/vfstab?)

Quote:>What I want to do is to use
>part of the disk for another filesystem. But if I was to try:

># newfs /dev/rdsk/c0d0s0

>then I guess I would be told there is already a filesystem on that
>partition (I'm scared to try in case it does something drastic)?

Good!  That's a healthy fear!  It would do something drastic:  it would
erase every file on the filesystem!

Quote:>[incidentally, my book always uses c0d0s0 in its examples, but the
>results of my commands show c0t0d0s0; I can't find a description in my
>book of how this breaks down - why do I have a 't' and the book
>doesn't?]

SCSI disks are addressable by two different numbers per controller.
There's a target number (also called "SCSI ID") and there's also a disk
number (also called "LUN", logical unit number).  So, "c0t0d0s0" can be
broken down like this:

        c0 -- controller number 0 (in case you have multiple disk buses)
        t0 -- SCSI target number 0 on that controller
        d0 -- disk number 0 on that SCSI target
        s0 -- slice number 0 on that disk

"Slice" is essentially the Solaris word for partition.  Anyway, if you
have an IDE disk, there isn't a two-level addressing scheme.  Each bus
can only have two devices, so all that's required is a disk number.  So
whoever wrote c0d0s0 was thinking of IDE disks, probably.

Quote:>I had a look at the output of 'format' out of curiosity. I was
>surprised to get the choice of two disks (it's not my system, I
>assumed it only had one disk):

>0. c0t0d0
>1. c0t1d0

>I selected "1" and was told that the disk was formatted but I didn't
>get a warning that the current disk had mounted partitions.

In that case, there's a decent chance that the second disk is empty.

Quote:>Partition->Print displayed 8 partitions, only number 2 was not
>unassigned (it was tagged "backup").

That's a really good sign that it's empty.  Slice 2 is always assigned
to the whole disk.  Some people use slice 2 if they want a filesystem
that's the size of the whole disk, but it's better to create another
partition that also happens to be the whole disk and use that instead.

If I were you, I'd do this:

        grep c0t1d0 /etc/vfstab /etc/mnttab

if that turns up no output, then it's pretty safe to assume that the
second disk is empty and can be used.

Quote:>(Eventually) my questions are:
>(1) If I only had the one disk, would I be able to create and mount
>the new filesystem without loss of data or re-installing?

If you only had one disk, you'd have to change the partitions around,
and in order to do that, you'd have to destroy the filesystems that are
on the disk right now.  That doesn't mean you'd need to reinstall,
though: it's not too hard to put all the data in some temporary place
(even on some other machine on the network), rearrange the partitions
and filesystems on the disk, and then put the data back and make it
bootable again.

Quote:>(2) Given I appear to have 2 disks, can I create and mount a
>filesystem on the second disk? I'm not sure if I can do this given
>that the root filesystem is on the other disk and any new filesystem
>is, from what I can understand, a "child" of the root filesystem.

No, you can do that no problem.  All filesystems are children of the
root filesystem, but not in the sense that you are thinking.  The sense
that they are children is that the root filesystem is mounted at boot
time, and then other filesystems are mounted onto directories of the
mounted root filesystem by the kernel.  So the connection between the
root filesystem and the others is something that exists only inside the
"mind" of the kernel.

What you need to do is go back into format, select c0t1d0, select
"partition", and then create a slice or two of the size you desire for
your new filesystem(s).  The idiom is that you usually avoid using
slices 0, 1, and 2 for purposes like this (although you _could_ if you
want to).  Anyway, create the entries you want, verify that everything
looks kosher with "print" (no overlapping slices, except of course
number 2, which will overlap everything), and type "label" to write the
disk label (i.e. partition table) to the disk.

Now you've created the slices, so your next task is to create slices on
them.  You need to use newfs for that.  If you created slices 3 and 4,
you'd do "newfs /dev/rdsk/c0t1d0s3" and "newfs /dev/rdsk/c0t1d0s4".

Then, you need to add entries to /etc/vfstab so the system knows where
to mount them.  Just pattern your entries after one that already
exists, such as the one for the root filesystem.  Put /var/abc before
/var/abc/log in the file.  You also will want to make sure that each
entry for a given disk has a different number in the fifth field.  So,
/var/abc would have "1" and /var/abc/log would have "2", for example.
You also need the sixth column to say "yes", so they are automatically
mounted at boot time.

Finally, you should be able to just type

        mkdir /var/abc
        mount /var/abc
        mkdir /var/abc/log
        mount /var/abc/log

and you should see the filesystems showing up in the output of
"df -k".

Hope that helps.  By the way, there are some procedures for doing some
of this kind of thing at http://docs.sun.com/ .  Just look in the
system administrator's guide, which is in the system administration
collection.

  - Logan
--
"I'll tell you something.  Luxury disgusts me."  Giorgio Armani, Jan 17, 2002
( http://dailynews.yahoo.com/h/nm/20020117/re/life_fashion_armani_dc_1.... )

 
 
 

1. Creating a new filesystem in a new partition

Greetings all,

     I have 3 gigs of freespace on my 12 gig HD.  I would like to
partition this space and make it available to both my Red Hat 6.1 OS and
my Win98 OS.  Therefore, it has to be a FAT32 filesystem. I can't use
fdisk in windows to do this because it doesn't recognize linux.  In
other words, windoze fdisk shows 5 gigs of free space when this is
definately not true, linux is taking up 2 gigs. I don't want to use the
win fdisk in fear of it screwing up my linux system. Cfdisk in linux
shows the proper HD setup with the correct amount of freespace, so I
would like to use this program.  My question, however, is which type of
filesystem  should I format the drive in?..it doesn't seem to write
FAT32 filesystems, only FAT16 versions.  Can I choose any FAT16 version
and write that filesystem so that windoze recongnizes it, and then
reformat the partition (new win drive) into a FAT32 from inside windoze?
How should I go about accomplishing this task without screwing anything
up?  Any help is greatly appreciated.

I thank everyone who helps in advance = )

2. Init level 5

3. help with connection refused message

4. Creating New Filesystem

5. 16meg Limit on ISA Machines

6. Create a new filesystem

7. How do I use VESA with X

8. Creating New Filesystem /usr

9. Creating new filesystem on assigned partition?

10. HOW DO YOU REMOVE FILESYSTEMS & CREATE THEM ON NEW DISKS?

11. New: Filesystem test creating kernel BUGs at include/asm/spinlock.h

12. Help with creating/modifying a filesystem