Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The original size of /home was 2.9GB. I want to resize it to be 2.4GB so I can use 500MB for swap space.
When I did with just 2GB it worked fine! why not for 2.4GB then?
Code:
[root@localhost ~]# resize2fs $(cat /etc/fstab |grep "/home"|awk '{print $1}') 2G
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/mapper/vg_localhost-lv_home to 524288 (4k) blocks.
The filesystem on /dev/mapper/vg_localhost-lv_home is now 524288 blocks long.
Please find the evidence below which indicates the size of /home was 2.9GB
Code:
df -h /home
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_localhost-lv_home
2.9G 7.8M 2.7G 1% /home
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
Rep:
The size must be in cylinders. The program takes the numerical value and converts it to the nearest whole number of cylinders. One cylinder is 512 B/Sector x 64 sectors/track x 255 heads = 8,355,840 Bytes. 4k/sector drives use a different geometry, and GPT uses still a different geometry. The bottom line is, when you specify a certain size for a filesystem, it never is exactly that size.
The size must be in cylinders. The program takes the numerical value and converts it to the nearest whole number of cylinders. One cylinder is 512 B/Sector x 64 sectors/track x 255 heads = 8,355,840 Bytes. 4k/sector drives use a different geometry, and GPT uses still a different geometry. The bottom line is, when you specify a certain size for a filesystem, it never is exactly that size.
Without disagreeing with what you say about calculating cylinders, I don't agree that the size used in the command must be in cylinders...man page says:
Code:
The size parameter specifies the requested new size of the filesystem. If no units are specified, the units of the size parameter shall be the
filesystem blocksize of the filesystem. Optionally, the size parameter may be suffixed by one of the following the units designators: 's', 'K',
'M', or 'G', for 512 byte sectors, kilobytes, megabytes, or gigabytes, respectively. The size of the filesystem may never be larger than the size
of the partition. If size parameter is not specified, it will default to the size of the partition.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.