vps数据盘、系统盘分区操作:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 |
[byrd@hk ~]$ sudo bash We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great responsibility. [sudo] password for byrd: [root@hk byrd]# Broadcast message from root@hk.t4x.org (/dev/pts/0) at 22:00 ... The system is going down for reboot NOW! Connection closed by foreign host. Type `help' to learn how to use Xshell prompt. Xshell:\> Connecting to 103.243.128.87:3XX97... Connection established. To escape to local shell, press 'Ctrl+Alt+]'. Last login: Mon May 5 21:40:47 2014 from 1.1.1.1 [byrd@hk ~]$ sudo bash [sudo] password for byrd: [root@hk byrd]# fdisk -l Disk /dev/sda: 10.7 GB, 10737418240 bytes 255 heads, 63 sectors/track, 1305 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00073ffb Device Boot Start End Blocks Id System /dev/sda1 * 1 64 512000 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 64 1306 9972736 8e Linux LVM Disk /dev/sdb: 16.1 GB, 16106127360 bytes 255 heads, 63 sectors/track, 1958 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xcbc85cc2 Device Boot Start End Blocks Id System Disk /dev/mapper/vg_cloud-lv_root: 8095 MB, 8095006720 bytes 255 heads, 63 sectors/track, 984 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/mapper/vg_cloud-lv_swap: 2113 MB, 2113929216 bytes 255 heads, 63 sectors/track, 257 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 [root@hk byrd]# fdisk /dev/sdb WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-1958, default 1): 1 Last cylinder, +cylinders or +size{K,M,G} (1-1958, default 1958): +1G Command (m for help): M Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only) Command (m for help): T Selected partition 1 Hex code (type L to list codes): 1 Changed system type of partition 1 to 1 (FAT12) Command (m for help): t Selected partition 1 Hex code (type L to list codes): 8e Changed system type of partition 1 to 8e (Linux LVM) Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 2 First cylinder (133-1958, default 133): 133 Last cylinder, +cylinders or +size{K,M,G} (133-1958, default 1958): +7G Command (m for help): p Disk /dev/sdb: 16.1 GB, 16106127360 bytes 255 heads, 63 sectors/track, 1958 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xcbc85cc2 Device Boot Start End Blocks Id System /dev/sdb1 1 132 1060258+ 8e Linux LVM /dev/sdb2 133 1047 7349737+ 83 Linux Command (m for help): t Partition number (1-4): 2 Hex code (type L to list codes): 8e Changed system type of partition 2 to 8e (Linux LVM) Command (m for help): n Command action e extended p primary partition (1-4) e Partition number (1-4): 1 Partition 1 is already defined. Delete it before re-adding it. Command (m for help): n Command action e extended p primary partition (1-4) e Partition number (1-4): 5 Value out of range. Partition number (1-4): 2 Partition 2 is already defined. Delete it before re-adding it. Command (m for help): n Command action e extended p primary partition (1-4) e Partition number (1-4): 3 First cylinder (1048-1958, default 1048): Using default value 1048 Last cylinder, +cylinders or +size{K,M,G} (1048-1958, default 1958): Using default value 1958 Command (m for help): p Disk /dev/sdb: 16.1 GB, 16106127360 bytes 255 heads, 63 sectors/track, 1958 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xcbc85cc2 Device Boot Start End Blocks Id System /dev/sdb1 1 132 1060258+ 8e Linux LVM /dev/sdb2 133 1047 7349737+ 8e Linux LVM /dev/sdb3 1048 1958 7317607+ 5 Extended Command (m for help): n Command action l logical (5 or over) p primary partition (1-4) p Selected partition 4 No free sectors available Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: If you have created or modified any DOS 6.x partitions, please see the fdisk manual page for additional information. Syncing disks. [root@hk byrd]# mkfs -t ext4 /dev/sdb2 mke2fs 1.41.12 (17-May-2010) 文件系统标签= 操作系统:Linux 块大小=4096 (log=2) 分块大小=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 459648 inodes, 1837434 blocks 91871 blocks (5.00%) reserved for the super user 第一个数据块=0 Maximum filesystem blocks=1883242496 57 block groups 32768 blocks per group, 32768 fragments per group 8064 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632 正在写入inode表: 完成 Creating journal (32768 blocks): 完成 Writing superblocks and filesystem accounting information: 完成 This filesystem will be automatically checked every 32 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. [root@hk byrd]# mkfs -t ext4 /dev/sdb3 mke2fs 1.41.12 (17-May-2010) mkfs.ext4: inode_size (128) * inodes_count (0) too big for a filesystem with 0 blocks, specify higher inode_ratio (-i) or lower inode count (-N). [root@hk byrd]# mkfs -t ext4 /dev/sdb3 mke2fs 1.41.12 (17-May-2010) mkfs.ext4: inode_size (128) * inodes_count (0) too big for a filesystem with 0 blocks, specify higher inode_ratio (-i) or lower inode count (-N). [root@hk byrd]# fdisk /dev/sdb WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): d Partition number (1-5): 3 Command (m for help): p Disk /dev/sdb: 16.1 GB, 16106127360 bytes 255 heads, 63 sectors/track, 1958 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xcbc85cc2 Device Boot Start End Blocks Id System /dev/sdb1 1 132 1060258+ 8e Linux LVM /dev/sdb2 133 1047 7349737+ 8e Linux LVM Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 3 First cylinder (1048-1958, default 1048): Using default value 1048 Last cylinder, +cylinders or +size{K,M,G} (1048-1958, default 1958): Using default value 1958 Command (m for help): p Disk /dev/sdb: 16.1 GB, 16106127360 bytes 255 heads, 63 sectors/track, 1958 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xcbc85cc2 Device Boot Start End Blocks Id System /dev/sdb1 1 132 1060258+ 8e Linux LVM /dev/sdb2 133 1047 7349737+ 8e Linux LVM /dev/sdb3 1048 1958 7317607+ 83 Linux Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. [root@hk byrd]# mkfs -t ext4 /dev/sdb3 mke2fs 1.41.12 (17-May-2010) 文件系统标签= 操作系统:Linux 块大小=4096 (log=2) 分块大小=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 457856 inodes, 1829401 blocks 91470 blocks (5.00%) reserved for the super user 第一个数据块=0 Maximum filesystem blocks=1874853888 56 block groups 32768 blocks per group, 32768 fragments per group 8176 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632 正在写入inode表: 完成 Creating journal (32768 blocks): 完成 Writing superblocks and filesystem accounting information: 完成 This filesystem will be automatically checked every 35 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. [root@hk byrd]# df -lh 文件系统 容量 已用 可用 已用%% 挂载点 /dev/mapper/vg_cloud-lv_root 7.5G 3.5G 3.7G 49% / tmpfs 249M 0 249M 0% /dev/shm /dev/sda1 485M 32M 428M 7% /boot [root@hk byrd]# df 文件系统 1K-块 已用 可用 已用% 挂载点 /dev/mapper/vg_cloud-lv_root 7781012 3590352 3795396 49% / tmpfs 254584 0 254584 0% /dev/shm /dev/sda1 495844 31980 438264 7% /boot [root@hk byrd]# fdisk -l Disk /dev/sda: 10.7 GB, 10737418240 bytes 255 heads, 63 sectors/track, 1305 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00073ffb Device Boot Start End Blocks Id System /dev/sda1 * 1 64 512000 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 64 1306 9972736 8e Linux LVM Disk /dev/sdb: 16.1 GB, 16106127360 bytes 255 heads, 63 sectors/track, 1958 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xcbc85cc2 Device Boot Start End Blocks Id System /dev/sdb1 1 132 1060258+ 8e Linux LVM /dev/sdb2 133 1047 7349737+ 8e Linux LVM /dev/sdb3 1048 1958 7317607+ 83 Linux Disk /dev/mapper/vg_cloud-lv_root: 8095 MB, 8095006720 bytes 255 heads, 63 sectors/track, 984 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/mapper/vg_cloud-lv_swap: 2113 MB, 2113929216 bytes 255 heads, 63 sectors/track, 257 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 [root@hk byrd]# fdisk /dev/sdb WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): t Partition number (1-4): 3 Hex code (type L to list codes): 8e Changed system type of partition 3 to 8e (Linux LVM) Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. [root@hk byrd]# mkfs -t ext4 /dev/sdb3 mke2fs 1.41.12 (17-May-2010) 文件系统标签= 操作系统:Linux 块大小=4096 (log=2) 分块大小=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 457856 inodes, 1829401 blocks 91470 blocks (5.00%) reserved for the super user 第一个数据块=0 Maximum filesystem blocks=1874853888 56 block groups 32768 blocks per group, 32768 fragments per group 8176 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632 正在写入inode表: 完成 Creating journal (32768 blocks): 完成 Writing superblocks and filesystem accounting information: 完成 This filesystem will be automatically checked every 28 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. [root@hk byrd]# fdisk -l Disk /dev/sda: 10.7 GB, 10737418240 bytes 255 heads, 63 sectors/track, 1305 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00073ffb Device Boot Start End Blocks Id System /dev/sda1 * 1 64 512000 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 64 1306 9972736 8e Linux LVM Disk /dev/sdb: 16.1 GB, 16106127360 bytes 255 heads, 63 sectors/track, 1958 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xcbc85cc2 Device Boot Start End Blocks Id System /dev/sdb1 1 132 1060258+ 8e Linux LVM /dev/sdb2 133 1047 7349737+ 8e Linux LVM /dev/sdb3 1048 1958 7317607+ 8e Linux LVM Disk /dev/mapper/vg_cloud-lv_root: 8095 MB, 8095006720 bytes 255 heads, 63 sectors/track, 984 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/mapper/vg_cloud-lv_swap: 2113 MB, 2113929216 bytes 255 heads, 63 sectors/track, 257 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 [root@hk byrd]# cd /dev/sda2 bash: cd: /dev/sda2: 不是目录 [root@hk byrd]# ll /dev/sda2 brw-rw----. 1 root disk 8, 2 5月 5 22:01 /dev/sda2 [root@hk byrd]# partprobe Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda (设备或资源忙). As a result, it may not reflect all of your changes until after reboot. [root@hk byrd]# vgdisplay --- Volume group --- VG Name vg_cloud System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 3 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 1 Act PV 1 VG Size 9.51 GiB PE Size 4.00 MiB Total PE 2434 Alloc PE / Size 2434 / 9.51 GiB Free PE / Size 0 / 0 VG UUID aCGg1q-jFG3-v3qC-1TY0-ELpR-o7o3-jxoZmz [root@hk byrd]# df 文件系统 1K-块 已用 可用 已用% 挂载点 /dev/mapper/vg_cloud-lv_root 7781012 3590360 3795388 49% / tmpfs 254584 0 254584 0% /dev/shm /dev/sda1 495844 31980 438264 7% /boot [root@hk byrd]# free -m total used free shared buffers cached Mem: 497 187 309 0 2 122 -/+ buffers/cache: 62 434 Swap: 2015 0 2015 [root@hk byrd]# fdisk -l Disk /dev/sda: 10.7 GB, 10737418240 bytes 255 heads, 63 sectors/track, 1305 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00073ffb Device Boot Start End Blocks Id System /dev/sda1 * 1 64 512000 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 64 1306 9972736 8e Linux LVM Disk /dev/sdb: 16.1 GB, 16106127360 bytes 255 heads, 63 sectors/track, 1958 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xcbc85cc2 Device Boot Start End Blocks Id System /dev/sdb1 1 132 1060258+ 8e Linux LVM /dev/sdb2 133 1047 7349737+ 8e Linux LVM /dev/sdb3 1048 1958 7317607+ 8e Linux LVM Disk /dev/mapper/vg_cloud-lv_root: 8095 MB, 8095006720 bytes 255 heads, 63 sectors/track, 984 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/mapper/vg_cloud-lv_swap: 2113 MB, 2113929216 bytes 255 heads, 63 sectors/track, 257 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 [root@hk byrd]# cat /etc/fstab # # /etc/fstab # Created by anaconda on Mon Apr 8 00:57:21 2013 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # /dev/mapper/vg_cloud-lv_root / ext4 defaults 1 1 UUID=63f656e2-4a3c-4b34-a59e-13358830e87b /boot ext4 defaults 1 2 /dev/mapper/vg_cloud-lv_swap swap swap defaults 0 0 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 [root@hk byrd]# :q bash: :q: command not found [root@hk byrd]# swapo swapoff swapon [root@hk byrd]# swapoff Usage: swapoff -a [-v] disable all swaps swapoff [-v] <special> disable given swap swapoff -h display help swapoff -V display version The <special> parameter: {-L label | LABEL=label} LABEL of device to be used {-U uuid | UUID=uuid} UUID of device to be used <device> name of device to be used <file> name of file to be used [root@hk byrd]# swapoff a swapoff: a: swapoff failed: 没有那个文件或目录 [root@hk byrd]# swapoff /dev/mapper/vg_cloud-lv_swap [root@hk byrd]# lvre lvreduce lvremove lvrename lvresize [root@hk byrd]# lvremove Please enter one or more logical volume paths Run `lvremove --help' for more information. [root@hk byrd]# lvremove --help lvremove: Remove logical volume(s) from the system lvremove [-A|--autobackup y|n] [-d|--debug] [-f|--force] [-h|--help] [--noudevsync] [-t|--test] [-v|--verbose] [--version] LogicalVolume[Path] [LogicalVolume[Path]...] [root@hk byrd]# lvremove /dev/mapper/vg_cloud-lv_swap Do you really want to remove active logical volume lv_swap? [y/n]: y Logical volume "lv_swap" successfully removed [root@hk byrd]# vgdisplay --- Volume group --- VG Name vg_cloud System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 4 VG Access read/write VG Status resizable MAX LV 0 Cur LV 1 Open LV 1 Max PV 0 Cur PV 1 Act PV 1 VG Size 9.51 GiB PE Size 4.00 MiB Total PE 2434 Alloc PE / Size 1930 / 7.54 GiB Free PE / Size 504 / 1.97 GiB VG UUID aCGg1q-jFG3-v3qC-1TY0-ELpR-o7o3-jxoZmz [root@hk byrd]# lvextend -L 1.97G /dev/mapper/vg_cloud-lv_root Rounding size to boundary between physical extents: 1.97 GiB New size given (505 extents) not larger than existing size (1930 extents) Run `lvextend --help' for more information. [root@hk byrd]# lvextend -L 2G /dev/mapper/vg_cloud-lv_root New size given (512 extents) not larger than existing size (1930 extents) Run `lvextend --help' for more information. [root@hk byrd]# lvextend --help lvextend: Add space to a logical volume lvextend [-A|--autobackup y|n] [--alloc AllocationPolicy] [-d|--debug] [-f|--force] [-h|--help] [-i|--stripes Stripes [-I|--stripesize StripeSize]] {-l|--extents [+]LogicalExtentsNumber[%{VG|LV|PVS|FREE|ORIGIN}] | -L|--size [+]LogicalVolumeSize[bBsSkKmMgGtTpPeE]} [-m|--mirrors Mirrors] [--nosync] [--use-policies] [-n|--nofsck] [--noudevsync] [-r|--resizefs] [-t|--test] [--type VolumeType] [-v|--verbose] [--version] LogicalVolume[Path] [ PhysicalVolumePath... ] [root@hk byrd]# lvextend -L +100%FREE /dev/mapper/vg_cloud-lv_root Invalid argument for --size: +100%FREE Error during parsing of command line. [root@hk byrd]# lvextend -l +100%FREE /dev/mapper/vg_cloud-lv_root Extending logical volume lv_root to 9.51 GiB Logical volume lv_root successfully resized [root@hk byrd]# lvdisplay --- Logical volume --- LV Path /dev/vg_cloud/lv_root LV Name lv_root VG Name vg_cloud LV UUID KIAvQH-uqD9-CjNo-lyjd-Znq4-xyZf-9UBjF7 LV Write Access read/write LV Creation host, time cloud, 2013-04-08 00:56:35 +0800 LV Status available # open 1 LV Size 9.51 GiB Current LE 2434 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0 [root@hk byrd]# vgdisplay --- Volume group --- VG Name vg_cloud System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 5 VG Access read/write VG Status resizable MAX LV 0 Cur LV 1 Open LV 1 Max PV 0 Cur PV 1 Act PV 1 VG Size 9.51 GiB PE Size 4.00 MiB Total PE 2434 Alloc PE / Size 2434 / 9.51 GiB Free PE / Size 0 / 0 VG UUID aCGg1q-jFG3-v3qC-1TY0-ELpR-o7o3-jxoZmz [root@hk byrd]# df -h 文件系统 容量 已用 可用 已用%% 挂载点 /dev/mapper/vg_cloud-lv_root 7.5G 3.5G 3.7G 49% / tmpfs 249M 0 249M 0% /dev/shm /dev/sda1 485M 32M 428M 7% /boot [root@hk byrd]# resize2fs /dev/mapper/vg_cloud-lv_root resize2fs 1.41.12 (17-May-2010) Filesystem at /dev/mapper/vg_cloud-lv_root is mounted on /; on-line resizing required old desc_blocks = 1, new_desc_blocks = 1 Performing an on-line resize of /dev/mapper/vg_cloud-lv_root to 2492416 (4k) blocks. The filesystem on /dev/mapper/vg_cloud-lv_root is now 2492416 blocks long. [root@hk byrd]# df -h 文件系统 容量 已用 可用 已用%% 挂载点 /dev/mapper/vg_cloud-lv_root 9.4G 3.5G 5.5G 39% / tmpfs 249M 0 249M 0% /dev/shm /dev/sda1 485M 32M 428M 7% /boot [root@hk byrd]# fdisk -l Disk /dev/sda: 10.7 GB, 10737418240 bytes 255 heads, 63 sectors/track, 1305 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00073ffb Device Boot Start End Blocks Id System /dev/sda1 * 1 64 512000 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 64 1306 9972736 8e Linux LVM Disk /dev/sdb: 16.1 GB, 16106127360 bytes 255 heads, 63 sectors/track, 1958 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xcbc85cc2 Device Boot Start End Blocks Id System /dev/sdb1 1 132 1060258+ 8e Linux LVM /dev/sdb2 133 1047 7349737+ 8e Linux LVM /dev/sdb3 1048 1958 7317607+ 8e Linux LVM Disk /dev/mapper/vg_cloud-lv_root: 10.2 GB, 10208935936 bytes 255 heads, 63 sectors/track, 1241 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 [root@hk byrd]# fdisk /dev/sdb WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): m^Hq^C [root@hk byrd]# gfdisk /dev/sdb bash: gfdisk: command not found [root@hk byrd]# cfdisk /dev/sdb Disk has been changed. WARNING: If you have created or modified any DOS 6.x partitions, please see the cfdisk manual page for additional information. [root@hk byrd]# fdisk -l Disk /dev/sda: 10.7 GB, 10737418240 bytes 255 heads, 63 sectors/track, 1305 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00073ffb Device Boot Start End Blocks Id System /dev/sda1 * 1 64 512000 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 64 1306 9972736 8e Linux LVM Disk /dev/sdb: 16.1 GB, 16106127360 bytes 255 heads, 63 sectors/track, 1958 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xcbc85cc2 Device Boot Start End Blocks Id System /dev/sdb1 * 1 1959 15728608+ 8e Linux LVM Disk /dev/mapper/vg_cloud-lv_root: 10.2 GB, 10208935936 bytes 255 heads, 63 sectors/track, 1241 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 [root@hk byrd]# pvcreate /dev/sdb1 WARNING: swap signature detected on /dev/sdb1. Wipe it? [y/n] y Wiping swap signature on /dev/sdb1. Physical volume "/dev/sdb1" successfully created [root@hk byrd]# pvdisplay --- Physical volume --- PV Name /dev/sda2 VG Name vg_cloud PV Size 9.51 GiB / not usable 3.00 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 2434 Free PE 0 Allocated PE 2434 PV UUID dtK0fn-wMNW-wB8L-ueXq-H3Ad-cek9-5wCgac "/dev/sdb1" is a new physical volume of "15.00 GiB" --- NEW Physical volume --- PV Name /dev/sdb1 VG Name PV Size 15.00 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID rb1M7k-g0HW-lHpb-rCbx-Uz5b-tXOn-2JEx52 [root@hk byrd]# vgdisplay --- Volume group --- VG Name vg_cloud System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 5 VG Access read/write VG Status resizable MAX LV 0 Cur LV 1 Open LV 1 Max PV 0 Cur PV 1 Act PV 1 VG Size 9.51 GiB PE Size 4.00 MiB Total PE 2434 Alloc PE / Size 2434 / 9.51 GiB Free PE / Size 0 / 0 VG UUID aCGg1q-jFG3-v3qC-1TY0-ELpR-o7o3-jxoZmz [root@hk byrd]# vgextend vg_cloud /dev/sdb1 Volume group "vg_cloud" successfully extended [root@hk byrd]# vgdisplay --- Volume group --- VG Name vg_cloud System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 6 VG Access read/write VG Status resizable MAX LV 0 Cur LV 1 Open LV 1 Max PV 0 Cur PV 2 Act PV 2 VG Size 24.50 GiB PE Size 4.00 MiB Total PE 6273 Alloc PE / Size 2434 / 9.51 GiB Free PE / Size 3839 / 15.00 GiB VG UUID aCGg1q-jFG3-v3qC-1TY0-ELpR-o7o3-jxoZmz [root@hk byrd]# lvdisplay --- Logical volume --- LV Path /dev/vg_cloud/lv_root LV Name lv_root VG Name vg_cloud LV UUID KIAvQH-uqD9-CjNo-lyjd-Znq4-xyZf-9UBjF7 LV Write Access read/write LV Creation host, time cloud, 2013-04-08 00:56:35 +0800 LV Status available # open 1 LV Size 9.51 GiB Current LE 2434 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0 [root@hk byrd]# lvextend -l +14G /dev/mapper/vg_cloud-lv_root Invalid argument for --extents: +14G Error during parsing of command line. [root@hk byrd]# lvextend x--help Please specify either size or extents but not both. Run `lvextend --help' for more information. [root@hk byrd]# lvextend --help lvextend: Add space to a logical volume lvextend [-A|--autobackup y|n] [--alloc AllocationPolicy] [-d|--debug] [-f|--force] [-h|--help] [-i|--stripes Stripes [-I|--stripesize StripeSize]] {-l|--extents [+]LogicalExtentsNumber[%{VG|LV|PVS|FREE|ORIGIN}] | -L|--size [+]LogicalVolumeSize[bBsSkKmMgGtTpPeE]} [-m|--mirrors Mirrors] [--nosync] [--use-policies] [-n|--nofsck] [--noudevsync] [-r|--resizefs] [-t|--test] [--type VolumeType] [-v|--verbose] [--version] LogicalVolume[Path] [ PhysicalVolumePath... ] [root@hk byrd]# lvextend -L 14G /dev/mapper/vg_cloud-lv_root Extending logical volume lv_root to 14.00 GiB Logical volume lv_root successfully resized [root@hk byrd]# lvdisplay --- Logical volume --- LV Path /dev/vg_cloud/lv_root LV Name lv_root VG Name vg_cloud LV UUID KIAvQH-uqD9-CjNo-lyjd-Znq4-xyZf-9UBjF7 LV Write Access read/write LV Creation host, time cloud, 2013-04-08 00:56:35 +0800 LV Status available # open 1 LV Size 14.00 GiB Current LE 3584 Segments 2 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0 [root@hk byrd]# vgdisplay --- Volume group --- VG Name vg_cloud System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 7 VG Access read/write VG Status resizable MAX LV 0 Cur LV 1 Open LV 1 Max PV 0 Cur PV 2 Act PV 2 VG Size 24.50 GiB PE Size 4.00 MiB Total PE 6273 Alloc PE / Size 3584 / 14.00 GiB Free PE / Size 2689 / 10.50 GiB VG UUID aCGg1q-jFG3-v3qC-1TY0-ELpR-o7o3-jxoZmz [root@hk byrd]# lvextend -L 23.5G /dev/mapper/vg_cloud-lv_root Extending logical volume lv_root to 23.50 GiB Logical volume lv_root successfully resized [root@hk byrd]# vgdisplay --- Volume group --- VG Name vg_cloud System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 8 VG Access read/write VG Status resizable MAX LV 0 Cur LV 1 Open LV 1 Max PV 0 Cur PV 2 Act PV 2 VG Size 24.50 GiB PE Size 4.00 MiB Total PE 6273 Alloc PE / Size 6016 / 23.50 GiB Free PE / Size 257 / 1.00 GiB VG UUID aCGg1q-jFG3-v3qC-1TY0-ELpR-o7o3-jxoZmz [root@hk byrd]# lvdisplay --- Logical volume --- LV Path /dev/vg_cloud/lv_root LV Name lv_root VG Name vg_cloud LV UUID KIAvQH-uqD9-CjNo-lyjd-Znq4-xyZf-9UBjF7 LV Write Access read/write LV Creation host, time cloud, 2013-04-08 00:56:35 +0800 LV Status available # open 1 LV Size 23.50 GiB Current LE 6016 Segments 2 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0 [root@hk byrd]# lvcreate --help lvcreate: Create a logical volume lvcreate [-A|--autobackup {y|n}] [-a|--activate [a|e|l]{y|n}] [--addtag Tag] [--alloc AllocationPolicy] [-C|--contiguous {y|n}] [-d|--debug] [-h|-?|--help] [--ignoremonitoring] [--monitor {y|n}] [-i|--stripes Stripes [-I|--stripesize StripeSize]] {-l|--extents LogicalExtentsNumber[%{VG|PVS|FREE}] | -L|--size LogicalVolumeSize[bBsSkKmMgGtTpPeE]} [-M|--persistent {y|n}] [--major major] [--minor minor] [-m|--mirrors Mirrors [--nosync] [{--mirrorlog {disk|core|mirrored}|--corelog}]] [-n|--name LogicalVolumeName] [--noudevsync] [-p|--permission {r|rw}] [-r|--readahead ReadAheadSectors|auto|none] [-R|--regionsize MirrorLogRegionSize] [-T|--thin [-c|--chunksize ChunkSize] [--discards {ignore|nopassdown|passdown}] [--poolmetadatasize MetadataSize[bBsSkKmMgG]]] [--thinpool ThinPoolLogicalVolume{Name|Path}] [-t|--test] [--type VolumeType] [-v|--verbose] [-Z|--zero {y|n}] [--version] VolumeGroupName [PhysicalVolumePath...] lvcreate { {-s|--snapshot} OriginalLogicalVolume[Path] | [-s|--snapshot] VolumeGroupName[Path] -V|--virtualsize VirtualSize} {-T|--thin} VolumeGroupName[Path][/PoolLogicalVolume] -V|--virtualsize VirtualSize} [-c|--chunksize] [-A|--autobackup {y|n}] [--addtag Tag] [--alloc AllocationPolicy] [-C|--contiguous {y|n}] [-d|--debug] [--discards {ignore|nopassdown|passdown}] [-h|-?|--help] [--ignoremonitoring] [--monitor {y|n}] [-i|--stripes Stripes [-I|--stripesize StripeSize]] {-l|--extents LogicalExtentsNumber[%{VG|FREE|ORIGIN}] | -L|--size LogicalVolumeSize[bBsSkKmMgGtTpPeE]} [--poolmetadatasize Size[bBsSkKmMgG]] [-M|--persistent {y|n}] [--major major] [--minor minor] [-n|--name LogicalVolumeName] [--noudevsync] [-p|--permission {r|rw}] [-r|--readahead ReadAheadSectors|auto|none] [-t|--test] [--thinpool ThinPoolLogicalVolume[Path]] [-v|--verbose] [--version] [PhysicalVolumePath...] [root@hk byrd]# lvcreate -l +100%FREE -Cy vg_cloud lv_swap Physical Volume "lv_swap" not found in Volume Group "vg_cloud" [root@hk byrd]# lvcreate -l +100%FREE -Cy vg_cloud -n lv_swap Logical volume "lv_swap" created [root@hk byrd]# lvdisplay --- Logical volume --- LV Path /dev/vg_cloud/lv_root LV Name lv_root VG Name vg_cloud LV UUID KIAvQH-uqD9-CjNo-lyjd-Znq4-xyZf-9UBjF7 LV Write Access read/write LV Creation host, time cloud, 2013-04-08 00:56:35 +0800 LV Status available # open 1 LV Size 23.50 GiB Current LE 6016 Segments 2 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0 --- Logical volume --- LV Path /dev/vg_cloud/lv_swap LV Name lv_swap VG Name vg_cloud LV UUID eLmu4B-2g3P-bM90-b0wO-UJyW-LNF1-N3Wl2l LV Write Access read/write LV Creation host, time hk.t4x.org, 2014-05-05 22:44:40 +0800 LV Status available # open 0 LV Size 1.00 GiB Current LE 257 Segments 1 Allocation contiguous Read ahead sectors auto - currently set to 256 Block device 253:1 [root@hk byrd]# vgdisplay --- Volume group --- VG Name vg_cloud System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 9 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 1 Max PV 0 Cur PV 2 Act PV 2 VG Size 24.50 GiB PE Size 4.00 MiB Total PE 6273 Alloc PE / Size 6273 / 24.50 GiB Free PE / Size 0 / 0 VG UUID aCGg1q-jFG3-v3qC-1TY0-ELpR-o7o3-jxoZmz [root@hk byrd]# vim /etc/fstab [root@hk byrd]# swapon /dev/mapper/vg_cloud-lv_swap swapon: /dev/mapper/vg_cloud-lv_swap: read swap header failed: 无效的参数 [root@hk byrd]# mkswap /dev/mapper/vg_cloud-lv_swap mkswap: /dev/mapper/vg_cloud-lv_swap: warning: don't erase bootbits sectors on whole disk. Use -f to force. Setting up swapspace version 1, size = 1052668 KiB no label, UUID=9664825a-ab76-488f-b7f3-fa95159dbaa1 [root@hk byrd]# swapon /dev/mapper/vg_cloud-lv_swap [root@hk byrd]# free -m total used free shared buffers cached Mem: 497 196 301 0 7 126 -/+ buffers/cache: 62 435 Swap: 1027 0 1027 [root@hk byrd]# df -h 文件系统 容量 已用 可用 已用%% 挂载点 /dev/mapper/vg_cloud-lv_root 9.4G 3.5G 5.5G 39% / tmpfs 249M 0 249M 0% /dev/shm /dev/sda1 485M 32M 428M 7% /boot [root@hk byrd]# free -m total used free shared buffers cached Mem: 497 196 301 0 7 126 -/+ buffers/cache: 62 435 Swap: 1027 0 1027 [root@hk byrd]# resize2fs /dev/mapper/vg_cloud-lv_root resize2fs 1.41.12 (17-May-2010) Filesystem at /dev/mapper/vg_cloud-lv_root is mounted on /; on-line resizing required old desc_blocks = 1, new_desc_blocks = 2 Performing an on-line resize of /dev/mapper/vg_cloud-lv_root to 6160384 (4k) blocks. The filesystem on /dev/mapper/vg_cloud-lv_root is now 6160384 blocks long. [root@hk byrd]# df -h\ > ^C [root@hk byrd]# df -h 文件系统 容量 已用 可用 已用%% 挂载点 /dev/mapper/vg_cloud-lv_root 24G 3.5G 19G 16% / tmpfs 249M 0 249M 0% /dev/shm /dev/sda1 485M 32M 428M 7% /boot [root@hk byrd]# free -m total used free shared buffers cached Mem: 497 200 296 0 11 126 -/+ buffers/cache: 62 434 Swap: 1027 0 1027 [root@hk byrd]# watch -n 1 -d date [root@hk byrd]# |
申明:除非注明Byrd's Blog内容均为原创,未经许可禁止转载!详情请阅读版权申明!