标签:des blog http 使用 os io strong 文件
安装 Lab平台,CDH5安装失败, 查看/var/log/ 发现/usr目录太小。
[root@master usr]# cat /var/log/cloudera-manager-installer/3.install-cloudera-manager-server.log Transaction Check Error: installing package cloudera-manager-daemons-5.1.1-1.cm511.p0.82.el6.x86_64 needs 436MB on the /usr filesystem installing package cloudera-manager-server-5.1.1-1.cm511.p0.82.el6.x86_64 needs 436MB on the /usr filesystem Error Summary ------------- Disk Requirements: At least 436MB more space needed on the /usr filesystem. [root@master usr]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda3 5039616 368840 4414776 8% / tmpfs 957244 0 957244 0% /dev/shm /dev/sda1 148742 34081 106981 25% /boot /dev/sda2 9576252 1241932 7847872 14% /home /dev/sda8 805292 23976 740408 4% /tmp /dev/sda5 3023760 2764008 106152 97% /usr /dev/sda7 1007896 636188 320508 67% /var
新加一块5G空间虚拟硬盘,重启,切换到root模式,看到sdb
[root@master usr]# fdisk -l Disk /dev/sda: 21.5 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 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: 0x000a7059 Device Boot Start End Blocks Id System /dev/sda1 * 1 20 153600 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 20 1231 9729024 83 Linux /dev/sda3 1231 1868 5120000 83 Linux /dev/sda4 1868 2611 5967872 5 Extended /dev/sda5 1869 2251 3072000 83 Linux /dev/sda6 2251 2382 1048576 82 Linux swap / Solaris /dev/sda7 2382 2509 1024000 83 Linux /dev/sda8 2509 2611 818176 83 Linux Disk /dev/sdb: 5368 MB, 5368709120 bytes 255 heads, 63 sectors/track, 652 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
分区,完了用fdisk –l能看到
[root@master usr]# fdisk /dev/sdb Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0x2fa47673. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won‘t be recoverable. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) 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 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): l 0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris 1 FAT12 39 Plan 9 82 Linux swap / So c1 DRDOS/sec (FAT- 2 XENIX root 3c PartitionMagic 83 Linux c4 DRDOS/sec (FAT- 3 XENIX usr 40 Venix 80286 84 OS/2 hidden C: c6 DRDOS/sec (FAT- 4 FAT16 <32M 41 PPC PReP Boot 85 Linux extended c7 Syrinx 5 Extended 42 SFS 86 NTFS volume set da Non-FS data 6 FAT16 4d QNX4.x 87 NTFS volume set db CP/M / CTOS / . 7 HPFS/NTFS 4e QNX4.x 2nd part 88 Linux plaintext de Dell Utility 8 AIX 4f QNX4.x 3rd part 8e Linux LVM df BootIt 9 AIX bootable 50 OnTrack DM 93 Amoeba e1 DOS access a OS/2 Boot Manag 51 OnTrack DM6 Aux 94 Amoeba BBT e3 DOS R/O b W95 FAT32 52 CP/M 9f BSD/OS e4 SpeedStor c W95 FAT32 (LBA) 53 OnTrack DM6 Aux a0 IBM Thinkpad hi eb BeOS fs e W95 FAT16 (LBA) 54 OnTrackDM6 a5 FreeBSD ee GPT f W95 Ext‘d (LBA) 55 EZ-Drive a6 OpenBSD ef EFI (FAT-12/16/ 10 OPUS 56 Golden Bow a7 NeXTSTEP f0 Linux/PA-RISC b 11 Hidden FAT12 5c Priam Edisk a8 Darwin UFS f1 SpeedStor 12 Compaq diagnost 61 SpeedStor a9 NetBSD f4 SpeedStor 14 Hidden FAT16 <3 63 GNU HURD or Sys ab Darwin boot f2 DOS secondary 16 Hidden FAT16 64 Novell Netware af HFS / HFS+ fb VMware VMFS 17 Hidden HPFS/NTF 65 Novell Netware b7 BSDI fs fc VMware VMKCORE 18 AST SmartSleep 70 DiskSecure Mult b8 BSDI swap fd Linux raid auto 1b Hidden W95 FAT3 75 PC/IX bb Boot Wizard hid fe LANstep 1c Hidden W95 FAT3 80 Old Minix be Solaris boot ff BBT 1e Hidden W95 FAT1 Command (m for help): p Disk /dev/sdb: 5368 MB, 5368709120 bytes 255 heads, 63 sectors/track, 652 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: 0x2fa47673 Device Boot Start End Blocks Id System Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-652, default 1): 1 Last cylinder, +cylinders or +size{K,M,G} (1-652, default 652): Using default value 652 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
[root@master usr]# fdisk -l Disk /dev/sda: 21.5 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 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: 0x000a7059 Device Boot Start End Blocks Id System /dev/sda1 * 1 20 153600 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 20 1231 9729024 83 Linux /dev/sda3 1231 1868 5120000 83 Linux /dev/sda4 1868 2611 5967872 5 Extended /dev/sda5 1869 2251 3072000 83 Linux /dev/sda6 2251 2382 1048576 82 Linux swap / Solaris /dev/sda7 2382 2509 1024000 83 Linux /dev/sda8 2509 2611 818176 83 Linux Disk /dev/sdb: 5368 MB, 5368709120 bytes 255 heads, 63 sectors/track, 652 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: 0x2fa47673 Device Boot Start End Blocks Id System /dev/sdb1 1 652 5237158+ 83
Linux指定新分区的文件系统格式,如下先查看现有的格式,发现为ext4
[root@master usr]# df -T Filesystem Type 1K-blocks Used Available Use% Mounted on /dev/sda3 ext4 5039616 368840 4414776 8% / tmpfs tmpfs 957244 0 957244 0% /dev/shm /dev/sda1 ext4 148742 34081 106981 25% /boot /dev/sda2 ext4 9576252 1241932 7847872 14% /home /dev/sda8 ext4 805292 23976 740408 4% /tmp /dev/sda5 ext4 3023760 2764008 106152 97% /usr /dev/sda7 ext4 1007896 636188 320508 67% /var
将sdb1指定为ext4 , 激活后挂载到/usr01下
[root@master usr]# mkfs -t ext4 -c /dev/sdb1 mke2fs 1.41.12 (17-May-2010) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 327680 inodes, 1309289 blocks 65464 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=1342177280 40 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736 Checking for bad blocks (read-only test): done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 33 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override
root@master /]# mkdir usr01 [root@master /]# mount /dev/sdb1 usr01/
这里要注意,想直接把sdb1挂到/usr上是有问题的,两个分区挂到同一个分区,第一个挂的那个不是被覆盖,而是被暂时隐藏。比如:你先挂的mount /dev/sda1 /mnt,又挂的mount /dev/sda2 /mnt,那/dev/sda1内的就暂时被隐藏,你只要umount /dev/sda2,把第二个分区卸载了,在cd /mnt就可以看到挂的第一个分区的内容了。
回想一下linux系统原理,我们需要保留/usr下所有目录和文件的属主、权限控制属性的一致性。 我们可以使用tar工具迁移文件,保留属性
[root@master usr]# tar cf - * | (cd /usr01; tar xf -)
查看fstab挂载情况
[root@master /]# vim /etc/fstab # # /etc/fstab # Created by anaconda on Fri Aug 8 05:10:00 2014 # # 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 # UUID=760bd24e-350c-4489-a3e9-69948ead3d82 / ext4 defaults 1 1 UUID=b363625e-b2ba-4ea2-9f11-8a3c2efe5d01 /boot ext4 defaults 1 2 UUID=d0577fdd-a790-4b1c-adea-ab1f5ba9b72e /home ext4 defaults 1 2 UUID=8fde3afa-1354-4a25-ad21-f43ede6190f5 /tmp ext4 defaults 1 2 UUID=a7078f4d-e6ce-4c9b-9e93-4c38bb7b467c /usr ext4 defaults 1 2 UUID=643653b4-55c8-411a-bfff-2f52d20a5932 /var ext4 defaults 1 2 UUID=a1233f39-05ab-4bed-a643-c0cbeb146951 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
查看UUID列表
[root@master /]# blkid /dev/sda7: UUID="643653b4-55c8-411a-bfff-2f52d20a5932" TYPE="ext4" /dev/sda1: UUID="b363625e-b2ba-4ea2-9f11-8a3c2efe5d01" TYPE="ext4" /dev/sda2: UUID="d0577fdd-a790-4b1c-adea-ab1f5ba9b72e" TYPE="ext4" /dev/sda3: UUID="760bd24e-350c-4489-a3e9-69948ead3d82" TYPE="ext4" /dev/sda5: UUID="a7078f4d-e6ce-4c9b-9e93-4c38bb7b467c" TYPE="ext4" /dev/sda6: UUID="a1233f39-05ab-4bed-a643-c0cbeb146951" TYPE="swap" /dev/sda8: UUID="8fde3afa-1354-4a25-ad21-f43ede6190f5" TYPE="ext4" /dev/sdb1: UUID="7898228a-1eda-42b2-b3cc-7807d9c65cb4" TYPE="ext4"
可以把/sdb1 修改给/usr 重启
即UUID=a7078f4d-e6ce-4c9b-9e93-4c38bb7b467c /usr ext4 defaults 1 2
替换为UUID=7898228a-1eda-42b2-b3cc-7807d9c65cb4 /usr ext4 defaults 1 2
结果如下:
[hadoop@master ~]$ df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda3 5039616 368848 4414768 8% / tmpfs 957244 0 957244 0% /dev/shm /dev/sda1 148742 34081 106981 25% /boot /dev/sda2 9576252 1241932 7847872 14% /home /dev/sda8 805292 23976 740408 4% /tmp /dev/sdb1 5154852 2835252 2057744 58% /usr /dev/sda7 1007896 636508 320188 67%
关于消失的/dev/sda5: 此时它的数据都存在,如果想废旧利用,例如我这里可以分配给/home/tmp
[root@master home]# vim /etc/fstab # # /etc/fstab # Created by anaconda on Fri Aug 8 05:10:00 2014 # # 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 # UUID=760bd24e-350c-4489-a3e9-69948ead3d82 / ext4 defaults 1 1 UUID=b363625e-b2ba-4ea2-9f11-8a3c2efe5d01 /boot ext4 defaults 1 2 UUID=d0577fdd-a790-4b1c-adea-ab1f5ba9b72e /home ext4 defaults 1 2 UUID=8fde3afa-1354-4a25-ad21-f43ede6190f5 /tmp ext4 defaults 1 2 UUID=7898228a-1eda-42b2-b3cc-7807d9c65cb4 /usr ext4 defaults 1 2 UUID=643653b4-55c8-411a-bfff-2f52d20a5932 /var ext4 defaults 1 2 UUID=a7078f4d-e6ce-4c9b-9e93-4c38bb7b467c /home/tmp ext4 defaults 1 2 UUID=a1233f39-05ab-4bed-a643-c0cbeb146951 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
这样就完成/usr目录的扩容了,当然还有很多种方法。 例如通过livecd启动 比较保险的情况下可以cp -P 保留属性
本文出自 “学习小组” 博客,请务必保留此出处http://ciscolang.blog.51cto.com/8976580/1542280
Linux日常case: /usr 目录扩容,布布扣,bubuko.com
标签:des blog http 使用 os io strong 文件
原文地址:http://ciscolang.blog.51cto.com/8976580/1542280