freebsd 데스크탑 - 디스크 크기 조정, 디스크 사이즈 변경, Resizing and Growing Disks
이 름 : 바다아이
|
조회수 : 9604
짧은 주소 : https://www.bada-ie.com/su/?901593657220
아래 예제는 스왑 파티션을 잠시 지웠다가 고 위에 파티션에 새 용량 합치고
그리고 다시 스왑을 생성해서 잡아주는 과정이네요...
자세히 보시면서 원리 파악하시면 되겠습니다.
Originally contributed by AllanJude.
A disk's capacity can increase without any changes to the data already present. This happens commonly with virtual machines, when the virtual disk turns out to be too small and is enlarged. Sometimes a disk image is written to a USB memory stick, but does not use the full capacity. Here we describe how to resize or grow disk contents to take advantage of increased capacity.
Determine the device name of the disk to be resized by inspecting /var/run/dmesg.boot. In this example, there is only one SATA disk in the system, so the drive will appear as ada0.
List the partitions on the disk to see the current configuration:
If the disk was formatted with the GPT partitioning scheme, it may show as “corrupted” because the GPT backup partition table is no longer at the end of the drive. Fix the backup partition table with gpart:
#gpart recover ada0
ada0 recovered
Now the additional space on the disk is available for use by a new partition, or an existing partition can be expanded:
Partitions can only be resized into contiguous free space. Here, the last partition on the disk is the swap partition, but the second partition is the one that needs to be resized. Swap partitions only contain temporary data, so it can safely be unmounted, deleted, and then recreate the third partition after resizing the second partition.
Disable the swap partition:
#swapoff /dev/ada0p3
Delete the third partition, specified by the -i flag, from the disk ada0.
There is risk of data loss when modifying the partition table of a mounted file system. It is best to perform the following steps on an unmounted file system while running from a live CD-ROM or USB device. However, if absolutely necessary, a mounted file system can be resized after disabling GEOM safety features:
#sysctl kern.geom.debugflags=16
Resize the partition, leaving room to recreate a swap partition of the desired size. The partition to resize is specified with -i, and the new desired size with -s. Optionally, alignment of the partition is controlled with -a. This only modifies the size of the partition. The file system in the partition will be expanded in a separate step.
Grow the UFS file system to use the new capacity of the resized partition:
#growfs /dev/ada0p2
Device is mounted read-write; resizing will result in temporary write suspension for /.
It's strongly recommended to make a backup before growing the file system.
OK to grow file system on /dev/ada0p2, mounted on /, from 38GB to 47GB? [Yes/No] Yes
super-block backups (for fsck -b #) at:
80781312, 82063552, 83345792, 84628032, 85910272, 87192512, 88474752,
89756992, 91039232, 92321472, 93603712, 94885952, 96168192, 97450432
If the file system is ZFS, the resize is triggered by running the online subcommand with -e:
#zpool online -e zroot/dev/ada0p2
Both the partition and the file system on it have now been resized to use the newly-available disk space.
Copyright ⓒ 2001.12. bada-ie.com. All rights reserved.
이 사이트는 리눅스에서 firefox 기준으로 작성되었습니다. 기타 브라우저에서는 다르게 보일 수 있습니다.
[ Ubuntu + GoLang + PostgreSQL + Mariadb ]
서버위치 : 오라클 클라우드 춘천 실행시간 : 0.07648 초 to webmaster... gogo sea. gogo sea.