LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   boot root partition read only (https://www.linuxquestions.org/questions/linux-general-1/boot-root-partition-read-only-102059/)

mrtwice 10-09-2003 09:37 AM

boot root partition read only
 
I need to change my partition type from ext3 to ext2 in order to use partition magic on it so I can resize (who knew I would like linux this much).

tune2fs can do the conversion for me, but when I try to do it it tells me that the partition needs to be mounted read only. Well, I just can't seem to make it do that. I have tried modifying fstab and passing the readonly command to lilo at boot, but whenenver I run `mount` it shows that / is mounted rw.

Some help please and thank you in advance.

J.W. 10-09-2003 07:33 PM

Dude - I'm reasonably sure it's impossible to do what you're describing. The root directory "/" is owned by root, and root also always has all permissions all the time.

What it sounds like you're trying to do is to revoke write privs on root's own directory from root itself, ie, you want to put limits what root would be permitted to do. As far as I'm aware that's impossible since root is all-powerful, plus, and probably more importantly, the "/" directory contains both static and dynamic data and therefore write privs must be open on it (to root). (Note: If anyone has information to the contrary, please share that info.)

In any event, there is a paritioning tool called Boot IT NG which supports a resize function. Whether it would work under the root directory or not is unknown to me as I have never tried it, but I have resized Windows paritions before with it and it worked like a charm. Obviously before attempting any resizing work, you would want to delete any unnecessary data in order to maximize the amount of free space. (Note however that what would really matter is the amount of contiguous free space, but clearly deleting files you know are just clutter would be helpful.)

Hopefully some of this may be useful, good luck with it. -- J.W.

jimveta 10-09-2003 09:09 PM

well, if you boot up with the root partition mounted read only
nothing will work (i know firsthand :) )--unless you have a seperate
partition for all the dirs containing config file that's touched

if you have a method of booting from something else, then you can
mount root readonly. for example, like booting of cd; or booting of
a second hard disk with a linux installtion.

quatsch 10-09-2003 09:27 PM

you can remount it read-only by
mount -o ro -o remount /

I'm not sure it's a good idea though. For one, PM might seriously hose your system. I've heard bad things about linux file systems and pm.

DavidPhillips 10-09-2003 10:18 PM

you need to change fstab to show ext2 and reboot



perl -i -wpe 's/ext3/ext2/g' /etc/fstab; reboot

quatsch 10-09-2003 10:36 PM

You can't boot up and expect the root partition to be mounted read-only no matter what you have in fstab or kernel parameters. What you must do is to remount the file system once you're done with the boot in the way I describe above. The trouble with having the / partition mounted read only is that the system might need to write to it to function, especially if /var and /tmp are on the same partition. To mininmize risk, I would go into single user mode and then remount / as read only.

DavidPhillips 10-09-2003 10:45 PM

it's not going to be read-only it's going to be ext2

or is that not what we're trying to do?

DavidPhillips 10-09-2003 10:49 PM

why don't you use parted to resize it

quatsch 10-09-2003 10:53 PM

even parted won't be able to work on a rw-mounted partiton, will it? The thing needs to be remounted read-only.

DavidPhillips 10-09-2003 11:32 PM

I think if I was going to use parted I would get partboot and make a floppy disk set


ftp://ftp.gnu.org/gnu/parted/bootdisk



the readme...



If you want run Parted on a machine without GNU/Linux installed, or you
want to resize a root partition, you will need to use a boot disk.

Boot disk images are available from:

ftp://ftp.gnu.org/gnu/parted/bootdisk

You need to download the boot image (partboot.img) that doesn't change
between Parted releases, and a root image (eg: partroot-1.6.1.img).

To create the disks, type (in GNU/Linux)

# cp partboot.img /dev/fd0
# cp partroot-1.6.1.img /dev/fd0

Obviously, you need to insert a new disk in the middle ;)

If you DOS/Windows, you can use RAWRITE.EXE.

To use the disks, boot off the partboot disk, and insert the partroot
disk when it asks.




As far as PM goes I don't know, never used it

J.W. 10-10-2003 02:21 AM

I welcome comments about this, but as I posted previously, from what I understand, / cannot be mounted RO. The reference source I'm using is the Filesystem Hierarchical Standard, v2.2 by Rusty Russell and Daniel Quinlan.

Specifically, I refer to this page: http://www.pathname.com/fhs/2.2/fhs-2.html

which states that / cannot be mounted RO. Am I missing things, or is this source inaccurate?? I welcome any feedback. -- J.W.

mrtwice 10-10-2003 08:26 AM

Quote:

Originally posted by quatsch
you can remount it read-only by
mount -o ro -o remount /

I tried that, no such luck. It told me / was busy.

I ended up using my slackware install cd and just booted from that. I tried several ways to boot / and none of them work (well one "worked" but the OS didn't load right and was useless). I don't think it is possible.

Like I said, I just booted from the slack cd and used tune2fs from there. Worked like a charm.


All times are GMT -5. The time now is 12:13 PM.