Gentoo Archives: gentoo-user

From: Dirk Heinrichs <ext-dirk.heinrichs@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: Resize /
Date: Mon, 20 Nov 2006 08:22:09
Message-Id: 200611200847.06963.ext-dirk.heinrichs@nokia.com
In Reply to: Re: [gentoo-user] Re: Resize / by Dale
1 Am Freitag, 17. November 2006 23:30 schrieb ext Dale:
2
3 > Somewhat on topic here. How hard is it to do this with no previous
4 > knowledge of how it works? I am constantly running into the same thing
5 > the OP is and having to move things around. Currently I have two 80GB
6 >
7 > drives. Here is my partition scheme at the moment:
8 > > root@smoker / # mount
9 > > /dev/hda6 on / type reiserfs (rw)
10 > > /dev/hda1 on /boot type reiserfs (rw,noatime,notail)
11 > > /dev/hda7 on /home type reiserfs (rw)
12 > > /dev/hda8 on /usr type reiserfs (rw)
13 > > /dev/hda9 on /usr/portage type reiserfs (rw)
14 > > /dev/hda10 on /data type reiserfs (rw)
15 > > root@smoker / #
16 > > root@smoker / # df
17 > > Filesystem 1K-blocks Used Available Use% Mounted on
18 > > /dev/hda6 9765136 1896004 7869132 20% /
19 > > /dev/hda1 146612 45880 100732 32% /boot
20 > > /dev/hda7 9765136 1236144 8528992 13% /home
21 > > /dev/hda8 9765136 4269660 5495476 44% /usr
22 > > /dev/hda9 5859272 3052004 2807268 53% /usr/portage
23 > > /dev/hda10 43762436 10667796 33094640 25% /data
24 > > root@smoker / #
25 >
26 > Just looking to get a better grasp on this since it sounds like
27 > something I need to try.
28
29 OK, here's my proposal: First, decide which volume management system to use
30 (LVM or EVMS). LVM is just one more volume management tool which you would
31 have to learn (beside fdisk, mkfs.*, raid tools, ...), while EVMS does it
32 all, and more. Then, do the real work:
33
34 You mentioned you have two 80G disks, but in the output above I only see one
35 in use. If this is really the case, you could start converting to LVM/EVMS
36 with the second one (assuming you don't use SW RAID, which I have no
37 knowledge of). Emerge LVM or EVMS, depending on your choice, and make sure
38 you have CONFIG_BLK_DEV_DM in your kernel. Then either switch to runlevel 1
39 or use a LiveCD to do the real work.
40
41 1) Create one big partition on the second disk, with type LVM
42 2) Create a volume group from this partition, choose whatever name you like.
43 3) Create logical volumes inside this volume group, one for each partition
44 you have on hda, except /boot and /, create filesystems on them and mount
45 them somewhere. From the values above, you still have /var and /opt inside
46 hda6. Create new LV's for these two also.
47 4) Copy over the data partitionwise, like: cd /home && tar -clf - .|
48 tar -C /mnt/home -xBpvf -
49 5) Change fstab accordingly and check RC_VOLUME_ORDER in /etc/conf.d/rc.
50 6) Rename your old /var and /opt (to /var.save and /opt.save) and recreate
51 them as empty directories (you will mount the new LV's there).
52 7) Since you didn't touch /boot and /, you should now be able to boot with
53 working LVM/EVMS setup. If this is the case, we can now do some changes on
54 hda.
55 8) You will need to boot a LiveCD now, for shrinking hda6 to a reasonable
56 amount (256M).
57 9) Create a (temporary) LV, create a filesystem, mount it somewhere and use
58 tar as above to copy over / to the new filesystem.
59 10) Repartition hda: Delete all partitions except hda1 (/boot). Create 2 new
60 ones, hda2 (/, 256M) and hda3 (rest of the disk, type LVM), make a
61 filesystem on hda2 and mount it.
62 11) Delete the old (renamed) /var.save and /opt.save from the temporary copy
63 of /, then use tar again to copy your / back to hda1.
64 12) Add hda3 to the already existing volume group.
65 13) (Optional) You could now move all logical volumes to hda3 and afterwards
66 delete hdb1 from the volume group. This would enable you to setup SW RAID 1
67 (Mirroring) in the future. If you want to use all 160G, keep it as it is.
68 14) reboot, without LiveCD. Hopefully your system should be up and running
69 now.
70 15) Delete the temporary LV from step 9).
71
72
73 Enjoy your new flexibility.
74
75 Bye...
76
77 Dirk
78 --
79 Dirk Heinrichs | Tel: +49 (0)162 234 3408
80 Configuration Manager | Fax: +49 (0)211 47068 111
81 Capgemini Deutschland | Mail: dirk.heinrichs@×××××××××.com
82 Hambornerstraße 55 | Web: http://www.capgemini.com
83 D-40472 Düsseldorf | ICQ#: 110037733
84 GPG Public Key C2E467BB | Keyserver: www.keyserver.net

Replies

Subject Author
Re: [gentoo-user] Re: Resize / Dale <dalek@××××××××××.net>