This is a discussion on repartitioning a live system, an example using NFS /usr within the Slackware Linux Support forums, part of the Unix Operating Systems category; --> Hi there, Recently I installed slack-current on an old box with a pair of 3.2GB HDDs, today I changed ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi there, Recently I installed slack-current on an old box with a pair of 3.2GB HDDs, today I changed my mind about the partitions and want to shrink /usr and increase small FAT32 to ~250MB. Temporarily convert the box to use an NFS mounted /usr during repartition of one the small HDDs fitted. Note, a box will boot without /usr, but it can be a pain if something you need is in the /usr tree after you deleted it. I use reiserfs3. Currently I have: root@pooh:~# fdisk -l /dev/hdc Disk /dev/hdc: 3227 MB, 3227148288 bytes 128 heads, 63 sectors/track, 781 cylinders Units = cylinders of 8064 * 512 = 4128768 bytes Device Boot Start End Blocks Id System /dev/hdc1 1 2 8032+ 4 FAT16 <32M /dev/hdc2 3 66 258048 83 Linux /dev/hdc3 67 130 258048 82 Linux swap /dev/hdc4 131 778 2612736 83 Linux /dev/hdc1 is there for old BIOS HDD geometry requirement, now I want to make it 250MB as I've decided to install win98 and need a data partition. hdc4 is /usr and hdc2 is /usr/local, I'll halve /usr/local size as well. method ``````` Avoid reinstall! On a localnet server, create an NFS export: root@deltree:~# cat /etc/exports # See exports(5) for a description. # This file contains a list of all directories exported to other computers. # It is used by rpc.nfsd and rpc.mountd. /home/share 192.168.1.0/24(sync,rw,no_root_squash,subtree_check) /home/mirror 192.168.1.0/24(sync,ro,subtree_check) # /home/share 192.168.2.0/24(sync,rw,no_root_squash,subtree_check) /home/mirror 192.168.2.0/24(sync,ro,subtree_check) # # export NFS mounted /usr for stinkpad laptop: /home/hal/usr 192.168.1.30/32(sync,rw,no_root_squash,subtree_check) # ditto for pooh /home/pooh/usr 192.168.1.22/32(sync,rw,no_root_squash,subtree_check) # root@deltree:~# exportfs -rv exporting 192.168.1.22/32:/home/pooh/usr <<== new export .... reexporting later.mire.mine.nu:/home/share to kernel On a root login to the target machine, copy the files across to the server: mount deltree:/home/pooh/usr /mnt rsync -avH /usr/* /mnt/ # this takes a while edit /etc/fstab, comment out the local HDD and add the remote /usr: root@pooh:~# cat /etc/fstab # /etc/fstab for slackware-11 on pooh # /dev/hda2 / reiserfs defaults 0 0 /dev/hda4 /home reiserfs defaults 0 0 #/dev/hdc4 /usr reiserfs defaults 0 0 #/dev/hdc2 /usr/local reiserfs defaults 0 0 deltree:/home/pooh/usr /usr nfs hard,intr # /dev/hda3 swap swap defaults,pri=1 0 0 #/dev/hdc3 swap swap defaults,pri=1 0 0 # /dev/cdrom /mnt/cdrom auto noauto,owner,ro 0 0 /dev/fd0 /mnt/floppy auto noauto,owner 0 0 # devpts /dev/pts devpts gid=5,mode=620 0 0 proc /proc proc defaults 0 0 # deltree:/home/mirror /home/mirror nfs noauto,hard,intr deltree:/home/share /home/share nfs hard,intr # wait for /usr upload to server . . . reboot root@pooh:~# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/hda2 258036 106872 151164 42% / /dev/hda4 2128824 902220 1226604 43% /home deltree:/home/pooh/usr 8224960 3854272 4370688 47% /usr deltree:/home/share 8224960 3854272 4370688 47% /home/share So /dev/hdc is no longer mounted and we still have /usr via NFS, do the fdisk manipulation (I'm old fashioned, rebuild, zero then format partitions before reuse -- don't trust these new-fangled resizing tools After that I'll copy the data from /usr to the new home in two passes, /usr to /dev/hdc4, adjust /etc/fstab for /usr change and reboot, then move /usr/local to dev/hdc2, via temp mounts on /mnt/, adjust /etc/fstab to final version, done. Grant. -- http://bugsplatter.mine.nu/ |