In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to correctly use LVM and corresponding commands under linux". In daily operation, I believe many people have doubts about how to correctly use LVM and corresponding commands under linux. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to correctly use LVM and corresponding commands under linux". Next, please follow the editor to study!
1. Build a physical volume first
# pvcreate-f / dev/rdsk/cCdDtT
The character device file of the hard disk must be used here.
two。 Recreate the logical volume group
# mkdir / dev/vg0X
XRV 0roomf, logical volume group name
# mknod / dev/vg0X/group c 64 0x0X0000
# vgcreate vg0X / dev/dsk/cCdDtT
3. Then divide the logical volume
# lvcreate-L size-n / dev/vg0X/lvolY vg0X
The correct approach should be: # lvcreate-L size-n lvolY vg0X. If you type it according to the original command, you will get the following result: "LogicalVolumeName": Must be a simple file name, not a path name "
4. Build a file system on LV
# newfs-F file_system_type / dev/vg0X/rlvolY
File_system_type: file system type, including hfs and vxfs. Note the character device files that use this logical volume at this time.
5. Mount this file system to a directory
# mkdir / directory
# mount / dev/vg0X/lvolY / directory
At this point, you can use this hard drive. Sometimes you may need to add or delete logical volumes or expand the file system in an existing environment. We can do this:
6. Add logical Volum
Add a file system volume. For example: add a 200m file system volume named data,mount to the directory / sample on vg01.
a. Create a logical volume and type the command at the system prompt:
# lvcreate-L 200-n data / dev/vg01
b. Create a file system on the logical volume data:
# newfs-F hfs / dev/vg01/rdata
Note: if it is a vxfs file system, use the
# newfs-F vxfs / dev/vg01/rdata
c. Create the directory / sample and data mount the logical volume to / sample.
# mkdir sample
# mount / dev/vg01/data / sample
d. Using the bdf command, you will see / dev/vg01/datamount to / sample.
7. Delete logical Volum
For example: delete the logical volume named data in vg01, mount to / sample.
1) unmount the logical volume to be deleted:
a. First unmount the logical volume data from / sample with the umount command:
# umount / sample
b. If the system prompts that the device is busy and cannot be uninstalled, enter a single user by typing the following command at the root system prompt:
# shutdown-y 0
c. "under single user, type the command on all file systems mount first:"
# mount-a
d. Use the bdf command to see if the logical volume is already on mount, and if so, type the following command on mount:
# umount / sample
2) delete the logical volume / dev/vg01/data, and use the command:
# lvremove / dev/vg01/data
8. Expand the file system
1) to expand the file system, we must first find the logical volume corresponding to the file system. Only by expanding the logical volume and giving the file system more space can we expand the file system.
2) to expand the logical volume, advanced single user, at the root system prompt, type the command:
# shutdown-y 0
3) after entering a single user, type the command on all file systems mount:
# mount-a
4) use the bdf command to see if the file system is already on mount, and if on mount, use the command # umount file system name to umount the file system. For example, to expand "/ usr" to 500m, type the command: # umount / usr
5) use the command:
# lvextend-L 500 / dev/vg00/lvol4
Here, assume that / usr corresponds to / dev/vg00/lvol4
6) use the command:
# extendfs / dev/vg00/lvol4 expands the file system.
Note: if it is a vxfs file system, use the
# extendfs-F vxfs / dev/vg00/lvol4
7) use the command: # mount / dev/vg00/lvol4 / usr
Mount the file system to / usr, so that the file system "/ usr" is expanded
8) enter the original multi-user runtime with the command: # init 3.
Comments: if the file system in multi-user mode umount command prompt "busy", it is not necessary to restart the system into single-user mode to execute umount commands, you can use in multi-user mode (fuser-cku file system) method to kill and unmount the file system related processes, and then perform unmount, and finally through the lvextend and extendfs commands to expand the file system. Force uninstall can be done using umount-l / dataarchive.
At this point, the study on "how to correctly use LVM and corresponding commands under linux" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.