How to know exactly which physical partion contains data?


 
Thread Tools Search this Thread
Operating Systems AIX How to know exactly which physical partion contains data?
# 1  
Old 12-08-2014
How to know exactly which physical partion contains data?

Code:
/dev/fslv01        5.00      2.90   42%      776     1% /movelv_test

Code:
fslv01:/movelv_test
LP    PP1  PV1               PP2  PV2               PP3  PV3
0001  0175 hdisk1            0111 hdisk0            
0002  0176 hdisk1            0112 hdisk0            
0003  0177 hdisk1            0113 hdisk0            
0004  0178 hdisk1            0114 hdisk0            
0005  0179 hdisk1            0115 hdisk0            
0006  0180 hdisk1            0116 hdisk0            
0007  0181 hdisk1            0117 hdisk0            
0008  0182 hdisk1            0118 hdisk0            
0009  0183 hdisk1            0119 hdisk0            
0010  0184 hdisk1            0120 hdisk0            
0011  0185 hdisk1            0121 hdisk0            
0012  0186 hdisk1            0122 hdisk0            
0013  0187 hdisk1            0123 hdisk0            
0014  0188 hdisk1            0124 hdisk0            
0015  0189 hdisk1            0125 hdisk0            
0016  0190 hdisk1            0126 hdisk0            
0017  0191 hdisk1            0127 hdisk0            
0018  0192 hdisk1            0128 hdisk0            
0019  0193 hdisk1            0129 hdisk0            
0020  0194 hdisk1            0130 hdisk0

Hi.
This is information of filesystem /movelv_test. It only used 42% capacity / 20 physical partions ( PP ) each PV. As I understand, it means that only 8 PP on each PV contain data, 12 PP remaining on each PV are assigned to logical volume fslv01 but have no data. Is this true ???
If yes, how to know exactly which PP contains data.
Thank for read.

Last edited by bobochacha29; 12-09-2014 at 02:30 AM..
# 2  
Old 12-09-2014
Quote:
Originally Posted by bobochacha29
This is information of filesystem /movelv_test. It only used 42% capacity / 20 physical partions ( PP ) each PV.
Not quite. The filesystem "/movelv_test" is residing on a certain Logical Volume, "fslv01". This LV in turn is made from 20 Logical Partitions. Because the LV is mirrored each LP is comprised from 2 Physical Partitions. Would the LV not be mirrored it would still be made from 20 LPs but this time each LP would be made from only one PP.

You need to understand that there are several abstraction layers and you cannot change between them at will.

Quote:
Originally Posted by bobochacha29
As I understand, it means that only 8 PP on each PV contain data, 12 PP remaining on each PV are assigned to logical volume fslv01 but have no data. Is this true ???
No. You seem to think that data fills the raw disk space like water fills a bucket - from the bottom up, but this is not the case. Filesystems are made for random read/write access and that means that filling them contiguously would be a performance nightmare. Suppose you have two files, A and B and they are put adjacently on the disk. When you edit file A now and add a single character you would have no space to write that, so you need to rewrite the whole file. If there is a way to fragment that file and put the additional character elsewhere you could leave most of the file in place.

The relationship between disk space and filesystem space is more like the price you pay for something: suppose you purchase a house for some money. You can point to the whole money and say it bought you the whole house, but the question which bills bought me the western wall just makes no sense.

Of course you can investigate where exactly on which part of the disk a certain file is. But be aware that when you use the FS this can change over time and it is by no means fixed.

I hope this helps.

bakunin
This User Gave Thanks to bakunin For This Post:
# 3  
Old 12-09-2014
I don't really understand what you means. As you said above, data is written randomly to the disk and these lp/pp listed above have no relationship with the filesytem space used/free. The data may reside anywhere on these 40 pps and there's no way to know that. Is that what you means?
# 4  
Old 12-12-2014
Quote:
Originally Posted by bobochacha29
As you said above, data is written randomly to the disk and these lp/pp listed above have no relationship with the filesytem space used/free.
Yes and no. data is not written entirely randomly. There is a system behind it, but it is complex. You seem to have meant that a filesystem which is, say, 50% full and consists of LPs1-10 will have the LPs1-5 written full and LPs6-10 empty. This is (typically) not the case. Typically (depending on what the content of your filesystem is - many small files or a few large files or some mix of both, how often the data on disk changes and some other specifics) your filesystems space will be scattered and every LP will be nearly 50% full and nearly 50% empty.

Furthermore, if a FS resides on a LV which consists of 10 LPs these are ordered 1-10. But that does not have to mean that LP3 is "behind" LP2 on disk. It could well be that LP1 is at PP200, LP2 is at PP100 and LP3 is at PP150 (with maybe other LVs taking the place in between). For the filesystem the space would still appear to be linear, first the space coming from LP1, then from LP2, etc.. The FS will be unaware of the fact that to go from LP1 to LP2 this means to skip many PPs on disk.

Quote:
Originally Posted by bobochacha29
The data may reside anywhere on these 40 pps and there's no way to know that.
Yes, it is possible to find out, but no, there is no 1:1-relation you could use. Say, you have some file. If you want to know where the first byte of the file "/path/to/some/file" is located on the disk you can find out on which place the first (filesystem) block of your file is. Then, using LV methods, find out on which LP this part of the filesystem really is. After this, you use the LP-PP-relation you already have posted to find out which PP is used to represent this LP and finally you can use VG-methods to locate the PP on some specific place on some specific disk and use low-level methods ("dd" and the like) to really find that part of the file you started with.

But, having found that out for byte X doesn't mean that you could read the next byte on disk and expect to find the content of byte X+1 in the file. This may be so or not, but to know that you will need to exercise the whole procedure again.

I hope this helps.

bakunin
This User Gave Thanks to bakunin For This Post:
# 5  
Old 12-12-2014
Are you wanting to shrink the filesystem, replace a disk or something? I'm wondering why you are so interested.

To shrink a filesystem on AIX is not simple task like it can by on some other operating systems, for instance RHEL 6 has an option to re-size up or down the filesystem and logical volume all in one command, although it requires it to unmount as part of the process.

On AIX you would need to either:-
  1. Build a new filesystem of the required size, move the data and then remount the new filesystem to the correct location (making the change permanent for next boot etc.)
  2. Backup the data, destroy and re-create the filesystem and then restore the data.
If you are looking to free up or replace a disk, then migratepv is your friend here. It can take a while depending how big your filesystem is, but it will (one at a time) make a copies the LPs to the target drive then remove the old one. Do not interrupt the process as this can leave you with inconsistencies in the volume group and logical volume information.
Code:
migratepv -l logical_volume  source_disk  target_disk

An alternate would be to use mirrors to achieve this if placement is critical. You can use mklvcopy to add a third copy to the new disk (and synchronise them) and then use rmlvcopy specifying to remove the one from the old disk. When making the 3rd copy, you can specify a map-file to force it to use the PPs on whichever disk in whichever order you want if that is important.

Whichever technique you use, you can empty a disk and remove it from the volume group for replacement or use elsewhere.


If I've missed the point, then let us know what you really need to know and we will try to help.



Regards,
Robin
This User Gave Thanks to rbatte1 For This Post:
# 6  
Old 12-12-2014
Quote:
Originally Posted by rbatte1
To shrink a filesystem on AIX is not simple task like it can by on some other operating systems, for instance RHEL 6 has an option to re-size up or down the filesystem and logical volume all in one command, although it requires it to unmount as part of the process.
Actually this is correct only historically. Since IIRC version 5.3 it is possible to shrink a filesystem. Initially it was possible only if the end of the underlying LV (from where the shrinking took place) was not already used by files but since then AIX does a "reorgfs" automatically as it seems. The only restricition (obviously) is that the resulting size must be big enough to hold all the existing data.

To shrink a FS (and the underlying LV as well) do, analogous to a growth:

Code:
chfs -a size=-<some size> /path/to/mountpoint

I hope this helps.

bakunin
These 2 Users Gave Thanks to bakunin For This Post:
# 7  
Old 12-13-2014
Quote:
Originally Posted by rbatte1
Are you wanting to shrink the filesystem, replace a disk or something? I'm wondering why you are so interested.

To shrink a filesystem on AIX is not simple task like it can by on some other operating systems, for instance RHEL 6 has an option to re-size up or down the filesystem and logical volume all in one command, although it requires it to unmount as part of the process.

On AIX you would need to either:-
  1. Build a new filesystem of the required size, move the data and then remount the new filesystem to the correct location (making the change permanent for next boot etc.)
  2. Backup the data, destroy and re-create the filesystem and then restore the data.
If you are looking to free up or replace a disk, then migratepv is your friend here. It can take a while depending how big your filesystem is, but it will (one at a time) make a copies the LPs to the target drive then remove the old one. Do not interrupt the process as this can leave you with inconsistencies in the volume group and logical volume information.
Code:
migratepv -l logical_volume  source_disk  target_disk

An alternate would be to use mirrors to achieve this if placement is critical. You can use mklvcopy to add a third copy to the new disk (and synchronise them) and then use rmlvcopy specifying to remove the one from the old disk. When making the 3rd copy, you can specify a map-file to force it to use the PPs on whichever disk in whichever order you want if that is important.

Whichever technique you use, you can empty a disk and remove it from the volume group for replacement or use elsewhere.


If I've missed the point, then let us know what you really need to know and we will try to help.



Regards,
Robin
Hehe, how do you know that. It's true that I'm having problem with filesystem, but it's a little different with what you think. In fact, I want to split the data of a filesystem on multiple hard disks equally.
It's quite a waste of lines listing all the lp/pp of the real filesystem I'm handling, so allow me to use that /movelv_test as an example.

This is how it looks like
Code:
fslv01:/movelv_test
LP    PP1  PV1               PP2  PV2             
0001  0175 hdisk1            0111 hdisk2            
0002  0176 hdisk1            0112 hdisk2           
0003  0177 hdisk1            0113 hdisk2            
0004  0178 hdisk1            0114 hdisk2           
0005  0179 hdisk1            0115 hdisk2            
0006  0180 hdisk1            0116 hdisk2            
0007  0181 hdisk1            0117 hdisk2           
0008  0182 hdisk1            0118 hdisk2           
0009  0183 hdisk1            0119 hdisk2           
0010  0184 hdisk1            0120 hdisk2          
0011  0185 hdisk3            0121 hdisk4          
0012  0186 hdisk3            0122 hdisk4            
0013  0187 hdisk3            0123 hdisk4           
0014  0188 hdisk3            0124 hdisk4           
0015  0189 hdisk3            0125 hdisk4           
0016  0190 hdisk3            0126 hdisk4            
0017  0191 hdisk3            0127 hdisk4            
0018  0192 hdisk3            0128 hdisk4            
0019  0193 hdisk3            0129 hdisk4           
0020  0194 hdisk3            0130 hdisk4

( Don't be surpised why it looks like that. At first, the vg of this fs have only 2 pv, hdisk1 and hdisk2. The data grew up day by day and when there was no free pp on hdisk1 and hdisk2, we added two more pv: hdisk3 and hdisk4 to the vg and then increase the /movelv_test size . Now this fs 's Used% is ~ 55%, 180GB assigned to the fs/ 100GB data used )

The problem is when I checked the disk operation ( by command "topas" ), I found that the operation of hdisk1 and hdisk2 is very high, ~90%-100% while the operation of hdisk3 and hdisk4 is just ~ 10% ( most of the disk operation is writing - the application writes logs to the fs's mountpoint ).

The result of the "topas" command and the lp/pp listed above made me think that data fills the raw disk space like water fills a bucket - as bakunin said, but now I know it's not true.

Now, what I want to do is to balance the disk operation of these 4 pv ( just only at this time,temporarily don't care about data increasing ) and I intend to do like this:
_ Decrease the size of the fs so that the fs's Used% ~ 99% ( to ensure that most of the pp are filled with data and don't care whether the pp contains data or not ), in this case - decrease size of /movelv_test to 101 GB
_ Used "migratelp" command to arrange each pp of the fslv01 like this
Code:
fslv01:/movelv_test
LP    PP1  PV1               PP2  PV2             
0001  0175 hdisk1            0111 hdisk2            
0002  0176 hdisk1            0112 hdisk2            
0003  0177 hdisk1            0113 hdisk2            
0004  0178 hdisk1            0114 hdisk2            
0005  0179 hdisk1            0115 hdisk2            
0006  0180 hdisk2            0116 hdisk3            
0007  0181 hdisk2            0117 hdisk3            
0008  0182 hdisk2            0118 hdisk3            
0009  0183 hdisk2            0119 hdisk3           
0010  0184 hdisk2            0120 hdisk3            
0011  0185 hdisk3            0121 hdisk4            
0012  0186 hdisk3            0122 hdisk4            
0013  0187 hdisk3            0123 hdisk4            
0014  0188 hdisk3            0124 hdisk4            
0015  0189 hdisk3            0125 hdisk4            
0016  0190 hdisk4            0126 hdisk1            
0017  0191 hdisk4            0127 hdisk1            
0018  0192 hdisk4            0128 hdisk1            
0019  0193 hdisk4            0129 hdisk1            
0020  0194 hdisk4            0130 hdisk1

_ Increase the size of the fs back ( in this case is 180 GB )

And I have two questions
1. Is it OK to use the command " migratelp" to do something like this. The data availability, the synchronization between the 1st mirror and the 2nd mirror ... is OK ? Are there any errors of the filesystem, errors of data, ... after using this command? If 1 of 4 hard disk fails, the data is still OK ???
2. Does this solution work ? Are there any solutions better?

Sorry for my poor English. Thanks for read.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. AIX

Maximum Limit of HMC to handle Physical Power Virtualization Physical Machine

Hello All, Can anybody please tell me what is the maximum limit of Physical IBM Power Machine which can be handled by single HMC at a single point of time? Thanks, Jenish (1 Reply)
Discussion started by: jenish_shah
1 Replies

2. Linux

Centos 5 install. Partion order

I can't control the partion order during install. For example i need. hda5 /var 1GB hda6 /opt 2GB I created them in such order but OS adjust them to hda5 /opt 2GB hda6 /var 1GB It is frustrating during install, I pretty sure I can order the partion as i like... (0 Replies)
Discussion started by: honglus
0 Replies

3. Shell Programming and Scripting

Auto XP partion restore

At my computer shop where I work, we got alot of used PC's from some place. It's my job to refurbish them for resale. Each computer comes with XP pro. So the boss man asks me if there is a way to put a XP restore option. I say yes if I install Linux on a small partion and use partimage to make a... (1 Reply)
Discussion started by: Zewbie
1 Replies

4. Solaris

How to create on partion from 2 disks?

Hi everyone :b: I'm glade to join this forum and I have one question I installed latest Solaris 10 release on SF V480 with 2 73 GB disks 8 GB RAM 4 CPU's My configuration is 10GB for root, 8GB for Swap and 12GB for var. I mirrored root, so disk 1 has 40GB free of space and disk 2 has... (11 Replies)
Discussion started by: HishamN
11 Replies

5. UNIX for Dummies Questions & Answers

Physical volume- no free physical partitions

I was in smit, checking on disc space, etc. and it appears that one of our physical volumes that is part of a large volume group, has no free physical partitions. The server is running AIX 5.1. What would be the advisable step to take in this instance? (9 Replies)
Discussion started by: markper
9 Replies

6. UNIX for Dummies Questions & Answers

Partion Magic problems.

Hiya people, A great big "HI" to everybody. I'm new to the Forum and now to my problem(s). I am about to partition my only 80GB HD and using the Partition Magic 8 software it looks fairly simple although here is my problem :- 1. Do I change the new partition to primary or logical? 2. Do I... (4 Replies)
Discussion started by: Syndrome_00
4 Replies

7. Linux

Doing stuff to files on a NTFS partion from linux

I have a 50GB section of my hard drive on which I've kept all my music, movies and more back from when I had Windows. When I'm in linux it says that the NTFS section is a read only section. Is it possible to copy, rename, add, move or delete any files off of this section? I'm trying to get rid... (2 Replies)
Discussion started by: CTroxtell21
2 Replies

8. UNIX for Dummies Questions & Answers

physical volume and physical disk.

Hello, I need explanations about physical disks and physical volumes. What is the difference between these 2 things? In fact, i am trying to understand what the AIX lspv2command does. Thank you in advance. (2 Replies)
Discussion started by: VeroL
2 Replies

9. UNIX for Dummies Questions & Answers

Partion size

hi, just need to know the disk size and the partition size on machine.pls let me know how to do that.is their a way i can get to know the size of directory.like /,/var...etc. thanx (2 Replies)
Discussion started by: saood
2 Replies
Login or Register to Ask a Question