잠시만 기다려 주세요

HOME   |  여기는?   |  바다물때표   |  여러가지 팁 (883)  |  추천 및 재미 (142)  |  자료실 (19)  |  끄적거림 (515)  |  시나리오 (760)  |  드라마 대본 (248)  |  

2020년 08월 14일
빈둥 거리지 말고 일어서야 할 때는 일어서고 집에 가야 할 때는 가야 한다. - 바다아이
 




    freebsd 데스크탑

freebsd 데스크탑 - 디스크 크기 조정, 디스크 사이즈 변경, Resizing and Growing Disks
이 름 : 바다아이   |   조회수 : 75         짧은 주소 : https://www.bada-ie.com/su/?901593657220
아래 예제는 스왑 파티션을 잠시 지웠다가 고 위에 파티션에 새 용량 합치고
그리고 다시 스왑을 생성해서 잡아주는 과정이네요...
자세히 보시면서 원리 파악하시면 되겠습니다.


Originally contributed by Allan Jude.

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:

# gpart show ada0
=>      34  83886013  ada0  GPT  (48G) [CORRUPT]
        34       128     1  freebsd-boot  (64k)
       162  79691648     2  freebsd-ufs  (38G)
  79691810   4194236     3  freebsd-swap  (2G)
  83886046         1        - free -  (512B)

Note:

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:

# gpart show ada0
=>       34  102399933  ada0  GPT  (48G)
         34        128     1  freebsd-boot  (64k)
        162   79691648     2  freebsd-ufs  (38G)
   79691810    4194236     3  freebsd-swap  (2G)
   83886046   18513921        - free -  (8.8G)

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.

# gpart delete -i 3 ada0
ada0p3 deleted
# gpart show ada0
=>       34  102399933  ada0  GPT  (48G)
         34        128     1  freebsd-boot  (64k)
        162   79691648     2  freebsd-ufs  (38G)
   79691810   22708157        - free -  (10G)

Warning:

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.

# gpart resize -i 2 -s 47G -a 4k ada0
ada0p2 resized
# gpart show ada0
=>       34  102399933  ada0  GPT  (48G)
         34        128     1  freebsd-boot  (64k)
        162   98566144     2  freebsd-ufs  (47G)
   98566306    3833661        - free -  (1.8G)

Recreate the swap partition and activate it. If no size is specified with -s, all remaining space is used:

# gpart add -t freebsd-swap -a 4k ada0
ada0p3 added
# gpart show ada0
=>       34  102399933  ada0  GPT  (48G)
         34        128     1  freebsd-boot  (64k)
        162   98566144     2  freebsd-ufs  (47G)
   98566306    3833661     3  freebsd-swap  (1.8G)
# swapon /dev/ada0p3

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.


좀 더 자세한 것은 아래 사이트 참고...

출처 : https://www.freebsd.org/doc/handbook/disks-growing.html

| |


      1 page / 1 page
번 호 카테고리 제 목 이름 조회수
현재글 freebsd 데스크탑 , , Resizing and Growing Disks 바다아이 76
28 freebsd 데스크탑 Port PKG , 바다아이 108
27 freebsd 데스크탑 freebsd nvidia driver, nvidia 바다아이 1663
26 freebsd 데스크탑 freebsd locale 바다아이 1656
25 freebsd 데스크탑 freebsd , disk partition, diskbandwidth 바다아이 1926
24 freebsd 데스크탑 freebsd , , . shell 바다아이 2035
23 freebsd 데스크탑 freebsd 바다아이 2054
22 freebsd 데스크탑 freebsd , .... hard Transfer speed test 바다아이 1981
21 freebsd 데스크탑 freebsd , , user add del 바다아이 2352
20 freebsd 데스크탑 freebsd geoip 바다아이 2304
19 freebsd 데스크탑 freebsd , .... ko_KR.UTF-8, csh, bash 바다아이 2385
18 freebsd 데스크탑 FreeBSD csh linux bash 바다아이 2179
17 freebsd 데스크탑 freebsd , , , ls, ll ... 바다아이 2233
16 freebsd 데스크탑 freebsd, linux top cpu , cpu , core 바다아이 2597
15 freebsd 데스크탑 , freebsd tar , 바다아이 3247
14 freebsd 데스크탑 freebsd pkg repo 바다아이 3174
13 freebsd 데스크탑 freebsd , , , libreoffice 바다아이 3669
12 freebsd 데스크탑 freebsd , , 바다아이 3292
11 freebsd 데스크탑 freebsd .... ... 바다아이 3035
10 freebsd 데스크탑 freebsd smplayer mpv mplayer vlc 바다아이 2814
9 freebsd 데스크탑 freebsd , 바다아이 3324
8 freebsd 데스크탑 freebsd zfs , , 바다아이 3043
7 freebsd 데스크탑 freebsd virtualbox 바다아이 2844
6 freebsd 데스크탑 freebsd zfs ... 바다아이 2872
5 freebsd 데스크탑 freebsd firefox thunderbird 바다아이 3541
4 freebsd 데스크탑 freebsd navi , , xfce 바다아이 3726
3 freebsd 데스크탑 freebsd kernel , nvidia 바다아이 2824
2 freebsd 데스크탑 freebsd ext4 바다아이 2873
1 freebsd 데스크탑 freebsd ps/2 바다아이 2781
| |








Copyright ⓒ 2001.12. bada-ie.com. All rights reserved.
이 사이트는 리눅스에서 firefox 기준으로 작성되었습니다. 기타 브라우저에서는 다르게 보일 수 있습니다.
[ FreeBSD + GoLang + PostgreSQL ]
서버위치 : 구글 클라우드 플랫폼  실행시간 : 0.21028
to webmaster... gogo sea. gogo sea.