Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

schrink file system

Status
Not open for further replies.

djessi

IS-IT--Management
Joined
Dec 29, 2006
Messages
93
Location
CM
Hi,
I installed RedHat Linux using almost the entire disk for /,
I would like to reduce the /, how can I manage ? How can I save Linux system and restore it back. Thanks for help
Djessi
 
There a repartitioning tool called 'parted'. It may do all you want without distroying your existing data.
 
Thanks for your answer,
But when I use "parted" I get the following message :
"No Implementation: This ext2 filesystem has a rather strange layout! Parted can't resize this (yet)".
Regards
Djessi
 
What version of Red Hat are you running and what did you use to partition the drive? Parted is compatible with ext2, ext3, fat16, fat32, linux swap and a couple others, so I don't know why it would give that message. Are you using it in interactive mode or command line? Can you give us the command that gave you this error?

 
RedHat Entreprise Linux Kernel 2.4
I used Disk Duid to partition the drive
These are the commands I typed :

#parted /dev/hda
#resize 2 101.975 18000
(because df gives :
Minor start End Type FS
2 101.975 37777.851 Primary Ext3 )

Thanks
 
It may be because you are using extended attibutes which causes fits with parted. To check to see if you are, type 'lsattr /' and it will list out all the directories under / and any exetended attributes they may have. I'm running CentOS which is more or less a clone of RHEL. If I run that command, it will show an 'I' on /sbin and /etc. To my knowledge (which is very slim), there are three possible attributes:

Append only (a) - file can only be opened in append mode
Immutable (i) - file cannot be changed, even by root, though root can unset the immutable attribute
Secure delete (s) - file blocks are written over with zeros when the file is deleted

The folks at parted say they will be able to do that in the future which is why they say they can't shink it (yet). You may be able to change the attributes just like you would chmod except the command is chattr and you would use -i or whatever the attribute is that you got from lsattr. Please do some checking around before you do this though. I've never done this and ain't quite sure if you need to hide behind bullet proof glass before pressing the button.

 
Ok,
In my first post I was asking how can I save linux system
and restore it back without re-installation.
Thanks
 
Actually, you asked two questions:

I would like to reduce the /, how can I manage ?

How can I save Linux system and restore it back.

Your statement is coming off as a little rude.

 
In my first post I was asking how can I save linux system
and restore it back without re-installation.

- dd the MBR to a regular binary file in the current partion
- cp/cpio all the data to a backup location
- boot into a live distro and fdisk the drive, reformatting it as you need
- still in the live distro copy the data to the proper locations
- stilli in the live distro dd the mbr back.

NOTE: dding a mbr where the ~/mbr.bak is the backup location your saving to:
dd if="/dev/hda" of="~/mbr.bak" bs=512 count=1
dding it back
dd if="~/mbr.bak" of="/dev/hda" bs=512 count=1

This will only work if all the partion numbers for the /boot and / stay the same...

Alternativly use a partion editor that supports extended attributes and non-destructive repartioning

[plug=shameless]
[/plug]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top