[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: No space left on device

On Sat, Jul 19, 2003 at 09:10:14PM -0400, Salman Haq wrote:
> > > #df -h
> > > Filesystem            Size  Used Avail Use% Mounted on
> > > /dev/hda3             463M  440M  1.0k 100% /
> > > /dev/hda5              37G  2.5G   32G   8% /usr
> > >
> > > # df -ih
> > > Filesystem            Inodes   IUsed   IFree IUse% Mounted on
> > > /dev/hda3               120k     20k    100k   17% /
> > > /dev/hda5               4.7M    149k    4.5M    4% /usr
> > >
> > >  Now, I realize that this a very bad partition scheme but I'm just a
> > > newbie. When I was installing debian a few months ago, I didn't intend to
> > > have this scheme. I wanted root to be mounted as '/' and everything else
> > > under '/usr' since thats the bigger partition. Unfortunately, most of
> > > everything is mounted under '/'. I wonder where I went wrong...
> > >
> > >  Can I change this situation, without re-formatting/re-partitioning? Or,
> > > atleast for now, which files can I safely delete to free-up some space?

>  Thanks everybody for your helpful responses. To make some temporary room
> I cleaned up some logs and unnecessary directories in a few of the home
> directories of some of the users.
>  Then I resolved to fix the problem once and for all by using parted to
> resize the partitions. When I finally got around to doing it this past
> weekend, things didn't go as smoothly as I thought they would.
> This is the information that parted shows about my partitions:
> Disk geometry for /dev/hda: 0.000-57220.458 megabytes
> Disk lable type: msdos
> Minor	Start		End	Type	Filesystem 	Flags
> 1	0.031	        31.376  primary fat 16
> 2      31.377	     15390.395  primary ntfs		boot
> 3   15390.396        15868.894  primary ext2
> 4   15868.894        54493.923  extended
> 5   15868.925        54015.424  logical ext2
> 6   54015.456        54390.396  logical linux-swap
> Since my original problem requires me to shrink hda5 down to ~10 gigs and
> expand hda3 to ~30 gigs I set about to do the following:
> (parted) resize 5 40869.024 54015.424
> and saw this:
> attempt to access ... of device
> 03:00: rw-=0, ... limit=58593750   <-(same error msg as before)
> Warning: You requested to resize the partition to 40869.024-54015.424Mb.
> The closest Parted can manage is 15868.925-54015.424.
> So parted doesn't want to resize the partition that way.

I believe that Florian Ernst answered this problem...

> Then I quit
> parted and restarted it as "parted /dev/hda5" and typed:
> (parted) resize 1 0.000 13146.4
>  That actually resized something... when I restarted my computer normally,
> /dev/hda5 mounted to /usr and "df" showed its size as 12 gigs (as opposed
> to the old 37 gigs). However, parted continues to show the original
> numbers. Morever, I still haven't solved my original problem, which is
> expanding /dev/hda3. When I try:
> (parted) resize 3 15390.393 40000.000
> it says "The closest parted can manage is 15390.393 15868.894"
>  I also tried "parted /dev/hda4" but that just says "can't partition
> outside of disk" even if I simply try to print info.
>  What do I have to do to get rid of that disk access error and
> shrink hda5 (or hda4,5,6) and expand hda3?
>  In the meanwhile, I have 'resized' hda5 back to its original size
> so that 'df' show its size as 37 gigs. I hope this makes sense.

There are a couple of ways to go about this..

1) Keep everything you currently have on "/" and expand it.
2) Create additional partitions and move some directories out of "/"

In either case, the first thing you are going to have to do is shrink
hda5..  Someone suggested that you'd never need more than 5-10G on /usr,
so.. assuming you want 10 G, after issuing the command "parted /dev/hda"

1) if you want to keep only the two partitions and not add more..
(parted) resize 5 15868.925 44015 ( leaving about a 10-G space above
(parted) mkpartfs ext2 <new top of hda5> 54390.396
<copy existing hda5 to new partition> - see below..
(parted) del <old hda5>   ( should still be hda5)
I'm not sure now what hda4 will look like - I've never tried this.. if
it's now moved to the begin of the new hda5, you are sitting fine..
just resize hda3 up to the bottom of hda5...

2) -- probably easier.. create new partition(s) and move director(ies)
out of "/"..  "/home" should give you a bunch of space.. also /etc takes
up quite a bit..  "du -ch" of the /home and /etc dirs should give  you
an idea of what you might need..

(parted) resize 5 15868.925 25868.925 (adjust to taste)..
then create new partition(s) in the new free space and copy the
director(ies) into the new partition(s) (see below)..  delete (or empty)
these directories from within hda3 - if you delete them, you need to
make new empty dirs in hda3 for mounting purposes..

Then edit /etc/fstab to the new setup and remount..

Note on copying dirs:  parted has a copy facility for copying one
partition to another, but I'm not sure if it works on differently-sized
partitions.. the simplest way is to do this, IMO, is to pipe tar into
itself..  Basically:

cd <source directory>

tar . -cf -  | tar -C <destination dir> -xf -  (tar has another
stdout/stdin option, but this works for me)

Don't forget to mount the new partition before doing this.  For example,
if you want to copy /etc to hda6:

<do this as root>
mount -t ext2 /dev/hda6 /mnt
cd /etc
tar . -cf - | tar -C /mnt -xf -

(maybe check new directory.. might run diff if you wish..)
diff -r /etc /mnt
umount /mnt..

One other thing.. man tar.. I think there is an option to preserve
uid/gid.. you need to watch and include this..  If not, for /home,
especially, after mounting the new /home partition on /mnt (or
whatever), as root, mkdir /mnt/<user>; chown user.user /mnt/<userdir>,
then cd into /home/<user> and run the tars as <user>, also, what follows
-C in this case would be -C /mnt/<user>.. this being done for each
user..  but I do believe that tar does have an option to preserve owner,
doesn't it?

I hope this helps and works for you ..

Reply to: