Growing FreeBSD's filesystems with growfs(8)
2009-05-13 11:46:18来源:未知 阅读 ()
During installation it is important to size filesystems so that we won't be forced to resize them later. However, it often appears with time that one of the partitions is too small. Until today it was impossible to expand the size of a filesystem. FreeBSD 4.4-RELEASE comes with a new utility: growfs(8). This program permits us to enlarge, in certains conditions, the size of an existing ufs filesystem.
Preparing the fight
Before detailing the operations through one example, there are many things to know:
Playing with filesystems is always a dangerous operation: do it only if it is mandatory and be sure to backup your data.
growfs(8) can only grow - not shrink - filesystems. You would not be able to shrink the filesystem once it has been expanded.
growfs(8) cannot enlarge a filesystem that does not have any free space around it.
We will need to use growfs(8), disklabel(8), fdisk(8) and fsck(8). So print these manual pages and read them. Having a printed version under hand during the process is useful. Remember, in single user mode you can't read manual pages.
To modify filesystems, we'll have to calculate sizes and sector numbers, so if you're bad at mental arithmetic use a calculator.
I did my experiments on a machine running 4.4-PRERELEASE with a 6.4G hard drive.
Here is the partition table of this hard drive:
# fdisk -s
/dev/ad0: 784 cyl 255 hd 63 sec
Part Start Size Type Flags
1: 63 2088387 0x06 0x00
2: 2088450 2859570 0xa5 0x80
3: 4948020 7646940 0xa5 0x00
As we can see, first slice is a msdos filesystem (type 0x06) and the others are FreeBSD filesystem (type 0xa5). The 4.4-PRERELEASE is on the second one; on the last, there's an old 3.5-STABLE system. I don't need the latter, so I will remove it and use the free space to enlarge the second slice.
If I call fdisk(8) with no arguments, it prints the following:
******* Working on device /dev/ad0 *******
parameters extracted from in-core disklabel are:
cylinders=784 heads=255 sectors/track=63 (16065 blks/cyl)
parameters to be used for BIOS calculations are:
cylinders=784 heads=255 sectors/track=63 (16065 blks/cyl)
Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 6,(Primary 'big' DOS (> 32MB))
start 63, size 2088387 (1019 Meg), flag 0
beg: cyl 0/ head 1/ sector 1;
end: cyl 129/ head 254/ sector 63
The data for partition 2 is:
sysid 165,(FreeBSD/NetBSD/386BSD)
start 2088450, size 2859570 (1396 Meg), flag 80 (active)
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
- Freebsd oracle 10g 2009-05-13
- KDE/FreeBSD 测试 QT-4.5.1. 2009-05-13
- OpenBSD 4.5下安装Gnome 2.24成功! 2009-05-13
- OpenBSD 4.5 2009-05-13
- DragonFly BSD 2.2.1发布 2009-05-13
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash