Linux拓展硬盘
0x00原因
犹豫昨天import了一个1.7G的数据库 导致硬盘不够用 开机时输入完密码后无法进入图形界面
显示错误
Ubuntu-The configuration defaults for GNOME Power Manager have not been installed correctly
0x01Vmware 给虚拟机加硬盘
这个在设备比较好加
加完后 启动机器
[root@linux5 oracle]#su root
[root@linux5 oracle]# fdisk -l
Disk /dev/sda: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 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: 0x00038d6a
Device Boot Start End Blocks Id System
/dev/sda1 * 1 39 307200 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 39 2093 16501760 83 Linux
/dev/sda3 2093 2611 4161536 82 Linux swap / Solaris
0x02 新建分区
[root@linux5 oracle]# fdisk -cu /dev/sda
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Selected partition 4
First sector (41943040-104857599, default 41943040):
Using default value 41943040
Last sector, +sectors or +size{K,M,G} (41943040-104857599, default 104857599):
Using default value 104857599
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
这里报了个警告 说资源在忙
查看新建结果
[root@linux5 oracle]# fdisk -l
Disk /dev/sda: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 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: 0x00038d6a
Device Boot Start End Blocks Id System
/dev/sda1 * 1 39 307200 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 39 2093 16501760 83 Linux
/dev/sda3 2093 2611 4161536 82 Linux swap / Solaris
/dev/sda4 2611 6528 31457280 83 Linux
Partition 4 does not end on cylinder boundary.
这里最后报了个 分区4没有结束范围…刚的新建分区应该是有问题
0x03 格式化新建分区
查了一下以前的文件类型
[root@linux5 oracle]# more /etc/fstab
#
# /etc/fstab
# Created by anaconda on Mon Mar 30 09:13:27 2015
#
# 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=18d82504-c890-43d2-9b7c-771f22e8f762 / ext4 defaults
1 1
UUID=8b4ddae2-a584-4a7f-a9aa-9633b32b4816 /boot ext4 defaults
1 2
UUID=2de40b84-00b1-4507-9d59-a4041ec0a903 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
恩 以前的是ext4的 开始格式化新建磁盘分区
[root@linux5 oracle]# mkfs -t ext4 /dev/sda4
mke2fs 1.41.12 (17-May-2010)
文件系统标签=
操作系统:Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1966080 inodes, 7864320 blocks
393216 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=0
240 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, 1605632, 2654208,
4096000
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
好了格式化完毕
挂载硬盘
查询UUID
[root@linux5 oracle]# blkid /dev/sda4
/dev/sda4: UUID="b6705f46-548a-4eeb-bc85-92e3550599f3" TYPE="ext4"
然后就编辑/etc/fstab
在里面加入
UUID=b6705f46-548a-4eeb-bc85-92e3550599f3 /oracle ext4 defaults 1 2
第五列:指明是否要备份,(0为不备份,1为要备份,一般根分区要备份)
第六列:指明自检顺序。 (0为不自检,1或者2为要自检,如果是根分区要设为1,其他分区只能是2)
/etc/fstab
参数说明http://hndtraveller.blog.51cto.com/231121/186777
ok 我现在主要问题是Oracle太大 但是直接把/oracle挂载在 /dev/sdb4上
#实时把/dev/sda4 挂载 /oracle里
mount /dev/sda4 /oracle
#/帮oracle先改名
mv /oracle /oracle.bk
#创建空的/oracle
mkdir /oracle
#更改为原来权限
chown oracle:oinstall /oracle
#移动数据
mv /oracle.bk/* /oracle
#去除备份数据库目录
rmdir /oracle.bk
再df -h
[root@linux5 oracle]# df -h
文件系统 容量 已用 可用 已用%% 挂载点
/dev/sda2 16G 15G 0 100% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/sda1 291M 34M 243M 12% /boot
.host:/ 373G 283G 91G 76% /mnt/hgfs /dev/sda4 30G 172M 28G 1% /oracle
ok 勉强成功
参考资料
其实这个方法要更简便 差不多 用tar来代码我的mv