mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-29 15:22:30 +03:00
264827cb98
The new option "--fs String" for lvresize/lvreduce/lvextend controls the handling of file systems before/after resizing the LV. --resizefs is the same as --fs resize. The new option "--fsmode String" can be used to control mounting and unmounting of the fs during resizing. Possible --fs values: checksize Only applies to reducing size; does nothing for extend. Check the fs size and reduce the LV if the fs is not using the affected space, i.e. the fs does not need to be shrunk. Fail the command without reducing the fs or LV if the fs is using the affected space. resize Resize the fs using the fs-specific resize command. This may include mounting, unmounting, or running fsck. See --fsmode to control mounting behavior, and --nofsck to disable fsck. resize_fsadm Use the old method of calling fsadm to handle the fs (deprecated.) Warning: this option does not prevent lvreduce from destroying file systems that are unmounted (or mounted if prompts are skipped.) ignore Resize the LV without checking for or handling a file system. Warning: using ignore when reducing the LV size may destroy the file system. Possible --fsmode values: manage Mount or unmount the fs as needed to resize the fs, and attempt to restore the original mount state at the end. nochange Do not mount or unmount the fs. If mounting or unmounting is required to resize the fs, then do not resize the fs or the LV and fail the command. offline Unmount the fs if it is mounted, and resize the fs while it is unmounted. If mounting is required to resize the fs, then do not resize the fs or the LV and fail the command. Notes on lvreduce: When no --fs or --resizefs option is specified: . lvextend default behavior is fs ignore. . lvreduce default behavior is fs checksize (includes activating the LV.) With the exception of --fs resize_fsadm|ignore, lvreduce requires the recent libblkid fields FSLASTBLOCK and FSBLOCKSIZE. FSLASTBLOCK*FSBLOCKSIZE is the last byte used by the fs on the LV, which determines if reducing the fs is necessary.
51 lines
1.7 KiB
C
51 lines
1.7 KiB
C
/*
|
|
* Copyright (C) 2022 Red Hat, Inc. All rights reserved.
|
|
*
|
|
* This file is part of LVM2.
|
|
*
|
|
* This copyrighted material is made available to anyone wishing to use,
|
|
* modify, copy, or redistribute it subject to the terms and conditions
|
|
* of the GNU Lesser General Public License v.2.1.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
#ifndef _FILESYSTEM_H
|
|
#define _FILESYSTEM_H
|
|
|
|
#define FSTYPE_MAX 16
|
|
|
|
struct fs_info {
|
|
char fstype[FSTYPE_MAX];
|
|
char mount_dir[PATH_MAX];
|
|
char fs_dev_path[PATH_MAX]; /* usually lv dev, can be crypt dev */
|
|
unsigned int fs_block_size_bytes; /* 512 or 4k */
|
|
uint64_t fs_last_byte; /* last byte on the device used by the fs */
|
|
uint32_t crypt_offset_bytes; /* offset in bytes of crypt data on LV */
|
|
dev_t crypt_devt; /* dm-crypt device between the LV and FS */
|
|
|
|
unsigned nofs:1;
|
|
unsigned unmounted:1;
|
|
unsigned mounted:1;
|
|
/* for resizing */
|
|
unsigned needs_reduce:1;
|
|
unsigned needs_extend:1;
|
|
unsigned needs_fsck:1;
|
|
unsigned needs_unmount:1;
|
|
unsigned needs_mount:1;
|
|
unsigned needs_crypt:1;
|
|
};
|
|
|
|
int fs_get_info(struct cmd_context *cmd, struct logical_volume *lv,
|
|
struct fs_info *fsi, int include_mount);
|
|
|
|
int fs_extend_script(struct cmd_context *cmd, struct logical_volume *lv, struct fs_info *fsi,
|
|
uint64_t newsize_bytes, char *fsmode);
|
|
int fs_reduce_script(struct cmd_context *cmd, struct logical_volume *lv, struct fs_info *fsi,
|
|
uint64_t newsize_bytes, char *fsmode);
|
|
int crypt_resize_script(struct cmd_context *cmd, struct logical_volume *lv, struct fs_info *fsi,
|
|
uint64_t newsize_bytes_fs);
|
|
#endif
|