[SOLVED] How to determine number of blocks of a logical volume
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to determine number of blocks of a logical volume
My LVM looks like this
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
blackberry mobile -wi-ao 1.00G
motorolla mobile -wi-ao 700.00M
nokia mobile -wi-ao 900.00M
sony mobile -wi-ao 1.46G
now i am able to extend sony lv to 2 GB. And able to bring back to 1.46G. Since i know the number of blocks of sony lv, i am able to specify it, while shrinking back to 1.46G. Now i want to resize the sony lv around to 1.2G. How can i find the number of blocks for 1.2G, so that i can resize the lv to 1.26G excatly.
when i use tune2fs -l /dev/mobile/sony. It gives the following info
tune2fs 1.39 (29-May-2006)
Filesystem volume name: <none>
Last mounted on: <not available>
Filesystem UUID: 80424503-7ce2-4dd5-8be5-953422116d47
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal resize_inode dir_index filetype sparse_super large_file
Default mount options: (none)
Filesystem state: clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 187008
Block count: 384000
Reserved block count: 14906
Free blocks: 199767
Free inodes: 109076
First block: 0
Block size: 4096
Fragment size: 4096
Reserved GDT blocks: 53
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 15584
Inode blocks per group: 487
Filesystem created: Thu Apr 26 15:30:30 2012
Last mount time: Thu Apr 26 17:56:57 2012
Last write time: Thu Apr 26 18:04:13 2012
Mount count: 0
Maximum mount count: 26
Last checked: Thu Apr 26 18:04:13 2012
Check interval: 15552000 (6 months)
Next check after: Tue Oct 23 18:04:13 2012
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 128
Journal inode: 8
Default directory hash: tea
Directory Hash Seed: c92882f3-c595-4764-90b5-0e28d40db4ee
Journal backup: inode blocks
Which block attribute should i use. Here its shows block size, block count. I tried using online blocks to gb converter, but the values does not match at all....
Before using this lvresize -L 1.26G /dev/mobile/sony, we need to use resize2fs command right. For that, is it a must to specify the blocks. resize2fs /dev/mobile/sony *******. In a doc, it was specified that for increasing the lv, resize2fs /dev/mobile/sony is enough, but while shrinking, we need to specify the blocks resize2fs /dev/mobile/sony ******* .Thats what i need to know, whether its a must do it.
I checked the document, in resize2fs command itself they have speicified the lv size and also in lvresize command. Will follow it and update you the o/p
Is it fine to run e2fsck if the size is large.Y i am asking is, lvm is used because we can add hard drives, while we keep on working. If we run e2fsck on a mac where it has huge datas, it will consume more time right.. but for extending file systems its a must do it..
Is it fine to run e2fsck if the size is large.Y i am asking is, lvm is used because we can add hard drives, while we keep on working. If we run e2fsck on a mac where it has huge datas, it will consume more time right.. but for extending file systems its a must do it..
If at all possible I wouldn't do the things you mention on a machine running in RL 3/4/5. At least unmount the partition(s) you are going to work on. It is always better to have planned downtime instead of having possible data corruption, which would lead to an unplanned and longer downtime.
As for adding HD's to a running machine: I can only assume you have hardware that supports this.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.