Operating System - HP-UX
1821246 Members
2712 Online
109632 Solutions
New Discussion юеВ

Mount disk in new volume group without erasing data

 
Dag A.
Frequent Advisor

Mount disk in new volume group without erasing data

Hi. How does one create a volume group and mount a hard disk to it without erasing the data on the disk?

Have tried the following:

1. Using SAM ------------------------
Use "Create Volume Group" with options:
Selected disk: XXXXX
Use hardware path: 10/1/3/0.10.0
Volume group name: vg03

Result:
FAILS: "The command used to create volume groups, /sbin/vgcreate has failed. The stderr output is shown below. The volume group has not been created.
vgcreate: Volume group "dev/vg03" could not be created: The path does not specify a valid physical volume"

The following directory was created:
# ll /dev/vg03
total 0
crw-r--r-- 1 root sys 64 0x020000 Feb 19 15:37 group

2.Using command line-------------
(without -f option to avoid erasing)

# pvcreate /dev/dsk/c3t10d0
pvcreate: "/dev/dsk/c3t10d0": not a character device.


regards,
Dag
13 REPLIES 13
Patrick Wallek
Honored Contributor

Re: Mount disk in new volume group without erasing data

Will this be the only disk in the VG? If so, you should just import the disk into the VG.

Have a look at the 'vgimport' command.
Tim Nelson
Honored Contributor

Re: Mount disk in new volume group without erasing data

The easiest way is to use vgimport.

This is assuming that there is already LVM info on the disk.

If you use pvcreate then it will erase the LVM header info on the disk.

mkdir /dev/vgnew
mknod /dev/vgnew/group c 64 0x0Y0000 ( y is an unused minor number ( ls -ld /dev/vg*/group to find )

vgimport /dev/vgnew /dev/dsk/c3t10d0

If you exported this from somewhere and created a map file then you can also get your lvnames back. If not everything is called lvol1, lvol2, lvol3 etc.. You can change these names later by simply renaming the block and char names to a name of your choosing.

Torsten.
Acclaimed Contributor

Re: Mount disk in new volume group without erasing data

What data structure is on your disk?
How was it used before?
Was it configured as a volume group?

"pvcreate" will delete your data!

If this disk was its own volume group you need to use vgimport.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Eric SAUBIGNAC
Honored Contributor

Re: Mount disk in new volume group without erasing data

Bonsoir,

What do you mean by "without erasing the data on the disk?"

Do you mean that there is a filesystem on it that has been created without LVM ? It is not possible, in a new LVM structure, to keep existing datas that have no LVM structure.

Do you mean that this disk as an LVM structure and comes from an other HP-UX box ? So consider "vgimport" in place of vgcreate : it will keep existing datas

Regards

Eric
Eric SAUBIGNAC
Honored Contributor

Re: Mount disk in new volume group without erasing data

Something else :

# pvcreate /dev/dsk/c3t10d0
pvcreate: "/dev/dsk/c3t10d0": not a character device.

With pvcreate you must use a character device, that is /dev/rdsk/c3t10d0. But if you want to vgimport it, there is no need to issue a pvcreate.

Eric
Dag A.
Frequent Advisor

Re: Mount disk in new volume group without erasing data

I do not know the contents of the disk.

The man page for pvcreate says that it will not overwrite the data unless the -f option is used:
"If pv_path contains a file system and the -f option is not specified,
pvcreate asks for confirmation. The request for confirmation avoids
accidentally deleting a file system."

The idea was to see if pvcreate did find any file system.

Another thought: Is there a maximum disk size that HP-UX 10.20 can handle (the disk is 73GB)
Torsten.
Acclaimed Contributor

Re: Mount disk in new volume group without erasing data

If pvcreate (without -f option) finds information on the disk it will do nothing.

If you force the action (with -f) your data will be deleted.

Try

vgscan -v -p

and check the results.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Eric SAUBIGNAC
Honored Contributor

Re: Mount disk in new volume group without erasing data

To control if you have a valide FS on this disk you can try : fstyp /dev/rdsk/c3t10d0

To control wheter or not this disk belongs to a volume group, try pvcreate without -f :

pvcreate /dev/rdsk/c3t10d0
pvcreate: The physical volume already belongs to a volume group

If you want to analyse disk contents you can use dd. For example :

dd if=/dev/rdsk/c3t10d0 of=/var/tmp/DiskDump bs=1024k count=100

It will dump 100 Mo from the disk that you will be able to analyze, for example with od

Eric
Dag A.
Frequent Advisor

Re: Mount disk in new volume group without erasing data

Hi, thanks for your answers.
Have looked som more into this:

The machine is a dual boot system.
In configuration A disk 5 (SCSI addr. 5)is used. The other disks appear as "Unused" in SAM.
In configuration B disks 6 and 8 are used, other disks appear as "Unused".
The disk in question is disk 10, I have not been able to find out what it contains


------------
Results of vgscan:

# vgscan -v -p
vgscan: Warning: couldn't query physical volume "/dev/dsk/c3t2d0":
The specified path does not correspond to physical volume attached to
this volume group
--> There is no disk with SCSI address 2 (checked with ioscan)

vgscan: Warning: couldn't query all of the physical volumes.
vgscan: The physical volume "/dev/dsk/c2t5d0" is already recorded in the "/etc/l
vmtab" file.

Couldn't stat physical volume "/dev/dsk/c0t0d0":
Invalid argument
--> This is the CD-ROM

/dev/vg00
/dev/dsk/c2t5d0
--> This is the system disk

Following Physical Volumes belong to one Volume Group.
Unable to match these Physical Volumes to a Volume Group.
Use the vgimport command to complete the process.
/dev/dsk/c2t6d0
--> This is the system disk in Configuration B

Following Physical Volumes belong to one Volume Group.
Unable to match these Physical Volumes to a Volume Group.
Use the vgimport command to complete the process.
/dev/dsk/c3t8d0
--> This disk is used in Configuration B

Following Physical Volumes belong to one Volume Group.
Unable to match these Physical Volumes to a Volume Group.
Use the vgimport command to complete the process.
/dev/dsk/c3t10d0
--> This is the unknown disk

The Volume Group /dev/vg01/group was not matched with any Physical Volumes.

------------------

Results from fstyp: Seems that this does not work? Does not find file system on any of the disks.

# fstyp /dev/dsk/c2t5d0
unknown_fstyp (no matches)
# fstyp /dev/dsk/c2t6d0
unknown_fstyp (no matches)
# fstyp /dev/dsk/c3t8d0
unknown_fstyp (no matches)
# fstyp /dev/dsk/c3t10d0
unknown_fstyp (no matches)

--------------------

# more /etc/lvmtab
^C├Г┬и^B/dev/vg00
w├Г┬╣%^P<├в┬║>/dev/vg01
w├Г┬╣%^PC'├Г j^A/dev/dsk/c3t2d0

==> Seems that there was a disk on SCSI address 2, which was removed without deleting the volume group.
So this is not the volume group for disk 10, although vgscan claims that disk 10 belongs to a volume group.

------------------
>Create new volume group:

# mknod /dev/vg02/group c 64 0x030000

>Test vgimport (-p option to preview actions)

# vgimport -v -p /dev/vg02 /dev/dsk/c3t10d0
Beginning the import process on Volume Group "/dev/vg02".
vgimport: Quorum not present, or some physical volume(s) are missing.
Volume group "/dev/vg02" has been successfully created.
Warning: A backup of this volume group may not exist on this machine.
Please remember to take a backup using the vgcfgbackup command after activating the volume group.

-->Should I run this command without the -p option? And what should be the next step in order to mount the disk without destroying the data (if any) on it?
Torsten.
Acclaimed Contributor

Re: Mount disk in new volume group without erasing data

vgimport the disk, activate with vgchange (-q n), have a look at the LVOLs and try to mount them.
Looks like the disk was a member of a mirror set.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Eric SAUBIGNAC
Honored Contributor

Re: Mount disk in new volume group without erasing data

Bonjour,

-->Should I run this command without the -p option? And what should be the next step in order to mount the disk without destroying the data (if any) on it?

You can vgimport this disk but you clearly miss some other disk(s) : "vgimport: Quorum not present, or some physical volume(s) are missing"

But before may be you should switch to the other environment and control whether or not this disk is recorder in an existing VG ?

Anyway if you decide to import, remember that at least one disk is missing. May be it is only a mirror disk and it should not be a problem, but may be not ... in this case some LVs will miss or be corrupted.

So after importing the VG, activate it in read-only (vgchange -a r) to investigate what is exactly on this disk and mount FS with read-only option.

Once you are sure of what is that disk, what resides on it, you can activate and use it normally.

Regards

Erci
Eric SAUBIGNAC
Honored Contributor

Re: Mount disk in new volume group without erasing data

Oups, as Torsten has underlined it you must specify quorum option since you miss disk : vgchange -a r -q n
Dag A.
Frequent Advisor

Re: Mount disk in new volume group without erasing data

closed