博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Linux 空闲空间的格式化与加载
阅读量:4959 次
发布时间:2019-06-12

本文共 4601 字,大约阅读时间需要 15 分钟。

本人有块SCSI硬盘,安装Linux AS4 时没有分区,安装好了系统后想把这块空闲分区使用上,以下是详细的操作步骤

一、使用linux as4的硬件查看工具查看未使用的硬盘空间。

2011042215424079.jpg

二、使用fdisk对空闲分区分区。

[root@guohuilinuxas31 root]# fdisk /dev/sda

The number of cylinders for this disk is set to 5221.

There is nothing wrong with that, but this is larger than 1024,

and could in certain setups cause problems with:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs

   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sda: 42.9 GB, 42949672960 bytes

255 heads, 63 sectors/track, 5221 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   Id  System

/dev/sda1   *         1        13    104391   83  Linux

/dev/sda2            14      2356  18820147+  83  Linux

/dev/sda3          2357      2610   2040255   82  Linux swap

Command (m for help): n

Command action

   e   extended

   p   primary partition (1-4)

e

Selected partition 4

First cylinder (2611-5221, default 2611):

[root@guohuilinuxas31 root]# fdisk /dev/sda

The number of cylinders for this disk is set to 5221.

There is nothing wrong with that, but this is larger than 1024,

and could in certain setups cause problems with:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs

   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): n

Command action

   e   extended

   p   primary partition (1-4)

p

Selected partition 4

First cylinder (2611-5221, default 2611): 2611

Last cylinder or +size or +sizeM or +sizeK (2611-5221, default 5221): 5221

Command (m for help): p

Disk /dev/sda: 42.9 GB, 42949672960 bytes

255 heads, 63 sectors/track, 5221 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   Id  System

/dev/sda1   *         1        13    104391   83  Linux

/dev/sda2            14      2356  18820147+  83  Linux

/dev/sda3          2357      2610   2040255   82  Linux swap

/dev/sda4          2611      5221  20972857+  83  Linux

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: Device or resource busy.

The kernel still uses the old table.

The new table will be used at the next reboot.

Syncing disks.

三、重启系统

#reboot

再次查看空间,可以看到free的空间变成了linux的文件格式。

2011042215450428.jpg

设备号 sda4,没有文件系统。

四、格式化新分配的空间。

[root@guohuilinuxas31 root]# id

uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)

[root@guohuilinuxas31 root]# mkfs -t ext3 /dev/sda4

mke2fs 1.32 (09-Nov-2002)

warning: 334 blocks unused.

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

2626560 inodes, 5242880 blocks

262160 blocks (5.00%) reserved for the super user

First data block=0

160 block groups

32768 blocks per group, 32768 fragments per group

16416 inodes per group

Superblock backups stored on blocks:

        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

        4096000

Writing inode tables: done                           

Creating journal (8192 blocks): done

Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 20 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.

[root@guohuilinuxas31 root]# fdisk -l

Disk /dev/sda: 42.9 GB, 42949672960 bytes

255 heads, 63 sectors/track, 5221 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   Id  System

/dev/sda1   *         1        13    104391   83  Linux

/dev/sda2            14      2356  18820147+  83  Linux

/dev/sda3          2357      2610   2040255   82  Linux swap

/dev/sda4          2611      5221  20972857+  83  Linux

可以看到空闲空间为sda4。

2011042215472242.jpg

五、加载文件系统

[root@guohuilinuxas31 etc]# mount /dev/sda4 /vmware1

[root@guohuilinuxas31 etc]# du -csh /vmware1

20K     /vmware1

20K     total

[root@guohuilinuxas31 etc]# mount

/dev/sda2 on / type ext3 (rw)

none on /proc type proc (rw)

none on /dev/pts type devpts (rw,gid=5,mode=620)

usbdevfs on /proc/bus/usb type usbdevfs (rw)

/dev/sda1 on /boot type ext3 (rw)

none on /dev/shm type tmpfs (rw)

/dev/sda4 on /vmware1 type ext3 (rw)

[root@guohuilinuxas31 etc]# df -k

Filesystem           1K-blocks      Used Available Use% Mounted on

/dev/sda2             18524524   9287492   8296028  53% /

/dev/sda1               101089     15126     80744  16% /boot

none                   1293016         0   1293016   0% /dev/shm

/dev/sda4             20641788     32828  19560320   1% /vmware1

六、自动加载文件系统

[oracle@guohuilinuxas31 etc]$ cat fstab

LABEL=/                 /                       ext3    defaults        1 1

LABEL=/boot             /boot                   ext3    defaults        1 2

/dev/sda4               /vmware1                ext3    defaults        1 3

none                    /dev/pts                devpts  gid=5,mode=620  0 0

none                    /proc                   proc    defaults        0 0

none                    /dev/shm                tmpfs   defaults        0 0

/dev/sda3               swap                    swap    defaults        0 0

/dev/cdrom              /mnt/cdrom              udf,iso9660 noauto,owner,kudzu,ro 0 0

/dev/fd0                /mnt/floppy             auto    noauto,owner,kudzu 0 0

转载于:https://www.cnblogs.com/kelantas/archive/2011/04/22/2024623.html

你可能感兴趣的文章
mysq找不到pid无法正常启动
查看>>
php实现抓取网站百度快照和百度收录数量的代码实例
查看>>
Qt那点事儿(三) 论父对象与子对象的关系
查看>>
jar 命令 打包装class文件的文件夹
查看>>
node.js express配置允许跨域
查看>>
JSP EL表达式详细介绍(转)
查看>>
要想找出正好包含5个字符的名字
查看>>
用js把图片做的富有动态感,并对以后需要用着的属性进行封装
查看>>
ArcGIS Runtime For Android 100.3天地图不加载问题
查看>>
线性表
查看>>
【转】解决eclipse新导入工程无法run as server
查看>>
【转】struts1.2的action参数配置
查看>>
快速幂&快速乘
查看>>
WebLogic 12c 多节点Cluster静默安装
查看>>
win8中如何禁用屏幕旋转的快捷键
查看>>
Solution 23: 判断矩形和圆是否相交
查看>>
Qt And MFC Mouse Over Tips
查看>>
JSP/Servlet 中的汉字编码问题
查看>>
《构建之法》(十)
查看>>
django之信号
查看>>