LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   creating new partition before boot partition?? (https://www.linuxquestions.org/questions/linux-general-1/creating-new-partition-before-boot-partition-44098/)

rose_bud4201 02-04-2003 04:23 PM

creating new partition before boot partition??
 
Hi,
I'm running linux on half of a 20-gig hdd (the other half is the Win2K boot partition), and since I really need more space for linux I chopped off about 4 gigs from the Win2K partition using PartitionMagic (I know, I know....) but didn't create another partition or format it yet. My question is twofold: the partition structure, should I just make a new partition out of those 4 gigs, will look like this:

| -- 6 gigs NTFS -- | -- 4 gigs ext3 -- | -- 9.7 gigs linux boot -- | -- remainder linux swap -- |

Now, if I do that, I have a feeling that linux will complain if I create a new partition physically before the linux boot partition on my hdd - so, given that, how to I tell Lilo where to find linux again??

And, after that, is there a way to move the 'home' folder (or a subfolder thereof) to that new partition, and still have linux know where everything is, or would I have to just copy everything over and deal with a different path to access it? (This is the first time I've had to deal with creating partitions other than those created by the installer, so I'm a little clueless...sorry. I'm learning, though. :study: )

thanks!
Laura

bulliver 02-04-2003 05:30 PM

I think that all you will need to do is change the hard drive partition numbers in your lilo.conf and your /etc/fstab. This is what it is now (correct me if i'm wrong):

/dev/hda1 10GB Windows
/dev/hda2 9.7GB Linux
/dev/hda3 300MB Linux Swap

So when you put in this new partition obviously you will have to change the partition designations:

/dev/hda1 6GB Windows
/dev/hda2 4GB Linux
/dev/hda3 9.7GB Linux
/dev/hda4 300MB Linux Swap

So you need to change every designation of hard drive partitions to the new revised ones in lilo.conf, then reinstall lilo for the changes to take effect. Then make the changes to your /etc/fstab so the correct partitions are mounted at boot. Lilo will not care if there is a partition before the one it boots from. As long as lilo.conf correctly points to where the kernel is....

As far as using the new partition for your /home that's simple, just add a line like:

Code:

/dev/hda2 /home ext3 defaults 0 0
to your fstab, mount the new partition somewhere temporary ie: /mnt/home, then physically copy your home directory over:

Code:

cp -Rf /home /mnt/home
Some advice: do not erase the old home directory until you are sure this has worked, so run 'mv /home /home.bak' or something similar.

Now reboot, and hopefully it will work. If you need clarification of anything just ask...

good luck

rose_bud4201 02-04-2003 07:01 PM

Alrighty...this is what I've got in lilo.conf:
Code:

boot=/dev/hda
map=/boot/map
vga=normal
default=linux
keytable=/boot/us.klt
prompt
nowarn
timeout=100
message=/boot/message
menu-scheme=wb:bw:wb:bw
ignore-table
disk=/dev/hde bios=0x81
disk=/dev/hdg bios=0x82
image=/boot/vmlinuz
        label=linux
        root=/dev/hda5
        initrd=/boot/initrd.img
        append="quiet devfs=mount hdd=ide-scsi hdb=ide-scsi"
        vga=788
        read-only
image=/boot/vmlinuz
        label=linux-nonfb
        root=/dev/hda5
        initrd=/boot/initrd.img
        append="devfs=mount hdd=ide-scsi hdb=ide-scsi"
        read-only
image=/boot/vmlinuz
        label=failsafe
        root=/dev/hda5
        initrd=/boot/initrd.img
        append="failsafe devfs=nomount hdd=ide-scsi hdb=ide-scsi"
        read-only
other=/dev/hda1
        label=NT
        table=/dev/hda
other=/dev/fd0
        label=floppy
        unsafe

and in fstab:
Code:

/dev/hda5 / ext3 defaults 1 1
none /dev/pts devpts mode=0620 0 0
none /mnt/cdrom supermount dev=/dev/hdc,fs=auto,ro,--,iocharset=iso8859-1,codepage=850,umask=0 0 0
none /mnt/cdrom2 supermount dev=/dev/scd0,fs=auto,ro,--,iocharset=iso8859-1,codepage=850,umask=0 0 0
none /mnt/floppy supermount dev=/dev/fd0,fs=auto,--,iocharset=iso8859-1,sync,codepage=850,umask=0 0 0
/dev/hda1 /mnt/nt ntfs iocharset=iso8859-1,ro,umask=0 0 0
none /mnt/zip supermount dev=/dev/sda4,fs=auto,--,iocharset=iso8859-1,sync,codepage=850,umask=0 0 0
none /proc proc defaults 0 0
/dev/hda6 swap swap defaults 0 0

Is it normal for the hda partition numbers to jump like that?? I mean, rather than being hda1, hda2, hda3, etc. they're hda1, hda5, hda6? And does that mean that 2, 3 and 4 would be alright to pick from when I add that new partition?

thanks,
Laura

nxny 02-04-2003 07:15 PM

Quote:

Originally posted by rose_bud4201
...
Is it normal for the hda partition numbers to jump like that?? I mean, rather than being hda1, hda2, hda3, etc. they're hda1, hda5, hda6? And does that mean that 2, 3 and 4 would be alright to pick from when I add that new partition?
...
[/B]
It is alright, yeah. A hard disk can have a maximum of 4 primary partitions only. They are numbered from 1 to 4. One of these 4 can be substituted by an extended partition and contain as many as 28 logical partitions and are numbered from 5 to 32. The extended partition is created first and then the logical ones that reside within it. Post output to /sbin/fdisk -l /dev/hda so we can have a better idea about what's going on.

rose_bud4201 02-04-2003 07:27 PM

# /sbin/fdisk -l /dev/hda
omitting empty partition (5)

Disk /dev/hda: 255 heads, 63 sectors, 2498 cylinders
Units = cylinders of 16065 * 512 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 765 6144831 7 HPFS/NTFS
/dev/hda2 766 2498 13920322+ f Win95 Ext'd (LBA)
/dev/hda5 1276 2448 9422091 83 Linux
/dev/hda6 2449 2498 401593+ 82 Linux swap


I wish I knew where that extra big ol' Win95 Ext'd partition is coming from... it sure doesn't exist anywhere except for fdisk :confused:

nxny 02-04-2003 08:03 PM

Quote:

Originally posted by rose_bud4201
# /sbin/fdisk -l /dev/hda
omitting empty partition (5)

Disk /dev/hda: 255 heads, 63 sectors, 2498 cylinders
Units = cylinders of 16065 * 512 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 765 6144831 7 HPFS/NTFS
/dev/hda2 766 2498 13920322+ f Win95 Ext'd (LBA)
/dev/hda5 1276 2448 9422091 83 Linux
/dev/hda6 2449 2498 401593+ 82 Linux swap


I wish I knew where that extra big ol' Win95 Ext'd partition is coming from... it sure doesn't exist anywhere except for fdisk :confused:

Looks good.

And extended partition is not physical. It is just a container that houses the linux partitions and the free space that you have just created (by shrinking the first primary partition) .

create a new partition using fdisk command 'n'. At this point you can only create a logical partition so it shouldnt ask you for the type. when it asks your for start cylinder give it 766 and end it at cylinder 1275. That should take care of all the free space and put it under the new partition. now print it using 'p' , note the number of the new partition and use 't' to set its type to 83. Now 'p'rint it again and 'w'rite it to disk if it looks good. make an e2 or e3 filesystem on it and you're good to go.

Follow bulliver's instructions.

rose_bud4201 02-04-2003 08:27 PM

thanks so much! :)

rose_bud4201 02-04-2003 11:19 PM

Whoopsie...odd error (maybe not so odd?). Everything went perfectly up until the editing of /etc/fstab and rebooting.

Quote:

As far as using the new partition for your /home that's simple, just add a line like:
code:
/dev/hda2 /home ext3 defaults 0 0
to your fstab, mount the new partition somewhere temporary
ie: /mnt/home, then physically copy your home directory over
Now, as my partition table ended up being
Code:

                                Device Boot    Start      End    Blocks  Id  System
/dev/ide/host0/bus0/target0/lun0/part1  *        1      765  6144831    7  HPFS/NTFS
/dev/ide/host0/bus0/target0/lun0/part2          766      2498  13920322+  f  Win95 Ext'd (LBA)
/dev/ide/host0/bus0/target0/lun0/part5          1276      2448  9422091  83  Linux
/dev/ide/host0/bus0/target0/lun0/part6          2449      2498    401593+  82  Linux swap
/dev/ide/host0/bus0/target0/lun0/part7          766      1275  4096543+  83  Linux

my line in fstab (which I just tacked onto the end of the file) was
Code:

/dev/hda7 /home/laura ext2 defaults 0 0
as I only want to mount my folder in home to the new partition - the other ones are so seldom used that they can stay where they are, and the filesystem is ext2. (I originally thought it to be ext3, but mounting the partition to copy all my home files over revealed that it was, in fact, ext2. So that, at least, I'm sure of.)

The problem? When I rebooted, everything was hunky-dory until WindowMaker tried to load - all it did was segfault, no matter how many times I tried restarting it. I eventually used the alternate window manager to edit /etc/fstab to take that new line out of it, rebooting after which puts everything back to normal, and here I am, once again pleading for help ;)

thanks!
~Laura

nxny 02-05-2003 12:04 AM

>as I only want to mount my folder in home to the new partition - the other ones are so seldom used that they can stay where they are, and the filesystem is ext2. (I originally thought it to be ext3, but mounting the partition to copy all my home files over revealed that it was, in fact, ext2. So that, at least, I'm sure of.)

What command did you use to your fnew filesystem?

>The problem? When I rebooted, everything was hunky-dory until WindowMaker tried to load - all it did was segfault,

What command did you use to replicate the structure under /home/laura? That probably didnt do it. Some of the windowmake settings files are probably pointing to some that didnt get copied and hence dont exist. At least that is the only thing I can think of.

rose_bud4201 02-05-2003 12:37 AM

a) mke2fs /dev/hda7 - couldn't find a version for ext3, in the short amount of time I poked around :-/

b) cp -Rf /home/laura /mnt/home/laura

I think you're p'bly right about the settings files...would there be links in there ('there' most likely being ~/GNUstep) that use relative pathnames? Those could be heck to fix....if that's the case I'll pretty much have to throw over the whole project and keep some inconsequential stuff on the new partition...

nxny 02-05-2003 01:02 AM

a) ext3 is just an ext2 with a journal. You could've created e3 with 'mke2fs -j' or mkfs.ext3 . That would wipe the data if you do it now. If you want to keep the data intact, use tune2fs -j /dev/hdX to add the journal. Edit fstab to change the corresponding type to ext3 and mount -a -O remount

--edited---

( Mounting /home/subdir to a different device is a blatant violation of my UNIX admin handbook. Not nice :rolleyes: )

rose_bud4201 02-05-2003 01:22 AM

hmmm...well, as I'll have to recopy all the files anyway to preserve the links, reformatting it isn't really a problem...

and about the whole mounting subdirectory thing...if it's that off-the-wall, mounting /home is really not a problem - I just generally tend to expand to fill the space I'm given, and as there's only one other user on my machine who really doesn't use it that often I'm afraid I'll crowd him out. Which I should just learn not to do, so alrighty then, /home it is.

It'll most likely be tomorrow morning before I get a chance to really try this, as going to class on 4 hours' sleep is not my biggest joy in life and I need to be getting some sleep, so...

thanks so much!
Laura

HerrSprengstoff 02-05-2003 01:50 AM

Well, after poking around through some of the WindowMaker config files that're in ~/GNUstep, I saw also that quite a few have references to stuff in your /home directory, there's a chance those are the ones having problems, we can try checking that out tomorrow too,

nxny 02-05-2003 01:58 AM

Quote:

Originally posted by rose_bud4201
hmmm...well, as I'll have to recopy all the files anyway to preserve the links, reformatting it isn't really a problem...

and about the whole mounting subdirectory thing...if it's that off-the-wall, mounting /home is really not a problem - I just generally tend to expand to fill the space I'm given, and as there's only one other user on my machine who really doesn't use it that often I'm afraid I'll crowd him out. Which I should just learn not to do, so alrighty then, /home it is.

It'll most likely be tomorrow morning before I get a chance to really try this, as going to class on 4 hours' sleep is not my biggest joy in life and I need to be getting some sleep, so...

thanks so much!
Laura

For systems with 500 users or more they do what were about to do, just because one disk cant hold the entire /home. Doesn't sound like that is the case here.

If all you want to do is to stay within limits, you can set the limits by using quota. see manpage.

mount /dev/hda7 under /mnt/newfs and cp -a /home/* to it. Edit your mountpoint in fstab. and remount.

rose_bud4201 02-06-2003 05:45 PM

*breathes sigh of relief*

well...it worked. Took a few hours of being unable to boot up past the command prompt (!), but it finally worked :)

As it turned out, there were 2 problems: 1: cp -Rfa didn't copy all those little hidden config files and folders that are all over your home directory, i.e. the ones whose filenames are .something (how do you copy those, btw?? Other than one at a time, by hand, that is??
and 2) I forgot that I'd copied all the files in /home over to the new partition as root...and when I tried to boot up as a normal user I didn't have rwx permissions on them, and I think that screwed me over just a little bit...well, now I know! :study:

(I ended up taking the line out of /etc/fstab and booting up normally to make the necessary changes to the files...but now my home directory is where it should be, I've got lots of space, and am enjoying having my system back up and running :)

Thank you very much for all your help


All times are GMT -5. The time now is 07:03 AM.