Find the answer to your Linux question:
Results 1 to 3 of 3
I have serwer Debian with my website. My provider splited the disc into 5GB partition for / and 495GB partition for /var Everything was going ok for over two years ...
  1. #1
    Just Joined!
    Join Date
    Apr 2011
    Posts
    2

    Extending root partition

    I have serwer Debian with my website. My provider splited the disc into 5GB partition for / and 495GB partition for /var
    Everything was going ok for over two years but now I don't have enough memory on /
    I'd like to increase the partition bu the problem is that /var is just next to it so I can't easly change the end of the first one.

    I need some safe solution... It might be even just shrinking partition for /var, adding new one after if it helps anyhow (I have about 450GB free memory).

    Some outputs

    Code:
    # df
    Filesystem           1K-blocks      Used Available Use% Mounted on
    /dev/sda1              5201536   5173904         0 100% /
    tmpfs                  1023464         0   1023464   0% /lib/init/rw
    udev                     10240      2672      7568  27% /dev
    tmpfs                  1023464         0   1023464   0% /dev/shm
    /dev/sda2            478812280  10336484 444345032   3% /var
    overflow                  1024         4      1020   1% /tmp
    
    # parted print
    GNU Parted 2.3
    Using /dev/sda
    Welcome to GNU Parted! Type 'help' to view a list of commands.
    (parted) print
    Model: ATA ST3500418AS (scsi)
    Disk /dev/sda: 500GB
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos
    
    Number  Start   End     Size    Type     File system     Flags
     1      512B    5369MB  5369MB  primary  ext3            boot
     2      5369MB  500GB   494GB   primary  ext3
     3      500GB   500GB   538MB   primary  linux-swap(v1)
    Regards,
    Łukasz Kidziński

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,970
    To do this, you need to backup the contents of /var and /, then reduce the partition size (and starting block) of /var, extend the size of /, use resize2fs to resize /, mkfs.ext2 to reinitialize /var, then restore the data to /var. The backup of / is a precaution in case the resize operation fails for some reason and you have to reinitialize / completely.

    Alternatively, you can extend / to use the entire disc, change /etc/fstab to not mount /var, and make /var part of the root / file system, restoring the data there after resizing /.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Apr 2011
    Posts
    2
    Thank you very much for this answer. I will try to do it with strong focus on the backup part

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...