|
NetBSD General Other questions regarding NetBSD which do not fit in any of the categories below. |
|
Thread Tools | Display Modes |
|
|||
resizing or creating of partitions in NetBSD after installation?
First, I have to say - I'm much more familiar with Linux than with BSD and I'm not sure I really understand the BSD terminology or concept of labels and slices.
Now, my situation: I have NetBSD installed (and working well) on a disk with various other Windows and Linux partitions. NetBSD is installed on two partitions (/dev/wd0a for / and /dev/wd0h for /usr... well, and also /dev/wd0b for swap). They both fit into what disklabel declares as "unused", that is "c" (I suppose it would be /dev/wd0c) and what is being seen "from outside" (for example - parted from Linux) just as a single "sun-ufs" partition (but, from Linux I can only mount the NetBSD's /, it doesn't see it's /usr... I suppose it's normal ). That wd0c (or, maybe, better to say - wd0h), happens to be, by physical order on the disk, the very last partition that fits into the maximal range disklabel can see (I have all partitions from wd0e to wd0p, of Windows or Linux type, and they are all before the NetBSD partition; there're also some partitions at the and of the disk, but, they are ignored by disklabel). Now, my problem: it's coming to be quite packed on my /usr; in fact, it's more than full and I've already had to pull out /pkgsrc ant to declare a new path, but, it's still nearly full. And I have a plenty of free space just after the NetBSD partition. I'd like either to make a new partition, or to enlarge (indestructibly!) the present /usr. I don't mind which solution I would apply, but, I'm not sure if any of them is available (and, if yes - how?) A) Is it possible to resize (indestructibly!) a NetBSD partition? Maybe from a LiveCD? With another BSD? B) If I create a new partition, would disklabel see it? May I instruct disklabel to ignore some of Windows partitions and just to jump over, so that the new partition may fit into its range? For, example, I don't care to have access from NetBSD to the present wd0g... may I make a NetBSD partiton and tell disklabel to take it for a new wd0g (obviously, I'd like to preserve "wd0h" for /usr)? And... would I lose that partition (Windows or whatever) on the disk, too? For other OS's. Can I do something? (Except to reinstall NetBSD and take more space.) And, in the case of "yes", please - what exactly? Thanks in advance. Last edited by J65nko; 28th January 2012 at 02:40 PM. Reason: Some whitespace added ;) |
|
|||
OpenBSD and FreeBSD have a utility called growfs See http://www.freebsd.org/cgi/man.cgi?q...SD+9.0-RELEASE
Somebody ported this to NetBSD, but AFAIK it is not part of the NetBSD base system. NetBSD seemed to have had resize_ffs but I cannot find much documentation about it. See http://old.nabble.com/-HEADS-UP--gro...html#a30041716 BTW your problem would be more understandable if you would post your fdisk and disklabel output
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
|
|||
Quote:
Quote:
Code:
Disk: /dev/wd0d NetBSD disklabel disk geometry: cylinders: 310101, heads: 16, sectors/track: 63 (1008 sectors/cylinder) total sectors: 312581808 BIOS disk geometry: cylinders: 1024, heads: 255, sectors/track: 63 (16065 sectors/cylinder) total sectors: 312581808 Partition table: 0: Primary DOS with 32 bit FAT - LBA (sysid 12) bootmenu: WINDOWS start 63, size 12321792 (6017 MB, Cyls 0-766), Active 1: Primary DOS with 32 bit FAT - LBA (sysid 12) start 12321855, size 18442620 (9005 MB, Cyls 767-1914) 2: Primary DOS with 32 bit FAT - LBA (sysid 12) start 30764475, size 22523130 (10998 MB, Cyls 1915-3316) 3: Ext. partition - LBA (sysid 15) start 53287605, size 259289100 (126606 MB, Cyls 3317-19456) Extended partition table: E0: Primary DOS with 32 bit FAT (sysid 11) start 53287668, size 16402302 (8009 MB, Cyls 3317-4337) E1: NTFS, OS/2 HPFS, QNX2 or Advanced UNIX (sysid 7) start 69690033, size 8193087 (4001 MB, Cyls 4338-4847) E2: NTFS, OS/2 HPFS, QNX2 or Advanced UNIX (sysid 7) start 77883183, size 8401932 (4103 MB, Cyls 4848-5370) E3: NTFS, OS/2 HPFS, QNX2 or Advanced UNIX (sysid 7) start 86285178, size 16595082 (8103 MB, Cyls 5371-6403) E4: Primary DOS with 32 bit FAT (sysid 11) start 102880323, size 1429722 (698 MB, Cyls 6404-6492) E5: Primary DOS with 32 bit FAT (sysid 11) start 104310108, size 17607177 (8597 MB, Cyls 6493-7588) E6: Linux native (sysid 131) start 121917348, size 42154497 (20583 MB, Cyls 7589-10212) E7: NTFS, OS/2 HPFS, QNX2 or Advanced UNIX (sysid 7) start 164071908, size 16386237 (8001 MB, Cyls 10213-11232) E8: NetBSD (sysid 169) start 180458208, size 20498877 (10009 MB, Cyls 11233-12508) E9: Linux swap or Prime or Solaris (sysid 130) start 286053453, size 273042 (133 MB, Cyls 17806-17822) PBR is not bootable: All bytes are identical (0x00) E10: Linux swap or Prime or Solaris (sysid 130) start 286326558, size 273042 (133 MB, Cyls 17823-17839) PBR is not bootable: All bytes are identical (0x00) E11: Linux native (sysid 131) start 286599663, size 514017 (251 MB, Cyls 17840-17871) PBR is not bootable: All bytes are identical (0xf6) E12: Linux native (sysid 131) start 287113743, size 25462962 (12433 MB, Cyls 17872-19456) PBR is not bootable: All bytes are identical (0xf6) Bootselector enabled, timeout 7 seconds. First active partition: 0 Drive serial number: 149817581 (0x08ee08ed) Code:
# /dev/rwd0d: type: unknown disk: BIGMAXTOR label: flags: bytes/sector: 512 sectors/track: 63 tracks/cylinder: 16 sectors/cylinder: 1008 cylinders: 310101 total sectors: 312581808 rpm: 3600 interleave: 1 trackskew: 0 cylinderskew: 0 headswitch: 0 # microseconds track-to-track seek: 0 # microseconds drivedata: 0 16 partitions: # size offset fstype [fsize bsize cpg/sgs] a: 8721216 180458208 4.2BSD 2048 16384 0 # (Cyl. 179026 - 187677) b: 263088 189179424 swap # (Cyl. 187678 - 187938) c: 20498877 180458208 unused 0 0 # (Cyl. 179026 - 199362*) d: 312581808 0 unused 0 0 # (Cyl. 0 - 310100) e: 12321792 63 MSDOS # (Cyl. 0*- 12224*) f: 18442620 12321855 MSDOS # (Cyl. 12224*- 30520*) g: 24579450 30764475 MSDOS # (Cyl. 30520*- 54904*) h: 11514762 189442512 4.2BSD 2048 16384 0 # (Cyl. 187939 - 199362*) i: 14345982 55343988 MSDOS # (Cyl. 54904*- 69136*) j: 8193087 69690033 NTFS # (Cyl. 69136*- 77264) k: 8401932 77883183 NTFS # (Cyl. 77265*- 85600*) l: 15759702 86285178 NTFS # (Cyl. 85600*- 101234) m: 1429722 102880323 MSDOS # (Cyl. 102063*- 103482*) n: 17607177 104310108 MSDOS # (Cyl. 103482*- 120949*) o: 42154497 121917348 Linux Ext2 0 0 # (Cyl. 120949*- 162769*) p: 16386237 164071908 NTFS # (Cyl. 162769*- 179025*) |
|
|||||
Quote:
Quote:
Quote:
Quote:
Quote:
|
|
||||
Quote:
Quote:
Quote:
Quote:
Disklabel can be confusing and scarey at first, and it is very important to be careful not to trash any entries you want to keep, because this is after all how the OS tries to find them and you don't want it going off into the wrong part of the disk! |
|
|||
Quote:
1st step: fdisk, to expand the slice? I think I've found something about somewhere in forums. Is it right? (If I should do it) can I do it from NetBSD (or, maybe, it should be done just after the boot prompt, by pressing a key and running a command?) and would it be safe for my /dev/wd0a and /dev/wd0h? (Of course, if I "expand" it the wrong way, it would be very unsafe ) 2nd step: disklabel editing 3th step:newfs or something, to create the new fs. Is that proceeding correct, or maybe I should first create the fs and only then to edit disklabel? Quote:
|
|
||||
Quote:
What I was proposing was either: a) create a new logical partition in your extended partition, at the end of it, if there is room. This would be done with fdisk. OR b) take one of your existing partitions, which you are not using (if there is such) and re-purpose it (after backing up anything you want to keep from it, of course). If either of these are possible you would have a "new" partition, which you would make an ext2 file system on (using Linux' mke2fs) with the proper options so NetBSD can use it. Quote:
Quote:
Step 3 would then be to mount the new partition in NetBSD: # mount -t ext2fs -r /dev/wd0m /some/where Again, this is my original alternate approach, nothing to do with expanding things. |
|
|||
I'm stock-still
Quote:
Quote:
It says: Code:
disklabel -e -r sd0 Read the on-disk label for sd0, edit it and reinstall in-core as well as on-disk. Also, I would feel more comfortable to export the label first to a "protofile" and edit that file, rather then editing directly. Should I apply the option -W to re-import it? And also, I don't understand the relation between disklabel, installboot and maybe something else... (although it's already another pair of shoes... see the "P.S:" at the bottom) Quote:
But, anyway, you gave me another idea, not related to this particular problem: I might create an ext2 partition to be used as a "parking" place for VM-ware guest OS's, both for NetBSD and Linux. P.S. Let me explain: This NetBSD is a "reincarnation" of an old NetBSD I used to have, but, that became unbootable with the new motherboard. I've managed to "resurrect" it recently by upgrading it to 5.1.1.x. That old NetBSD, at the begining, used to have a boot menu with 3 options: NetBSD, Windows and Linux (Grub on another drive). At some point, after an incident (I don't remember what it was), I've lost the boot menu. I've been able to rescue it, but, with the only option "1.Windows" (!?) I have still been able to boot to NetBSD since my Windows bootloader has had the NetBDS boot image (or via Grub on another disk). and it's same now, with this "resurrected" NetBSD. Even if I press "0" or "2", I get something like "? Error". Of course, it's not an issue, but, it's still a bit annoying, since I can't boot directly to NetBSD. Maybe while I'm around disklabel, I might fix it too? |
|
||||||
Quote:
BTW, I agree with you that it would be better to use a native FS, and ext2 is just a "last resort". Let's look at that in moment, but just a quick word of encouragement about ext2. My main system is dual boot Linux and NetBSD; I use the same ext2 FS as HOME for both systems, rw of course. The only problem I've had is that NetBSD can't fsck the FS, but since I boot Linux regularly this isn't a big deal. But just because it "works for me" is no reason you should do it, and the native approach is probably better for your circumstances. So enough of ext2 for now. I had some thoughts overnight abour your "expanding things" approach, so I'll give them first, then try to answer some of your other questions as best I can. So you have 40G free after the NetBSD slice. One could think about doing something like this: 0) Make a record of the current fdisk partitions, in Linux # fdisk -l /dev/hda > fdisk-record This is for if things don't work and you decide to go back to what you had. 1) With fdisk in Linux, increase the size of the NetBSD slice E8 to absorb some or all of the following 40G. (Don't overlap into E9.) Note: at this point, the partition table will not agree with the existing disklabel's idea of what the NetBSD slice (c: on disklabel) is! NetBSD may or may not boot with this inconsistency; I dunno never tried that! 2) Within the new extra area, put one or more (your choice) new native FFS filesystems. This means editing the disklabel to replace existing entries for MSDOS, NTFS, or Linux ext2, with new disklabel partitions. Using disklabel should be done from NetBSD, *but*, because of the problem noted at 1), it may not be possible or safe to do this by booting the on-disk NetBSD! So I think a good idea would be to do this disklabel editing from a booted install CD. You could exit the install system at the start to get a shell, and run disklabel from there. Of course, don't overlap anything else in the NetBSD slice. Plan the desired locations and sizes carefully beforehand. 3) Once the disklabel is ready, things should be in sync and should boot [*] the hard disk NetBSD. Then, newfs the new partitions (this could also be done from the install CD after editing the disklabel ... might be a better idea). [*] Well, from your PS, I don't understand how you boot, so you better think about this point! 4) mount the new partitions, check them out, enter them in /etc/fstab and enjoy the new, improved, expanded NetBSD slice. Note: I've never had the need to do the above, so they're just ideas I think should work. I hope this is helpful idea-wise. Comments from others on this are welcome! Quote:
Quote:
Quote:
Quote:
Quote:
|
|
||||
Quote:
Quote:
Quote:
Code:
-N Disallow writes to the disk sector that contains the label. This is the default state. Quote:
|
|
|||
Oh, yes... and yet another risk about ext2: One day I might wish to resize my partitions and to catch that one, too. I'd probably do it from Linux. And that may happen after a long time, so that I forget to update my disklabel in NetBSD. And tthen...
|
|
||||
That is for sure !
Quote:
# disklabel -R wd0 protofile (assumes wd0 is your disk). As an experiment you might try that with a protofile that has not been altered in any way, and see if it still works. Another issue is to be sure you can access the protofile from the install CD. Since we're worried the disklabel slice entry at this point doesn't match the disk partitions, you might have to put protofile on an ext2 and see if you can access it from the install CD shell. This too could be tested before doing anything for real. Quote:
Quote:
|
|
||||
I forgot to mention a semi-obvious (but important!) point.
In Step 2, while editing the disklabel to add a new BSD partition, you must also edit the slice definition c: so that it matches the fdisk logical partition expansion done in Step 1. |
|
|||
Quote:
Now, I'm preparing to do some tests (to put in and out some existing partitions), I've prepared the protofiles and I'm just going to boot into NetBSD. I'll do it first with another disk, without any slices. |
|
|||
Excuse me, are you sure it should go with that regex metacharacter? (Why?)
When, under Linux, I try to run an operation on that partition (with sfdisk, or parted), I'm getting " Code:
Error: File system has an incompatible feature enabled. Compatible features are has_journal, dir_index, filetype, sparse_super and large_file. Use tune2fs or debugfs to remove features. |
|
||||
Yes, I've seen these installers do some bizarre things. The other week I put NetBSD back on my laptop, and IIRC I asked the installer to use the whole slice with one filesystem. So then it shows you the disklabel, and it has made a swap [OK], a root partition [OK] and about 3GB of the slice are left empty [*DOH*}. Something is broken.
|
|
||||
Quote:
Quote:
I haven't had time to absorb the rest of your post yet, but will try to respond later today. In the meantime good luck with the experiments. |
|
||||
Quote:
Quote:
Quote:
|
|
|||
It wasn't (only) that, but, also "resize_inode". I don't have a clear idea where that second feature came from, since I've done nothing else, but to apply your exact command, but, maybe with that version of mke2fs it's being added by default. (I recall I've already had a similar problem some time before.) However, it's solved. I've run debugfs, removed both resize_inode and dir_index and, after being done with partitioning, added "^dir_index" where it was needed.
Quote:
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
NetBSD 5.1 Installation issues | acottag | NetBSD Installation and Upgrading | 8 | 14th January 2011 05:06 AM |
Resizing slices | jewsofeast | NetBSD General | 1 | 20th November 2010 11:34 AM |
Resizing /usr | jewsofeast | OpenBSD Installation and Upgrading | 11 | 19th November 2010 01:46 PM |
Resizing /usr | abdo88 | FreeBSD General | 15 | 12th July 2008 01:49 PM |
NetBSD installation problem | fgs | NetBSD Installation and Upgrading | 3 | 26th June 2008 04:01 PM |