1820172 Members
4256 Online
109620 Solutions
New Discussion юеВ

Re: Format hard disk

 
SOLVED
Go to solution
Ngoh Chean Siung
Super Advisor

Format hard disk

Hi,

What is the command to format hard disk? Any format level likes low level format or ...?

How to get the mode of the hard disk? In windows, we can categorize to FAT32 and NTFS. How about in HP-UX?

regards.
27 REPLIES 27
Pete Randall
Outstanding Contributor

Re: Format hard disk

In HP-UX we don't really "format" disks, but there are commands like mediainit, and pvcreate, which might be considered "formatting".


Pete

Pete
Shaikh Imran
Honored Contributor

Re: Format hard disk

Hi,
#mediainit
see man mediainit for details
But almost all the HP drives comes with
pre-mediainit.
This also takes a lot of time and is not advisable unless you desperately need it.

Regards,

I'll sleep when i am dead.
Michael Tully
Honored Contributor

Re: Format hard disk

To get inormation about LUN's you can use:

e.g

# diskinfo /dev/rdsk/c1t1d0

as far as formatting is concerned, mediainit to flatten the disk before throwing it away or you can use 'pvcreate -f' to re-use it again for another volume group.
Anyone for a Mutiny ?
Etienne Roseau
Frequent Advisor

Re: Format hard disk

Hi ngoh
First you have to check wether your disk is recognized by the system : ioscan-fnC disk.
If you want to be sure of the integrity of you new drive, try mediainit /dev/rdsk/c..t..d.. (given by the ioscan) but be care, this will erase all if the drive was not empty !
then the command pvcreate (see man pvcreate) to prepare it for your system.
On HPUX you have 2 choices : HFS or VxFS.
for my use, it's VxFS except for fs containing the kernel.
good luck
ps: you have forgotten FAT16 for the one like me who still use DOS - only for old games !!
Nicolas Dumeige
Esteemed Contributor

Re: Format hard disk

Hello,

Windows doesn't offer as much option as what you'll be offered on Unix !

It exists more than 50 filesystem (UFS, ext2, VxFs, ...) type with very numerous
options (block size, number of inode, ... ).

You probably want to manage you IO system with at a more logical layer, using a logical volume manager as well, with again a lot of option.

I'm very far from being a specialist but trust me on this, you have the choice.

SAM the HP-UX administration tool will help you configure your disk.

Cheers

Nicolas
All different, all Unix
Geoff Wild
Honored Contributor

Re: Format hard disk

Steps to add a disk:

First, make it ready to be in a volume group:

pvcreate /dev/rdsk/cXtXdX

Next, add it to an existing volume group or create a new one.

New:

mkdir /dev/vg15
mknod /dev/vg15/group c 64 0x0f0000
vgcreate -s 8 -p 128 /dev/vg15 /dev/dsk/cXtXdX

Create a logical volume:

lvcreate -L 4096 -n lvol1 /dev/vg15

Then, layout a filesystem (like format):

newfs -o largefiles /dev/vg15/rlvol1

Finally, mount it:

mkdir /data1
mount /dev/vg15/lvol1 /data1

Also, add it to /etc/fstab
/dev/vg15/lvol1 /data1 vxfs rw,suid,largefiles,delaylog,datainlog 0 2

Now, all this can be done using SAM.


Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Ngoh Chean Siung
Super Advisor

Re: Format hard disk

hi,

Thanks for all of your reply.

Actually I would like wipe off the hard disk content permanently before send back to vendor due to this hard disk had bad sector.

In windows, if we format the hard disk using format command, I think there is a way to recover back the data. How about in Unix? Is the mediainit command to totally wipe off the data of a hard disk?

By the way, what is the difference between HFS (High Performance File System)& VxFS? Under what condition to apply either this file system?

mknod /dev/vg15/group c 64 0x0f0000

1) What is mknod stands for?
2) Why is group c and not others? what is group c stands for?
3) Is 64 stands for OS 64 bits?

regards
Michael Tully
Honored Contributor

Re: Format hard disk

There are a couple of good suggestions in the followng link. See Clay or Stefans answer.

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=13542

mknod - make special file. Generally used for creating the group special file for an LVM volume group.

The 'c' means character. So in using mknod in this instance it is saying create a special character file for LVM.

The 64 comes from the special file list being LVM which is 64. See 'lsdev' output.

HFS is rarely used except for /stand
vxfs (commonly known as JFS) is used far more. It is faster and has far more options in which to choose.

Anyone for a Mutiny ?
Matti_Kurkela
Honored Contributor

Re: Format hard disk

>Actually I would like wipe off the hard disk
>content permanently before send back to
>vendor due to this hard disk had bad sector.

Most disks have internal bad block replacement system, which has a quantity of spare blocks available. When a block goes bad, the disk firmware marks it as such and uses a spare block in its place. The bad block is completely hidden from the OS. If a bad block is visible in the OS level, it usually means that the disk's internal spare blocks are completely used up.

However, with proper tools (disk manufacturer's factory test software) it may be possible to access the data in the blocks that are marked as bad, and possibly recover data from them. So wiping the disk completely is rather difficult.

If the confidentiality/secrecy of your data is worth to you more than the price of a new disk, don't trust wiping. Have the disks physically destroyed in a way you can trust.

For non-classified data, wiping the disks may be an option. See the links given earlier in this thread.

Mediainit is not the best tool for this, since on modern disks it simply asks the disk firmware to perform the formatting and waits until the firmware reports it's done. However, the firmware's behavior is disk-model specific and generally unknown. The formatting function may:
1.) do nothing at all, if the disk is supposed to be formatted only using the manufacturer's special software/hardware.
2.) stop when it detects an error it can't handle (too many bad blocks, for example), leaving the rest of the disk unwiped.


In Windows, what the "format" command actually does to the hard disks is very much like "pvcreate" or "mkfs" on Unix. On floppy disks, the Windows format command works differently.


The difference between HFS and VxFS:
the HFS is the older one. On PA-RISC architecture HP-UX, the /stand partition must be HFS, the rest can be VxFS. VxFS has more features: it allows large files (more than 2 GB) and on-line resizing (if OnlineJFS package is installed). There may be special cases where HFS is more efficient, but my rule is "use VxFS unless you know HFS is specifically needed".


>mknod /dev/vg15/group c 64 0x0f0000

>1) What is mknod stands for?

It's shortened from "make device node", I think.

>2) Why is group c and not others? what is group c stands for?

The /dev/vg15/group is the name of the device node to create. The rest describes what kind of device node it should be.

There are two kinds of device nodes: character devices (c) and block devices (b).

3) Is 64 stands for OS 64 bits?

No, it's called a "major number" for the device. 0x0f0000 is the "minor number".

Basically, in most unix-like operating systems, the kernel handles all the device access internally using device numbers. The device nodes in /dev directory just provide a mapping between human-readable names and machine-internal numbers.

On HP-UX, when creating a new volume group with command-line tools, you must create a directory (usually /dev/vg) and a "group" device node for the volume group.
The device node must be a character device (type c), it must have major number 64 and a minor number of the form 0xNN0000, where NN is between 00 and kernel value "maxvgs" and unique among all the volume groups in the system.
MK
Bill Hassell
Honored Contributor

Re: Format hard disk

A device file is like a mailbox with options. When you create a device file, the result is a special file that connects the device driver plus options to the driver into a single entity. So when you read or write a device file, you are really asking the opsystem to make a connection for you with special options. In a tape drive device file, options might select auto-rewind and/or compression). In your example:

mknod /dev/vg15/group c 64 0x0f0000

1) What is mknod stands for?

As with all Unix commands, the first place to start is man (man mknod). This command creates a new device file (/dev/vg15/group), associates the type of driver (c=character, b=blocked), 64 is the driver's name or index, and 0x0f0000 are the option bits-which are always unique for each driver.

A blocked device file means that the driver (if possible) will use the HP-UX buffer cache for I/O, while the character mode device file is raw access (no special buffering). Most drivers (except for disks) have only raw access.

64 is the way in which HP-UX identifies a driver. Within a major rev of HP-UX, each of the drivers have a unique identifier or number. So the stape driver has an ID of 205 and the ptys drive has an ID of 17. You can view all the driver IDs with the command: lsdev

The 0x characters identify the number as being in hexadecimal format and the 0f portion is defined by the lvm driver 64 as the decimal number 15. Aha, you are creating a volume group called vg15, and for consistency, most admins pick the unique group value similar to the volume group name.

2) Why is group c and not others? what is group c stands for?

See above. Some device files for disks use raw access and other use blocked access.

3) Is 64 stands for OS 64 bits?

Driver ID number in the kernel tables as mentioned above.

It's going to be hard to use PC knowledge to match features in other opertating systems. DOS/Windows hides a lot of the filesystem layout behind their setup commands and GUIs, and HP-UX does this using sam. You may want to get one of the HP-UX intro books by Marty Poniatowski or browse through the HP-UX docs at docs.hp.com


Bill Hassell, sysadmin
Ngoh Chean Siung
Super Advisor

Re: Format hard disk

Hi,

My hard disk spoilt last week and already asked HP engineer to replace a new hard disk.

There are 2 Vg in the system (HP-UX 11.00). Vg00 (4GB + 9GB) and Vg01 (4GB + 9GB). The spoilt hard disk is 9GB at Vg01.

Questions:
1) After executing vgcfgrestore, all the LVs are restored including all the files and data. All we have to do is to recreate the File System (newfs) and mount the directory. Is it also work for the LV which the File System is Raw device and Swap?

2) Is all the application such as oracle, informix and etc must be created in the LV where the File System is Raw device?

3) How to check whether the hard disk is non-bootable or bootable?

4) How to check the JFS version and whether it is online or not?

5) Normally the hard disk path is something like /dev/dsk/c0t5d0. Why during pvcreate or ..., we must specify as /dev/rdsk/c0t5do? Why it is rdsk and not dsk? When we need to specify rdsk? What is the different between these?

6) Normally the LV path is something like /dev/vg01/lvdata. Why during newfs or ..., we must specify as /dev/vg01/rlvdata? Why it is rlvdata and not lvdata? When we need to specify rlvdata? What is the different between these?

7) How to create a new VG with 2 disks?

8) How to check whether the hard disk is hot-swappable or not?

9) According to the LVM reference, the largest block size for dd command is 256K. But I able to run the command with bs 4096K. Why?
Michael Tully
Honored Contributor

Re: Format hard disk

1) After using vgcfgrestore on a volume group that has had a bad disk, you must still restore the data onto the disk. Note in the man page that you should be running the vgcfgrestore with the VG de-activated.

2) Note sure of your question here. Are you referring to data or the application?

3) 'lvlnboot -v' will tell what disks are bootable.

4) # swlist -l product | grep -i online
OnlineJFS B.11.11 Online features of the VxFS File System

5) The creation of a disk into LVM must be done at the raw level not character (rdsk V's dsk) Once the LUN has the information on it, creating a logical volume is done at the character level (lvol)

6) Creating a new filesystem must also be done at the raw level (rlvol V's lvol) for logical volume

7) pvcreate /dev/rdsk/cXtXDZ (example) for each LUN
vgcreate /dev/mygroup /dev/dsk/cXtyDz /dev/dsk/cXtYdY
lvcreate -n mylv /dev/mygrp
lvextend -L 2048 /dev/mygrp/mylv
newfs -F vxfs /dev/mygrp/rmylv

8) We can't unless we know what disks/disk array your using.
ioscan -fnC disk (will help)

Hope this answers some of your questions.
Anyone for a Mutiny ?
Michael Tully
Honored Contributor

Re: Format hard disk

You might have a look at this document sometime, which provides more examples than I can think of just now.

http://docs.hp.com/hpux/onlinedocs/5187-2216/5187-2216.html
Anyone for a Mutiny ?
Ngoh Chean Siung
Super Advisor

Re: Format hard disk

Hi,

1) Is all the application such as oracle, informix and etc must be created in the LV where the File System is Raw device? What I mean is
i) application only
ii) data only
iii) application + data

2) For PV intialization, have to specify rdsk. While for LV creation, have to specify rlvdata. Anything else other than 2 these commands? If I am using SAM to do it, so I don't need to care about this, right?

regards.
Michael Tully
Honored Contributor

Re: Format hard disk

No, the application must reside on a filesystem. The database engine can look after volumes using raw space (space that is not mounted as a filesystem, but is still a logical volume.

Informix generally uses raw logical volume space for data, oracle generally uses filesystem space.

Generally data and applications do not share common filesystem space.

PV = rdsk
LV = lv (not rlv. rlv is for the creation of the filesystem only)
If your using SAM, don't worry, SAM will take care of this.
Anyone for a Mutiny ?
Ngoh Chean Siung
Super Advisor

Re: Format hard disk

Hi,

For Informix application, it was created under the logical volume when the file system is HFS or VxFS.

For Informix data, it was kept under the logical volume when the file system is Raw device.

Am I right?

regards.
Michael Tully
Honored Contributor

Re: Format hard disk

The application must be on a filesystem. Generally these days only VxFS (JFS) is used.

The data for informix is recommended to be on raw device. (logical volumes without filesystems)
Anyone for a Mutiny ?
Ngoh Chean Siung
Super Advisor

Re: Format hard disk

Hi,

It is not COMPULSORY that the informix data is on Logical Volume with raw device, right?

Are you using Informix as well?

regards.
Michael Tully
Honored Contributor

Re: Format hard disk


Of course not, you can have either way you choose, however, informix's preferred method has always been to use raw logical volumes. I have a number of servers that have informix and other servers that use oracle. All the informix servers we have use raw and all the oracle ones use filesystems. Again these are preferences and you'll find other people may have a different opinion to me.
Anyone for a Mutiny ?
Ngoh Chean Siung
Super Advisor

Re: Format hard disk

oic.

Now I manage to understand some basic concept for PV, VG and LV.

But in Informix, I have some term that quite confusing. As I know, chunk can be considered similar as LV in HP-UX. How about dbspace?

regards.
Sanjay Kumar Suri
Honored Contributor

Re: Format hard disk

Some terms:

chunk: a collection of contiguous pages on disk allocated to a dbspace
dbspace: a logical collection of 1 or more chunks
extent:contiguous pages from a single chunk allocated to a table
tablespace: A logical collection of 1 or more extents allocated to a table

sks
A rigid mind is very sure, but often wrong. A flexible mind is generally unsure, but often right.
Michael Tully
Honored Contributor

Re: Format hard disk

Sorry I'm not a DBA. But have a look at these pages I found.

http://www.tek-tips.com/gviewthread.cfm/pid/179/qid/845344
http://www.tek-tips.com/gviewthread.cfm/pid/179/qid/860920

I always thought a chunk could be a part of or a number of parts of a dbspace.
Anyone for a Mutiny ?
Bill Hassell
Honored Contributor

Re: Format hard disk

A logical volume is just a bunch of disk space. Depending on the way it was constructed from the volume group, it may be a portion of one disk, or span across 2 or more disks. Then the logical volume may be raw (common for Informix data) or may be a swap area (also raw) or may have a filesystem (HFS or VxFS).

As far as the units of measure in Informix, there is no correspondence between these items and the raw logical volume. Unlike a filesystem, there is no blocksize or frag size, just raw disk space. And the driver is fairly sophisticated in collecting a sequential series of disk reads or writes and hooking them together into a single disk access.

The important part for Informix is to specify the raw device file, not the 'cooked' or blocked device file. When you create an lvol, there will be 2 device files ctreated automatically, a cooked/blocked device file and raw. The raw device file will have the letter 'r' prepended to the lvol name. As an example: lvol1 and rlvol1. If the volume name starts with r as in 'rqueue3' then the raw volume will be 'rrqueue3'.

The reason that you want to use the raw device file is that Informix has it's own buffering scheme and using the block device file will 'fight' with Informix by also buffering I/O.


Bill Hassell, sysadmin
sreejith_4
Frequent Advisor

Re: Format hard disk

Hi,

You have to use mediainit . This does a low level format of the disk.

Thanks
Sreejith M