In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Features of btrfs:
1. Scalability:
Extent is the smallest logical unit, and each extent is composed of a contiguous set of block
The number of inode of ext file system is certain, and the number of inode of btrfs is dynamically adjustable.
two。 Multiple physical volumes support:
Btrfs can dynamically add or decrease devices across multiple physical devices to achieve the purpose of expanding or reducing capacity. From a technical point of view, btrfs also supports raid0,raid1,raid5,raid10, etc., and can also support adding, deleting and modifying devices online.
3. Copy update mechanism on write (COW,Copy on Write)
The so-called COW means that every time you write disk data, the data of the current block is copied to a new block, and the data is updated and written in the new block. When the new block is written, you only need to point the pointer to the old block to the new block.
4. Double check mechanism-both data and metadata have a check code: checksum
5. Support for subvolumes: subfile system
6. Snapshot volumes are supported:
Take a snapshot of the parent volume
Take a snapshot of the subvolume
Take a left snapshot of the snapshot volume
7. Transparent compression, invisible compression:
Mkfs.btrfs
-L: specify the volume label for the btrfs file system to be created
-d: specify the type for the data store; optional types: raid0, raid1, raid5, raid6, raid10 or single.
-m: specify the storage method of metadata; you can choose the following types: raid0, raid1, raid5, raid6, raid10, single or dup.
-O: specify the properties of the btrfs file system, if you want to view some features mkfs.btrfs-O list-all
You can use the following transparent compression features in mount commands that support btrfs file systems
Mount-o compress= {lzo | zlib} DEVICE MOUNT_POINT
Btrfs
Btrfs-control a btrfs filesystem
Btrfs []
Btrfs filesystem show
View detailed properties of the btrfs file system
Btrfs filesystem df / mnt/btrfs/ (MOUNT_POINT)
View the mount and usage of the file system
Example: btrfs filesystem df / mnt/btrfs/
Modify the file system online
Btrfs filesystem resize {+ | -} SIZE [kKgGtTmMpPeE] MOUNT_POINT
Example: btrfs filesystem resize-15g / mnt/btrfs/
Btrfs filesystem resize + 5G / mnt/btrfs/
Btrfs filesystem resize max / mnt/btrfs/
Add or remove devices to the btrfs file system
Btrfs device
Btrfs device add [options] [...]
Add a new device to the file system
Btrfs device delete [...]
Remove a device from the file system
Balanced data
Btrfs balance start [options]
Turn on data balancing for cross-device chunk
-mconvert= {radi0 | raid1 | raid5 | radi10 | raid6 | single | dup}
Change the data balance layout of metadata
Example: btrfs balance start-mconvert=raid5 / mnt/btrfs/
-dconvert= {radi0 | raid1 | raid5 | radi10 | raid6 | single}
Change the layout of data balance
Example: btrfs balance start-dconvert=raid6 / mnt/btrfs/
Btrfs balance pause
Pause data balance
Btrfs balance cancel
Unbalance running or paused data
Btrfs balance resume
Resume interrupted balance restores interrupted data balance
Btrfs balance status [- v]
Displays status information for running or paused data balances
Show status of running or paused balance
Subvolume management:
Btrfs subvolume create [- I] [/]
Create a subvolume
Example: btrfs subvolume create / mnt/btrfs/mysub1/
Btrfs subvolume delete [options] [...]
Delete subvolum
Example: btrfs subvolume delete / mnt/btrfs/mysub1/
A subvolume is similar to a partition in an ext file system that hangs other partitions to a free subdirectory under the root directory.
Snapshot
Btrfs subvolume snapshot [- r] [- I] | [/]
Example: btrfs subvolume show
Display information for subvolumes
Btrfs subvolume show / mnt/btrfs/mysub1/
Creates a snapshot volume of the specified subvolume
Btrfs subvolume snapshot / mnt/btrfs/mysub1/ / mnt/btrfs/snap_mysub1
Convert btrfs and ext series
Btrfs-convert
Replace the ext series file system with btrfs
Btrfs-convert / dev/sdb1
Note: / dev/sdb1 partition, must be pre-formatted as ext series file system
Roll back the file system btrfs to ext
Btrfs-convert-r / dev/sdb1
Disk quota:
File server: shared storage space that allows users to store data at any time
FTP:
SMB:
Network disk: upload quickly
Disk quota is mainly put forward to limit the use of disk space for this kind of file server.
Setting object of disk quota
1. Block devices capable of performing read and write operations
two。 To have the correct file system
Disk quota mainly restricts who's access behavior.
1. User
Limit disk usage for specified users
1) disk space (block); a block limit represents 1kb storage space
2) inode
two。 Group
Limit the total disk usage of all members of a specified group
Type of disk quota
1.soft limit: soft limit
When the user's disk usage reaches the soft quota limit, the grace period countdown will be started; before the countdown is returned to 0, the user can normally use the remaining quota. Once the countdown is to 0, it means that the user will not be able to continue to use disk space. Unless the data is cleaned up, below the soft limit, you can continue to use disk space.
2.hard limit: hard limit
The real upper limit of disk space that users can use
Generally speaking, the soft limit is lower than the hard limit.
The default grace period in Linux is 7 days
A data file is required for users to record disk usage and quotas for users and groups
Aquota.user
Aquota.group
If you want the partition or volume to support disk quota setting, you need a separate mount option
Usrquota grpquota
1.mount-o usrquota,grpquota DEVICE MOUNT_POINT
2.ect/fstab
DEVICE (device) MOUNT_POINT FYTYPE defaults,usrquota,grpquota 0 0
Quotacheck
Quotacheck-scan a filesystem for disk usage, create, check and repair quota files
-v: displays the details of the entire operation
-g: create, detect, and repair group quota files
-u: create, detect, and repair user quota files
-c: after detection, if there is no user quota file or group quota file, the file is created according to the options given by the user
-a: whether there are quota files on all devices that contain mount options related to disk quotas in / dec/fstab
Commands for writing quota content
Edquota
-u: write user quota, default function
-g: write group quotas, not recommended
-t: set the grace period beyond the soft limit. The default is 7 days. You can choose time units such as seconds, minutes, hours, days, etc.
Make the quota function effective
Quotaon,quotaoff
Quotaon | quotaoff / dev/sdb1
View quota usage
Quota
Repquota (available only to root users)
Note: root is not subject to disk quota
Linux package Management
Program: instruction + data
Object-oriented programs: algorithms + data structures
The form of existence of the application
1. Source code form: a text file that contains all the code in the programming language of the entire application
two。 Binary: a file that can be executed directly after a series of conversion operations.
Use source code to install the application
1. Preprocessing (preprocessor)-- > compilation (compiler)-- > assembly (assembler)-- > link (linker)-- > binary program files that can be executed directly
POSIX:POS, portable operating system
API: application programming interface
ABI: apply binary interface
Library-level compatibility, library-level virtualization
Cywin: a shared library that can simulate Linux in Windows system
WinE: a library for simulating Windows in Linux systems
Application level programming language
Java/Python/Perl/ruby/PHP/GO
System-level programming language
C / C +
Linux
Unix
In order to be able to compile the source code, it needs to be supported by the compiler development environment.
C _ blank
Compiler development environment: preprocessor, compiler, header file, development library file
Java/Python:
Compiler development environment: preprocessor, compiler, development library files
In general, source code files are composed of multiple files, and there is a certain relationship between these files, which we call dependency relationship.
Autoconf
Automake
Software project building tools:
C/C++:make
Java:maven
Python:buildout
Package Manager:
Install, uninstall, upgrade, query and verify the program in the designated system
Different Linux distributions have different package managers
Package file with the Debian:dpt .deb suffix name; dpkg management tool
Redhat:rpm,rpm management tool, .rpm suffix name
Rpm becomes the industry standard for Linux's package manager
Rpm is written in Perl language and re-rpm in C language
Rpm is package manager
S.u.S.Epurrpm.rpm suffix name
Gentoo: using FreeBSd emerge management tools
ArchLinux:pacman management mechanism
Take centos as an example, the relevant content of rpm package manager
The package manager for centos:
Naming rules for packages:
Source code package:
Software_name-VERSION.tar.gz
VERSION:major.minor.release
Major: the major version number, which usually represents the version branch of major feature improvements
Minor: minor version number, which usually represents a change in a function in a branch of a version
Release: release number, fixed some bug or optimized a piece of code
Rpm package naming rules
Source code packet
Software_name-VERSION.src.rpm
Binary packet
Software_name-VERSION- [release]. [os]. Arch.rpm
VERSION:major.minor.release
[release]: the release number of the rpm packet
[os]: version information of the operating system supported by the software el6,el7, suse11
Arch: hardware platform type, i386, sparc
When making rpm packages, its makers usually use subcontracting technology to build rpm packages.
Build multiple packages according to the different functions of the program
Packages that are subcontracted generally include two categories:
Main package:
Software_name-VERSION- [release]. [os]. Arch.rpm
Ancillary feature Pack:
Software_name-function-VERSION- [release]. [os]. Arch.rpm
Generally speaking, the main package and the subsidiary package have the same version number, release number, operating system and compatible platform identification.
Therefore, the main package is often relied on by all the ancillary feature packages, which cannot be installed without installing the main package.
Function:devel,utils,libs,tools, manual
Front-end tools for package management:
RHEL | the front-end management tool of Centos system: yum,Yellow Dog Update Midifier
Yum will start a transaction when implementing installation, upgrade, uninstallation and other tasks.
The so-called transaction regards the whole operation as a whole, either all or none at all.
Front-end tool of debian system: apt-get,apt-cache
Apt-get: implement installation, uninstall and other functions
Apt-cache: implement keyword-based search function to manage local cache and cached metadata
Suse front-end tool: zypper
Rpm package Management tool
1.rpm command line tool
2.yum tool
Rpm command line tool
Features:
1. Package the component files of the compiled application into one or more package files
two。 Software package installation, uninstall, upgrade, query, verification and database management functions
A list of the files in the rpm package:
1. The file of the program
two。 List of documents
3. The script files that run when the software is installed or uninstalled are divided into four categories:
Preinstall: script run before the formal installation operation begins,% pre
Postinstall: script executed after installation is complete,% post
Preuninstall: script run before the official uninstall operation starts,% preun
Postuninstall: script executed after the uninstall is complete,% postun
Rpm Database (Public)
The name and version of the installed package
/ var/lib/rpm
The way to get the package
1. CD-ROM of the distribution version of the system
two。 An official file server or mirror site; http://mirrors.aliyun.com https://mirrors.tuna.tsinghua.edu.cn
3. The official site of a project
4. Rpm package site Fedora EPEL produced by a third-party organization: a community organization for Red Hat Light play, which also contains EPEL images in the mirror site.
Special search engine: http://pkgs.org http://rpmfind.net
5. Make it yourself
Recommendation: implement an integrity check after obtaining the package
Source legitimacy:
The data encrypted by the digital signature of the program provider is decrypted and verified by its public key
Package integrity
Check code sha-1
The use of rpm and yum tools
Rpm command line tool:
Install, uninstall, upgrade (downgrade), query, file verification, verification and database maintenance
Common options for the rpm command
-v: displays the information of the installation routine, only the name of the installation software
-vv: displays very detailed operation information
Installation:
Rpm {- I |-- install} [install-options] PACKAGE_FILE...
Install-options
-h: use 50 # to indicate installation progress
-- test: it's not really about installing the package, it's just testing whether it can be done properly during installation, dry run mode
-- nodeps: ignore installation errors caused by dependencies and are not recommended
-- replacefiles: when installing a software package, the files in the package will directly replace the files that were originally installed
-- replacepkgs: reinstall without uninstalling the package
-- noscripts: do not run any scripts
-- nopre: pre-installation script
-- nopost: post-installation script
-- nosignature: regardless of whether the source of the installation package is legitimate
-- nodigest: regardless of whether the package is complete
Example: ~] # rpm-ivh php-mysql-5.3.3-40.el6_6.x86_64.rpm php-pdo-5.3.3-40.el6_6.x86_64.rpm
Upgrade
Rpm {- U |-- upgrade} [install-options] PACKAGE_FILE...
If you choose to install a package that has not been installed in advance, you can install it completely, and if you have already installed the old version, you can upgrade the installation.
Rpm {- F |-- freshen} [install-options] PACKAGE_FILE...
Only low-version packages that have been installed can only be upgraded and installed
Common options are the same as installation
-- oldpackage: downgrade the installation and replace the new version of the package with the old version
-- force: force upgrade
Be careful
1. It is strongly recommended that you do not upgrade the kernel; Linux can support multiple kernels, you can install a new version of the kernel directly, and you can replace it manually in the startup interface
two。 Upgrading the installation may change the files, so by default, the system will not directly change the configuration file of the previously installed software, and the configuration file in the new package will be renamed, usually: FINENAME.rpmnew
Uninstall:
Rpm {- e |-- erase} [--allmatches] [--nodeps] [--noscripts]
[--notriggers] [--test] PACKAGE_NAME...
-- allmatches: uninstalls all versions of packages that match the specified name
-- nodeps: ignores dependencies when uninstalling, and is not recommended
-- test: test uninstall, dry run mode
Query:
Rpm {- Q |-- query} [select-options] [query-options]
PACKAGE_NAME: give the package name directly
-a: query all installed program information
-f FILE: find out which package provided the specified file
-p PACKAGE_NAME: perform query operations on package files that have not yet been installed
-- whatprovides CAPABILITY: query which package the specified CAPABILITY is provided by
-- whatrequires CAPABILITY: queries which package the specified CAPABILITY is dependent on
Query-options
-- changelog: query the changelog of the rpm package
-cmam:: query which configuration files are in the development package.
-dmine: query which document files are in the development package
-imam murmurinfo: query package-related information, including version number, release number, etc.
-lmmam Musi list: the list shows which files will be generated by the package installation
-- provides: lists all the CAPABILITY provided by the specified package
-Rmaine Mustang: query the dependencies of the specified package
-- scripts: view the contents of the scripts carried by the package
Specific usage:
-qf FILE
-qc |-ql |-qd |-qi PACKAGE_NAME
-qpl |-qpc |-qpd |-qpi PACKAGE_FILE
Check:
Rpm {- V |-- verify} [select-options] [verify-options]
S file Size differs
M Mode differs (includes permissions and file type)
5 digest (formerly MD5 sum) differs
D Device major/minor number mismatch
L readLink (2) path mismatch
U User ownership differs
G Group ownership differs
T mTime differs
P caPabilities differ
Certification:
Rpm-import / PATH/TO/KEY_FILE
Rpm-K / PATH/TO/PACKAGE_FILE
Database Management:
Initialization and reconstruction of database
/ var/lib/rpm
Rpm {--initdb |-- rebuilddb}
[--dbpath DIRECTORY]
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.