/-
Created
November 27, 2017 17:11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Command (m for help): p | |
Disk /dev/sda: 447.1 GiB, 480103981056 bytes, 937703088 sectors | |
Units: sectors of 1 * 512 = 512 bytes | |
Sector size (logical/physical): 512 bytes / 512 bytes | |
I/O size (minimum/optimal): 512 bytes / 512 bytes | |
Disklabel type: gpt | |
Disk identifier: 05E22199-14E6-4D70-B783-B3825FA7965F | |
Device Start End Sectors Size Type | |
/dev/sda1 2048 2099199 2097152 1G EFI System | |
/dev/sda2 2099200 2105343 6144 3M Linux filesystem | |
/dev/sda3 2105344 16779263 14673920 7G Linux swap | |
/dev/sda4 16779264 937703054 920923791 439.1G Linux filesystem | |
Filesystem/RAID signature on partition 1 will be wiped. | |
Command (m for help): w | |
The partition table has been altered. | |
Failed to remove partition 2 from system: Device or resource busy | |
Failed to add partition 2 to system: Device or resource busy | |
Failed to add partition 4 to system: Device or resource busy | |
The kernel still uses the old partitions. The new table will be used at the next reboot. | |
Syncing disks. | |
~ ❯❯❯ sudo fdisk /dev/sda | |
Welcome to fdisk (util-linux 2.31). | |
Changes will remain in memory only, until you decide to write them. | |
Be careful before using the write command. | |
Command (m for help): p | |
Disk /dev/sda: 447.1 GiB, 480103981056 bytes, 937703088 sectors | |
Units: sectors of 1 * 512 = 512 bytes | |
Sector size (logical/physical): 512 bytes / 512 bytes | |
I/O size (minimum/optimal): 512 bytes / 512 bytes | |
Disklabel type: gpt | |
Disk identifier: 05E22199-14E6-4D70-B783-B3825FA7965F | |
Device Start End Sectors Size Type | |
/dev/sda1 2048 2099199 2097152 1G EFI System | |
/dev/sda2 2099200 2105343 6144 3M Linux filesystem | |
/dev/sda3 2105344 16779263 14673920 7G Linux swap | |
/dev/sda4 16779264 937703054 920923791 439.1G Linux filesystem | |
Command (m for help): p | |
Disk /dev/sda: 447.1 GiB, 480103981056 bytes, 937703088 sectors | |
Units: sectors of 1 * 512 = 512 bytes | |
Sector size (logical/physical): 512 bytes / 512 bytes | |
I/O size (minimum/optimal): 512 bytes / 512 bytes | |
Disklabel type: gpt | |
Disk identifier: 05E22199-14E6-4D70-B783-B3825FA7965F | |
Device Start End Sectors Size Type | |
/dev/sda1 2048 2099199 2097152 1G EFI System | |
/dev/sda2 2099200 2105343 6144 3M Linux filesystem | |
/dev/sda3 2105344 16779263 14673920 7G Linux swap | |
/dev/sda4 16779264 937703054 920923791 439.1G Linux filesystem | |
Command (m for help): w | |
The partition table has been altered. | |
Syncing disks. |
qgb@ubuntu:~$ su
Password:
su: Authentication failure
qgb@ubuntu:~$
qgb@ubuntu:~$ pvscan ^C
qgb@ubuntu:~$ su
Password:
root@ubuntu:/home/qgb#
root@ubuntu:/home/qgb# pvscan
PV /dev/sda5 VG ubuntu-vg lvm2 [99.28 GiB / 0 free]
Total: 1 [99.28 GiB] / in use: 1 [99.28 GiB] / in no VG: 0 [0 ]
root@ubuntu:/home/qgb#
root@ubuntu:/home/qgb#
root@ubuntu:/home/qgb#
root@ubuntu:/home/qgb# ls
0 bin cc dolphindb go home letsencrypt pspy64 qgv tcc tmp_golang_latest vcpkg vv y
'=16.10.1' busybox_x64 docker-drag github hdc6910 leanengine node qgb rust test ttyd vue work y.pub
root@ubuntu:/home/qgb#
root@ubuntu:/home/qgb# fdisk -l
Disk /dev/sda: 976.6 GiB, 1048576000000 bytes, 2048000000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x6d38ae9e
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 1499135 1497088 731M 83 Linux
/dev/sda2 1501182 2047999999 2046498818 975.9G 5 Extended
/dev/sda5 1501184 209713151 208211968 99.3G 8e Linux LVM
Disk /dev/mapper/ubuntu--vg-root: 98.3 GiB, 105579020288 bytes, 206209024 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/ubuntu--vg-swap_1: 976 MiB, 1023410176 bytes, 1998848 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
root@ubuntu:/home/qgb#
root@ubuntu:/home/qgb# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root ubuntu-vg -wi-ao---- <98.33g
swap_1 ubuntu-vg -wi-ao---- 976.00m
root@ubuntu:/home/qgb# pvs
PV VG Fmt Attr PSize PFree
/dev/sda5 ubuntu-vg lvm2 a-- 99.28g 0
root@ubuntu:/home/qgb# vgs
VG #PV #LV #SN Attr VSize VFree
ubuntu-vg 1 2 0 wz--n- 99.28g 0
root@ubuntu:/home/qgb# fdisk /dev/sda
Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): m
Help:
DOS (MBR)
a toggle a bootable flag
b edit nested BSD disklabel
c toggle the dos compatibility flag
Generic
d delete a partition
F list free unpartitioned space
l list known partition types
n add a new partition
p print the partition table
t change a partition type
v verify the partition table
i print information about a partition
Misc
m print this menu
u change display/entry units
x extra functionality (experts only)
Script
I load disk layout from sfdisk script file
O dump disk layout to sfdisk script file
Save & Exit
w write table to disk and exit
q quit without saving changes
Create a new label
g create a new empty GPT partition table
G create a new empty SGI (IRIX) partition table
o create a new empty DOS partition table
s create a new empty Sun partition table
Command (m for help): d
Partition number (1,2,5, default 5): 2
Partition 2 has been deleted.
Command (m for help): p
Disk /dev/sda: 976.6 GiB, 1048576000000 bytes, 2048000000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x6d38ae9e
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 1499135 1497088 731M 83 Linux
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): e
Partition number (2-4, default 2):
First sector (1499136-2047999999, default 1499136):
Last sector, +sectors or +size{K,M,G,T,P} (1499136-2047999999, default 2047999999):
Created a new partition 2 of type 'Extended' and of size 975.9 GiB.
Command (m for help): p
Disk /dev/sda: 976.6 GiB, 1048576000000 bytes, 2048000000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x6d38ae9e
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 1499135 1497088 731M 83 Linux
/dev/sda2 1499136 2047999999 2046500864 975.9G 5 Extended
Command (m for help): n
All space for primary partitions is in use.
Adding logical partition 5
First sector (1501184-2047999999, default 1501184):
Last sector, +sectors or +size{K,M,G,T,P} (1501184-2047999999, default 2047999999):
Created a new partition 5 of type 'Linux' and of size 975.9 GiB.
Partition #5 contains a LVM2_member signature.
Do you want to remove the signature? [Y]es/[N]o: N
Command (m for help): p
Disk /dev/sda: 976.6 GiB, 1048576000000 bytes, 2048000000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x6d38ae9e
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 1499135 1497088 731M 83 Linux
/dev/sda2 1499136 2047999999 2046500864 975.9G 5 Extended
/dev/sda5 1501184 2047999999 2046498816 975.9G 83 Linux
Command (m for help): x
Expert command (m for help): b
Partition number (1,2,5, default 5):
New beginning of data (1499137-2047999999, default 1501184):
Expert command (m for help): r
Command (m for help): p
Disk /dev/sda: 976.6 GiB, 1048576000000 bytes, 2048000000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x6d38ae9e
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 1499135 1497088 731M 83 Linux
/dev/sda2 1499136 2047999999 2046500864 975.9G 5 Extended
/dev/sda5 1501184 2047999999 2046498816 975.9G 83 Linux
Command (m for help): t
Partition number (1,2,5, default 5):
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'.
Command (m for help): w
The partition table has been altered.
Failed to add partition 2 to system: Device or resource busy
The kernel still uses the old partitions. The new table will be used at the next reboot.
Syncing disks.
root@ubuntu:/home/qgb# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 976.6G 0 disk
├─sda1 8:1 0 731M 0 part /boot
└─sda5 8:5 0 975.9G 0 part
├─ubuntu--vg-root 253:0 0 98.3G 0 lvm /
└─ubuntu--vg-swap_1 253:1 0 976M 0 lvm [SWAP]
sr0 11:0 1 1024M 0 rom
root@ubuntu:/home/qgb# partprobe /dev/sda
root@ubuntu:/home/qgb# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 976.6G 0 disk
├─sda1 8:1 0 731M 0 part /boot
├─sda2 8:2 0 512B 0 part
└─sda5 8:5 0 975.9G 0 part
├─ubuntu--vg-root 253:0 0 98.3G 0 lvm /
└─ubuntu--vg-swap_1 253:1 0 976M 0 lvm [SWAP]
sr0 11:0 1 1024M 0 rom
root@ubuntu:/home/qgb# df -h
Filesystem Size Used Avail Use% Mounted on
udev 3.2G 0 3.2G 0% /dev
tmpfs 645M 992K 644M 1% /run
/dev/mapper/ubuntu--vg-root 97G 91G 783M 100% /
tmpfs 3.2G 0 3.2G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 3.2G 0 3.2G 0% /sys/fs/cgroup
/dev/sda1 719M 216M 467M 32% /boot
tmpfs 645M 0 645M 0% /run/user/1000
//192.168.1.3/test 224G 217G 7.5G 97% /mnt/test
//192.168.1.3/c 224G 217G 7.5G 97% /mnt/c
//192.168.1.8/e 932G 614G 319G 66% /mnt/e
//192.168.1.8/g 11G 1.5G 9.6G 14% /mnt/g
overlay 97G 91G 783M 100% /var/lib/docker/overlay2/72eaaf4854cccf4ae2562ab02ea8f194359c38c0f07a17b800b6d1581591d4b2/merged
//192.168.1.20/smb 6.6G 5.5G 1.2G 83% /mnt/20
overlay 97G 91G 783M 100% /var/lib/docker/overlay2/8c3f5844def23147e0a0891ae872c0a41f825f03aef7f6c5334a2923c1e5e4b5/merged
root@ubuntu:/home/qgb# pvresize /dev/sda5
Physical volume "/dev/sda5" changed
1 physical volume(s) resized / 0 physical volume(s) not resized
root@ubuntu:/home/qgb# pvs
PV VG Fmt Attr PSize PFree
/dev/sda5 ubuntu-vg lvm2 a-- 975.84g 876.56g
root@ubuntu:/home/qgb# lvextend -l +100%FREE /dev/ubuntu14-vg/root
Volume group "ubuntu14-vg" not found
Cannot process volume group ubuntu14-vg
root@ubuntu:/home/qgb# lvextend -l +100%FREE /dev/mapper/ubuntu--vg-root
Size of logical volume ubuntu-vg/root changed from <98.33 GiB (25172 extents) to 974.89 GiB (249572 extents).
Logical volume ubuntu-vg/root successfully resized.
root@ubuntu:/home/qgb# est/dev/mapper/ubuntu--vg-root
bash: est/dev/mapper/ubuntu--vg-root: No such file or directory
root@ubuntu:/home/qgb# //192.168.1.3/c 224G 217G 7.5G 97% /mnt/c^C
root@ubuntu:/home/qgb#
root@ubuntu:/home/qgb# resize2fs /dev/mapper/ubuntu--vg-root
resize2fs 1.44.1 (24-Mar-2018)
Filesystem at /dev/mapper/ubuntu--vg-root is mounted on /; on-line resizing required
old_desc_blocks = 7, new_desc_blocks = 61
The filesystem on /dev/mapper/ubuntu--vg-root is now 255561728 (4k) blocks long.
root@ubuntu:/home/qgb#
root@ubuntu:/home/qgb# df -hT
Filesystem Type Size Used Avail Use% Mounted on
udev devtmpfs 3.2G 0 3.2G 0% /dev
tmpfs tmpfs 645M 992K 644M 1% /run
/dev/mapper/ubuntu--vg-root ext4 960G 91G 829G 10% /
tmpfs tmpfs 3.2G 0 3.2G 0% /dev/shm
tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs tmpfs 3.2G 0 3.2G 0% /sys/fs/cgroup
/dev/sda1 ext2 719M 216M 467M 32% /boot
tmpfs tmpfs 645M 0 645M 0% /run/user/1000
//192.168.1.3/test cifs 224G 217G 7.5G 97% /mnt/test
//192.168.1.3/c cifs 224G 217G 7.5G 97% /mnt/c
//192.168.1.8/e cifs 932G 614G 319G 66% /mnt/e
//192.168.1.8/g cifs 11G 1.5G 9.6G 14% /mnt/g
overlay overlay 960G 91G 829G 10% /var/lib/docker/overlay2/72eaaf4854cccf4ae2562ab02ea8f194359c38c0f07a17b800b6d1581591d4b2/merged
//192.168.1.20/smb cifs 6.6G 5.5G 1.2G 83% /mnt/20
overlay overlay 960G 91G 829G 10% /var/lib/docker/overlay2/8c3f5844def23147e0a0891ae872c0a41f825f03aef7f6c5334a2923c1e5e4b5/merged
root@ubuntu:/home/qgb#
root@ubuntu:/home/qgb#
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
"Failed to add partition 2 to system: Device or resource busy"