How to change the file system size in the Solaris system

Source: Internet
Author: User
Tags file system backup

As a system administrator, we often encounter the need to increase or shrink a file system. For the mainstream OS and Linux on UNIX, dynamic Logical Volume management (LVM) is a great help for us to do this job. But for Solaris systems that do not support LVM, they can only be implemented in a stupid way.

Assuming a working scenario, I need to add a separate file system to the server's hard drive, but there is no free space available on the hard drive. One alternative solution is to shrink some of the existing file systems and squeeze out some free space.

The hard drive now has three file systems ("/", "/usr", "/export/home"):

# df-h

FileSystem size used avail capacity mounted on

/dev/dsk/c0d0s0 5.8G 3.8G 2.0G 66%/

/DEV/DSK/C0D0S3 6G 4G 2.0G 66%/usr

/dev/dsk/c0d0s7 12G 12M 11G 1%/export/home

"/export/home" has the largest capacity, but has the least space to use, choose to shrink the file system to squeeze free space.

The following steps are to shrink the file system:

1, backup File system content

# tar Cvf/home.tar/export/home

2. Uninstall File system

# Umount/export/home

3, modify/etc/vfstab, note that the file system entries

# Vi/etc/vfstab

#device device Mount FS fsck Mount Mount

#to mount to fsck-type pass at boot options

#

#/dev/dsk/c0d0s7/dev/rdsk/c0d0s7/export/home UFS 2 Yes-

4. Reduce file system size with format

# format

300 words omitted here ...

The procedure is to make the file system S7 smaller and refer to other Format command document settings.

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/unix/

5. Reformat the file system with NEWFS

# NEWFS C0D0S7

Newfs:construct a new file System/dev/rdsk/c0d0s7: (y/n)? Y

warning:240 sector (s) in the last cylinder unallocated

/dev/rdsk/c0d0s7:12594960 sectors in 2050 cylinders tracks, 128 sectors

6149.9MB in 129 cyl groups (c/g, 48.00mb/g, 5824 i/g)

The shrinking file system is 6G, freeing up about 6G of free space.

6. Restore/etc/vfstab File System entries

# Vi/etc/vfstab

#device device Mount FS fsck Mount Mount

#to mount to fsck-type pass at boot options

#

/dev/dsk/c0d0s7/dev/rdsk/c0d0s7/export/home UFS 2 Yes-

Remove the "#" annotation in front of the file system

7. Re-mount the file system

# Mount/export/home

8, restore the backup to the file system

# tar Xvf/home.tar

9, since there is 6G free space, the rest of the matter will be good to do, I will not repeat.

The process of increasing the file system size is basically the same as shrinking, following this basic idea:

Back up file system contents--> Uninstall File system--> change file system size--> reformat file system--> reload--> restore original backup to file system.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.