0)
Make sure that you first read the entire procedure before even starting
I've tried to make this as descriptive as possible, but your specific setup might be different
You will need to be able to use some basic *NIX commands
Don't blame me if something goes wrong, but do report back to me if you feel that something is missing
Make sure that you verify the device id's and partition table entries, your setup might vary slightly, which means that the commands will be slightly different as well
00 ) Physical setup
--- For VMWare, simply grow the virtual disk in the vmware configuration:

- VMware-Resize1.jpg (67.33 KiB) Viewed 12486 times

- VMware-Resize2.jpg (68.97 KiB) Viewed 12486 times
-- For other systems, just get a bigger memory card/stick, configure meteohub on the smaller stick, and then grow
Start of the procedure
1) Disable meteohub auto startup
Code: Select all
mv /etc/rc2.d/S20loggerd /etc/rc2.d/s20loggerd
mv /etc/rc2.d/S20meteonetd /etc/rc2.d/s20meteonetd
mv /etc/rc2.d/S20thttpd /etc/rc2.d/s20thttpd
mv /etc/rc2.d/S89cron /etc/rc2.d/s89cron
mv /etc/rc2.d/S10sysklogd /etc/rc2.d/s10sysklogd
mv /etc/rc2.d/S23ntp /etc/rc2.d/s23ntp
mv /etc/rc2.d/S20samba /etc/rc2.d/s20samba
2) reboot meteohub
3) Check if /data is not used anymore:
result -> no process id listed
4) Verify where /data is located:
Code: Select all
mount |grep data
/dev/hda3 on /data type ext3 (rw,noatime)
5) Assuming there are no process id returned, you can unmount /data
6)Verify data is unmounted
result -> /data is NOT displayed
7) Check the current partition table:
Code: Select all
meteohub:/# fdisk -l
Disk /dev/hda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 1 122 979933+ 83 Linux
/dev/hda2 123 146 192780 82 Linux swap / Solaris
/dev/hda3 147 522 3020220 83 Linux
As you can see the total disksize is 1044 cylinders (approx 8GB) and we are only using 1 - 522
Also, in step 4 we've learned that /data is using /dev/hda3
Since /dev/hda3 ends on cylinder 522 we can grow it to cylinder 1044
8 ) Let's do a sanity check on the /data filesystem
Code: Select all
meteohub:/# fsck -n /dev/hda3
fsck 1.40-WIP (14-Nov-2006)
e2fsck 1.40-WIP (14-Nov-2006)
data: clean, 40/377856 files, 30066/755055 blocks
9) As far as I know we can't grow an ext3 filesystem, so we need to convert to ext2 (and later convert back)
This command effectively removes the journal and makes it a ext2 fileystem
Code: Select all
meteohub:/# tune2fs -O ^has_journal /dev/hda3
tune2fs 1.40-WIP (14-Nov-2006)
10)
Make sure you have a backup, until now nothing has really changed - point of no return
11) 1st we are going to change the partition table and grow the partition that /data lives in to the max
11a) start fdisk in interactive mode
Code: Select all
meteohub:/# fdisk /dev/hda
The number of cylinders for this disk is set to 1044.
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)
11b) Print the current partition table
Code: Select all
Command (m for help): p
Disk /dev/hda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 1 122 979933+ 83 Linux
/dev/hda2 123 146 192780 82 Linux swap / Solaris
/dev/hda3 147 522 3020220 83 Linux
11c) Delete the /dev/hda3 (see step 4) partition entry (this does NOT delete your data)
Code: Select all
Command (m for help): d
Partition number (1-4): 3
11d) Verify that it is gone
Code: Select all
Command (m for help): p
Disk /dev/hda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 1 122 979933+ 83 Linux
/dev/hda2 123 146 192780 82 Linux swap / Solaris
11e) Now add the parttion again with "n"
Code: Select all
Command (m for help): n
Command action
e extended
p primary partition (1-4)
11f) This is a primary partition, select "p"
11g) And we were using 3, so let's choose that again "3'
11h) Accept the defaults, fdisk will automatically choose the 1st available Cylinder and grow to the last
Code: Select all
First cylinder (147-1044, default 147):
Using default value 147
Last cylinder or +size or +sizeM or +sizeK (147-1044, default 1044):
Using default value 1044
11i) And verify our work
Code: Select all
Command (m for help): p
Disk /dev/hda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 1 122 979933+ 83 Linux
/dev/hda2 123 146 192780 82 Linux swap / Solaris
/dev/hda3 147 1044 7213185 83 Linux
Command (m for help):
11j) All looks good, and our new partition is now 7213185 blocks (~7GB), so let's write the partition table "w"
Code: Select all
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.
11k) The kernel is still using the old partition table, this is normal, you can't just change stuff on the fly
12) Make sure that /data is not mounted during the reboot:
I use vi, but you can use another editor if you want:
and change:
/dev/hda3 /data ext3 noatime 0 2
into
# /dev/hda3 /data ext3 noatime 0 2
13) Reboot Meteohub and get the new partition table activated
14) Check that /data is NOT mounted
Result -> /data is NOT listed
15) Verify our new partition table
Code: Select all
meteohub:~# fdisk -l /dev/hda
Disk /dev/hda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 1 122 979933+ 83 Linux
/dev/hda2 123 146 192780 82 Linux swap / Solaris
/dev/hda3 147 1044 7213185 83 Linux
16) Conduct a forced filesystem check on our old (small) /data filesystem before we grow it
Code: Select all
meteohub:~# e2fsck -f /dev/hda3
e2fsck 1.40-WIP (14-Nov-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
data: 40/377856 files (2.5% non-contiguous), 13664/755055 blocks
17) Now we are ready to resize, by default linux will use the entire parttion, which will make our command very straightforward:
Code: Select all
meteohub:~# resize2fs /dev/hda3
resize2fs 1.40-WIP (14-Nov-2006)
Resizing the filesystem on /dev/hda3 to 1803296 (4k) blocks.
The filesystem on /dev/hda3 is now 1803296 blocks long.
Don't panic on the size reported, yes it is 4 time smaller when compared with the fdisk output, but remember that fdisk reports 1k and a filesystem is using 4k blocks
18) Let's do a sanity check on our resized filesystem
Code: Select all
meteohub:~# fsck -n /dev/hda3
fsck 1.40-WIP (14-Nov-2006)
e2fsck 1.40-WIP (14-Nov-2006)
data: clean, 40/881664 files, 30030/1803296 blocks
19) And convert it in a ext3 filesystem by adding the journal
Code: Select all
meteohub:~# tune2fs -j /dev/hda3
tune2fs 1.40-WIP (14-Nov-2006)
Creating journal inode: done
This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
20) Check if we can mount the filesystem
21) And check the new size
Code: Select all
meteohub:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda1 942M 509M 386M 57% /
tmpfs 126M 0 126M 0% /lib/init/rw
udev 10M 52K 10M 1% /dev
tmpfs 126M 0 126M 0% /dev/shm
tmpfs 8.0M 0 8.0M 0% /var/lock
tmpfs 16M 36K 16M 1% /var/run
tmpfs 16M 16K 16M 1% /var/log
/dev/hda3 6.8G 138M 6.4G 3% /data
22) Since everything looks well, let's reverse our action step 12 and enable mounting of /data during bootup
I use vi, but you can use another editor if you want:
and change:
# /dev/hda3 /data ext3 noatime 0 2
into
/dev/hda3 /data ext3 noatime 0 2
23) Also re-enable the automatic startup of all system/meteohub processes
Code: Select all
mv /etc/rc2.d/s20loggerd /etc/rc2.d/S20loggerd
mv /etc/rc2.d/s20meteonetd /etc/rc2.d/S20meteonetd
mv /etc/rc2.d/s20thttpd /etc/rc2.d/S20thttpd
mv /etc/rc2.d/s89cron /etc/rc2.d/S89cron
mv /etc/rc2.d/s10sysklogd /etc/rc2.d/S10sysklogd
mv /etc/rc2.d/s23ntp /etc/rc2.d/S23ntp
mv /etc/rc2.d/s20samba /etc/rc2.d/S20samba
24) reboot meteohub
25) Verify the GUI after the reboot