LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Reducing /tmp expanding /usr space (https://www.linuxquestions.org/questions/linux-general-1/reducing-tmp-expanding-usr-space-796021/)

richinsc 03-17-2010 08:22 AM

Reducing /tmp expanding /usr space
 
I have a request to shrink /tmp and expand /usr on a server. No problem, or so I thought. When I took a look at the partition table I saw this below.

Code:

/dev/cciss/c0d0p2    981M  216M  715M  24% /
udev                1014M  136K 1014M  1% /dev
/dev/cciss/c0d0p1    102M    0  102M  0% /altboot
/dev/cciss/c0d0p6    145M  5.6M  132M  5% /dsm
/dev/cciss/c0d1p7    2.9G  634M  2.2G  23% /opt
/dev/cciss/c0d0p7    3.9G  2.5G  1.3G  67% /usr
/dev/cciss/c0d1p6    2.0G  233M  1.6G  13% /var
/dev/md0              187G  189M  177G  1% /tmp

And the following entries in fstab

Code:

/dev/disk/by-id/cciss-3600508b1001fffffa00c10a8ff970006-part2 /                    ext3      acl,user_xattr        1 1
/dev/disk/by-id/cciss-3600508b1001fffffa00c10a8ff970006-part1 /altboot            vfat      users,gid=users,umask=0002,utf8=true 0 0
/dev/disk/by-id/cciss-3600508b1001fffffa00c10a8ff970006-part6 /dsm                ext3      acl,user_xattr        1 2
/dev/disk/by-id/cciss-3600508b1001fffffa0107e475dea0008-part7 /opt                ext3      acl,user_xattr        1 2
/dev/md0            /tmp                ext3      defaults              1 2
/dev/disk/by-id/cciss-3600508b1001fffffa00c10a8ff970006-part7 /usr                ext3      acl,user_xattr        1 2
/dev/disk/by-id/cciss-3600508b1001fffffa0107e475dea0008-part6 /var                ext3      acl,user_xattr        1 2
/dev/disk/by-id/cciss-3600508b1001fffffa00c10a8ff970006-part5 swap                swap      defaults              0 0
/dev/disk/by-id/cciss-3600508b1001fffffa0107e475dea0008-part5 swap                swap      defaults              0 0
proc                /proc                proc      defaults              0 0
sysfs                /sys                sysfs      noauto                0 0
debugfs              /sys/kernel/debug    debugfs    noauto                0 0
usbfs                /proc/bus/usb        usbfs      noauto                0 0
devpts              /dev/pts            devpts    mode=0620,gid=5      0 0
/dev/fd0            /media/floppy        auto      noauto,user,sync      0 0

Question is how do I deal with resizing /tmp when it doesn't look to be part of the same device? I can only assume that there is some software raid going on maybe when I shift partions around and whatnot I am used to seeing /dev/sda or /dev/hdb like devices.

I'm looking for suggestions on how to got about shrinking /tmp and expanding /var without having to re-install the server. Since this server has no gui, it's going to be difficult as I only have gpart installed and not gparted which is more gui based.

Are the device id's /dev/disk/by-id/cciss-3600508b1001fffffa00c10a8ff970006 from a hardware raid solution while md0 is a software? I'm just trying to understand the id scheme to determine if these disks are part of the same set.

richinsc 03-17-2010 08:43 AM

After doing a bit more research I found that md0 is a software raid of disk from each of the others. I still don't understand how I am going to be able to use this info. I may just break up the md0 and have /usr be on the larger disk.

Code:

/dev/md0:
        Version : 00.90.03
  Creation Time : Fri Mar  5 20:02:46 2010
    Raid Level : raid0
    Array Size : 198659520 (189.46 GiB 203.43 GB)
  Raid Devices : 2
  Total Devices : 2
Preferred Minor : 0
    Persistence : Superblock is persistent

    Update Time : Fri Mar  5 20:02:46 2010
          State : clean
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

    Chunk Size : 64K

          UUID : d6be963d:b453b5c5:269d7caa:760f3029
        Events : 0.1

    Number  Major  Minor  RaidDevice State
      0    104        8        0      active sync  /dev/cciss/c0d0p8
      1    104      24        1      active sync  /dev/cciss/c0d1p8


richinsc 03-17-2010 10:32 AM

I think I figured out a way for this, I'll document it for all to see.

avtandil_k 03-17-2010 10:37 AM

Thanks! I actually marked this thread to check out later what people said because I have no idea how to do that.

richinsc 03-18-2010 11:34 AM

1. df -h
Code:

Filesystem            Size  Used Avail Use% Mounted on
/dev/cciss/c0d0p2    981M  216M  715M  24% /
udev                1014M  136K 1014M  1% /dev
/dev/cciss/c0d0p1    102M    0  102M  0% /altboot
/dev/cciss/c0d0p6    145M  5.6M  132M  5% /dsm
/dev/cciss/c0d1p7    2.9G  634M  2.2G  23% /opt
/dev/cciss/c0d0p7    3.9G  2.5G  1.3G  67% /usr
/dev/cciss/c0d1p6    2.0G  233M  1.6G  13% /var
/dev/md0              187G  189M  177G  1% /tmp

2. cat /etc/fstab
Code:

/dev/disk/by-id/cciss-3600508b1001fffffa00c10a8ff970006-part2 /                    ext3      acl,user_xattr        1 1
/dev/disk/by-id/cciss-3600508b1001fffffa00c10a8ff970006-part1 /altboot            vfat      users,gid=users,umask=0002,utf8=true 0 0
/dev/disk/by-id/cciss-3600508b1001fffffa00c10a8ff970006-part6 /dsm                ext3      acl,user_xattr        1 2
/dev/disk/by-id/cciss-3600508b1001fffffa0107e475dea0008-part7 /opt                ext3      acl,user_xattr        1 2
/dev/md0            /tmp                ext3      defaults              1 2
/dev/disk/by-id/cciss-3600508b1001fffffa00c10a8ff970006-part7 /usr                ext3      acl,user_xattr        1 2
/dev/disk/by-id/cciss-3600508b1001fffffa0107e475dea0008-part6 /var                ext3      acl,user_xattr        1 2
/dev/disk/by-id/cciss-3600508b1001fffffa00c10a8ff970006-part5 swap                swap      defaults              0 0
/dev/disk/by-id/cciss-3600508b1001fffffa0107e475dea0008-part5 swap                swap      defaults              0 0
proc                /proc                proc      defaults              0 0
sysfs                /sys                sysfs      noauto                0 0
debugfs              /sys/kernel/debug    debugfs    noauto                0 0
usbfs                /proc/bus/usb        usbfs      noauto                0 0
devpts              /dev/pts            devpts    mode=0620,gid=5      0 0
/dev/fd0            /media/floppy        auto      noauto,user,sync      0 0

3. fdisk -l
4. umount /tmp
5. mdadm --misc -D /dev/md0
6. mdadm --manage -S /dev/md0
7. mdadm --manage /dev/md0 --remove
8. mv /etc/mdadm.conf /etc/mdadm.old10
9. cfdisk /dev/disk/by-id/cciss-3600508b1001fffffa00c10a8ff970006
10. cfdisk /dev/disk/by-id/cciss-3600508b1001fffffa0107e475dea0008
11. Delete /dev/disk/by-id/cciss-3600508b1001fffffa0107e475dea0008-part8, Recreate logical partition
12. mkfs.ext3 /dev/disk/by-id/cciss-3600508b1001fffffa0107e475dea0008-part8
Code:

 
mke2fs 1.38 (30-Jun-2005)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
16891904 inodes, 33754565 blocks
1687728 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=37748736
1031 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 26 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

14. vim /etc/fstab change /dev/md0 to part8, save changes
Code:

/dev/disk/by-id/cciss-3600508b1001fffffa00c10a8ff970006-part2 /                    ext3      acl,user_xattr        1 1
/dev/disk/by-id/cciss-3600508b1001fffffa00c10a8ff970006-part1 /altboot            vfat      users,gid=users,umask=0002,utf8=true 0 0
/dev/disk/by-id/cciss-3600508b1001fffffa00c10a8ff970006-part6 /dsm                ext3      acl,user_xattr        1 2
/dev/disk/by-id/cciss-3600508b1001fffffa0107e475dea0008-part7 /opt                ext3      acl,user_xattr        1 2
/dev/disk/by-id/cciss-3600508b1001fffffa0107e475dea0008-part8 /tmp                ext3      defaults              1 2
/dev/disk/by-id/cciss-3600508b1001fffffa00c10a8ff970006-part7 /usr                ext3      acl,user_xattr        1 2
/dev/disk/by-id/cciss-3600508b1001fffffa0107e475dea0008-part6 /var                ext3      acl,user_xattr        1 2
/dev/disk/by-id/cciss-3600508b1001fffffa00c10a8ff970006-part5 swap                swap      defaults              0 0
/dev/disk/by-id/cciss-3600508b1001fffffa0107e475dea0008-part5 swap                swap      defaults              0 0
proc                /proc                proc      defaults              0 0
sysfs                /sys                sysfs      noauto                0 0
debugfs              /sys/kernel/debug    debugfs    noauto                0 0
usbfs                /proc/bus/usb        usbfs      noauto                0 0
devpts              /dev/pts            devpts    mode=0620,gid=5      0 0
/dev/fd0            /media/floppy        auto      noauto,user,sync      0 0

15. mount /tmp
16. df -h
14. lsof /usr #Can't umount because of disk in use, thus can't expand
16. Drop into iLO Conosole to boot Single User Mode (Server is in Oregon, I'm in South Carolina)
17. Unable to use parted as it resided in /usr
18. Boot Knoppix (This took a long time to do remotely)
19. Resize using gparted
20. Reboot, Done
21. Login, check disks
Code:

df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/cciss/c0d0p2    981M  217M  715M  24% /
udev                1014M  132K 1014M  1% /dev
/dev/cciss/c0d0p1    102M    0  102M  0% /altboot
/dev/cciss/c0d0p6    145M  5.6M  132M  5% /dsm
/dev/cciss/c0d1p7    2.9G  634M  2.2G  23% /opt
/dev/cciss/c0d1p8    127G  189M  121G  1% /tmp
/dev/cciss/c0d0p7      64G  2.5G  58G  5% /usr
/dev/cciss/c0d1p6    2.0G  234M  1.6G  13% /var

22. fdisk -l
Code:

Disk /dev/cciss/c0d0: 72.8 GB, 72833679360 bytes
255 heads, 63 sectors/track, 8854 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

          Device Boot      Start        End      Blocks  Id  System
/dev/cciss/c0d0p1              1          13      104391    c  W95 FAT32 (LBA)
/dev/cciss/c0d0p2              14        140    1020127+  83  Linux
/dev/cciss/c0d0p3            141        8854    69995205    f  W95 Ext'd (LBA)
/dev/cciss/c0d0p5            141        402    2104483+  82  Linux swap / Solaris
/dev/cciss/c0d0p6            403        421      152586  83  Linux
/dev/cciss/c0d0p7            422        8854    67738041  83  Linux

Disk /dev/cciss/c0d1: 145.6 GB, 145667358720 bytes
255 heads, 63 sectors/track, 17709 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

          Device Boot      Start        End      Blocks  Id  System
/dev/cciss/c0d1p1              1      17709  142247511    f  W95 Ext'd (LBA)
/dev/cciss/c0d1p5              1        262    2104452  82  Linux swap / Solaris
/dev/cciss/c0d1p6            263        517    2048256  83  Linux
/dev/cciss/c0d1p7            518        900    3076416  83  Linux
/dev/cciss/c0d1p8            901      17709  135018261  83  Linux

I apologize for not gathering output of steps 3 - 11 I wasn't thinking about this when I was doing steps. By the way the Server was an HP DL380 G3 I think... Might have been G4, can't remember.


All times are GMT -5. The time now is 08:56 PM.