You are not logged in.
Hi,
I'm attempting to resize my partitions. Below is what I have:
root / # df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 9.7G 3.3G 6.0G 36% /
none 481M 0 481M 0% /dev/shm
/dev/sda1 130M 11M 113M 9% /boot
/dev/sda4 221G 200M 210G 1% /home
As you can see, /home has its own partition and it's consuming 220GB of my 250GB disk. Here is what I wanted to do:
1) Move /home to /home.bak
2) Create /home and mount it to /dev/sda3
3) Copy /home.bak back to the new /home directory
4) /dev/sda4 should now be completely empty
5) Remove the /dev/sda4 partition, leaving it as free space
6) Use resize2fs to make /dev/sda3 larger-- it shall consume the entire free space, which should be about 220GB.
However, step 1 is causing problems for me right now. When I issue the 'mv' command, I get the following:
root / # mv /home /home.bak
mv: cannot move `/home' to `/home.bak': Device or resource busy
Any idea what I can do about this? I'm not sure what exactly could be using /home. Is there a special mode I can put archlinux in to where nothing would be using it? Something similar to Windows' "Safemode"?
Last edited by void.pointer (2008-10-15 13:45:01)
Offline
Dont understood what you want to do with moving to bak, but boot livecd and resize partitions without bak
"god@heaven$ emerge world"
~ Genesis on Gentoo
Offline
I'm moving to /home.bak so I can create a *new* home directory on a new partition, then copy the original contents of /home.bak to /home again, but the act of doing so should transfer the contents of /home to a new partition.
Anyway, could you explain what livecd is? Also, I can't resize my partition for root until I free up space from sda4, right? That's why I'm trying to move /home, because it's in the partition I want to turn into free space for sda3.
Offline
Boot LiveCD then...
mount /dev/sda3 /mnt
mount /dev/sda4 /mnt/home
cd /mnt/home
tar cvzf /mnt/home.tar.gz *
cd ..
umount /mnt/home
cd /mnt/home
tar xvzf /mnt/home.tar.gz
Then use GParted or similar to delete sda4 and resize sda3, and then resize the file system to fill the new partition - that depends on what file system sda3 is formatted as, I'm guessing ext3?
Of course, the usual "make backups" warning applies!
Last edited by fukawi2 (2008-09-30 02:38:46)
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
Boot LiveCD then...
mount /dev/sda3 /mnt mount /dev/sda4 /mnt/home cd /mnt/home tar cvzf /mnt/home.tar.gz * cd .. umount /mnt/home cd /mnt/home tar xvzf /mnt/home.tar.gz
Then use GParted or similar to delete sda4 and resize sda3, and then resize the file system to fill the new partition - that depends on what file system sda3 is formatted as, I'm guessing ext3?
Of course, the usual "make backups" warning applies!
Yes it is ext3.
Could you explain each command in your code snippet, and why you're doing it? It would be extremely helpful. I am trying to learn as much about this as I can. Thanks for your help.
::EDIT::
Can the original installer that I downloaded from the website be used as the liveCD? I burned it to a CD a while back through Windows XP.
Also, will resizing sda3 with resize2fs erase the data on sda3? Or will the data be retained?
Last edited by void.pointer (2008-09-30 02:52:34)
Offline
The data will be retained. Gparted does exactly what you want with no fuzz.
You need the LiveCD or just dowbload GpartedLive:
http://gparted.sourceforge.net
Mektub
Follow me on twitter: https://twitter.com/johnbina
Offline
The data will be retained. Gparted does exactly what you want with no fuzz.
You need the LiveCD or just dowbload GpartedLive:
http://gparted.sourceforge.net
Mektub
I won't be able to use GParted because I do not have a GUI system, correct? Do I need to use just Parted instead? Also, my original question stands: Will the original installation ISO for archlinux work as a LiveCD?
Thanks to everyone for all the help.
Offline
Mektub wrote:The data will be retained. Gparted does exactly what you want with no fuzz.
You need the LiveCD or just dowbload GpartedLive:
http://gparted.sourceforge.net
Mektub
I won't be able to use GParted because I do not have a GUI system, correct? Do I need to use just Parted instead? Also, my original question stands: Will the original installation ISO for archlinux work as a LiveCD?
Thanks to everyone for all the help.
With GpartedLive you boot from the CD and you get a simple but functional GUI.
I havent used the installation ISO for archlinux for a long time, but if it is a LiveCD, you will be able to start gparted,
from a menu or opening a console and typing 'gparted'.
Parted would do the job, but most probably you would mess the filesystem with those arcane commands.
Mektub
Follow me on twitter: https://twitter.com/johnbina
Offline
Can the original installer that I downloaded from the website be used as the liveCD? I burned it to a CD a while back through Windows XP.
Yes - but the GParted LiveCD will probably be 'safer' as it is designed for doing things like this. The Arch Installation CD is designed to Install
I'll try explaining -- hope I make sense
mount /dev/sda3 /mnt ## Mount your normal 'root' to /mnt so we can access it from the LiveCD
mount /dev/sda4 /mnt/home ## Mount your normal 'home' to /mnt/home so we can access it from the LiveD
cd /mnt/home ## Change dir to your normal home directory so when we create the tar file, it doesn't have leading mnt/home/ or home/ which will be annoying when we extract the archive
tar cvzf /mnt/home.tar.gz * ## Create a tar archive in your normal 'root' containing your /home/* dirs and files
cd .. ## Change back to /mnt (which is your normal 'root' path) so we can unmount the 'home' partition. Otherwise we'll get a 'device busy' error when we try.
umount /mnt/home ## Unmount your original 'home' partition. We have the files in the tar archive and are finished with it.
cd /mnt/home ## CD back to an (empty) home directory on the 'root' partition.
tar xvzf /mnt/home.tar.gz ## Extract our backup of your original 'home' to the home directory on the 'root' partition.
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
void.pointer wrote:Can the original installer that I downloaded from the website be used as the liveCD? I burned it to a CD a while back through Windows XP.
Yes - but the GParted LiveCD will probably be 'safer' as it is designed for doing things like this. The Arch Installation CD is designed to Install
I'll try explaining -- hope I make sense
mount /dev/sda3 /mnt ## Mount your normal 'root' to /mnt so we can access it from the LiveCD mount /dev/sda4 /mnt/home ## Mount your normal 'home' to /mnt/home so we can access it from the LiveD cd /mnt/home ## Change dir to your normal home directory so when we create the tar file, it doesn't have leading mnt/home/ or home/ which will be annoying when we extract the archive tar cvzf /mnt/home.tar.gz * ## Create a tar archive in your normal 'root' containing your /home/* dirs and files cd .. ## Change back to /mnt (which is your normal 'root' path) so we can unmount the 'home' partition. Otherwise we'll get a 'device busy' error when we try. umount /mnt/home ## Unmount your original 'home' partition. We have the files in the tar archive and are finished with it. cd /mnt/home ## CD back to an (empty) home directory on the 'root' partition. tar xvzf /mnt/home.tar.gz ## Extract our backup of your original 'home' to the home directory on the 'root' partition.
Thanks that makes perfect sense.
I guess after I follow these steps, I delete the /dev/sda4 partition using gparted? After that, can I use gparted to resize /dev/sda3? Or is it preferred to use resize2fs?
Offline
I strongly recommend backing everything up and switching to LVM to simplify resizing partitions in the future.
http://wiki.archlinux.org/index.php/Lvm
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
I guess after I follow these steps, I delete the /dev/sda4 partition using gparted? After that, can I use gparted to resize /dev/sda3? Or is it preferred to use resize2fs?
You need to use GParted to delete sda4, then resize sda3 to consume the space sda4 _was_ occupying. Then you can use resize2fs to expand the ext3 filesystem to fill the newly expanded sda3.
I strongly recommend backing everything up and switching to LVM to simplify resizing partitions in the future.
That's a pretty good idea too IMHO.
One thing that hasn't been mentioned yet, is you'll need to check that sda3 and sda4 are adjacent to each other on the disk, otherwise you'll need to do the LVM approach (or just reinstall with the reallocated partitions). To check, just run `fdisk -l` as root. (That's a lower-case L for 'list'). As long as the "end" of sda3 is one number less than the "start" of sda4, then you're fine
You most likely are, it's rare for sequential partitions to be out of order, but it can happen.
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
I did want to do LVM but there were just too many unanswered questions I had after reading the LVM article on the Archlinux Wiki. It's not a very "tutorial-like" article, which is really what I need.
Additionally, reinstalling Archlinux is a bit annoying for me because there's a lot of boilerplate setup that I have to do again (Most of it I'm sure I don't remember). Also, I have configuration files that I need to save and I'm not really sure what approach to take to back them up and restore them later. I suppose I could backup everything through SCP and keep it on my windows machine until I get everything reinstalled.
Offline
I'm getting SO frustrated, I have to take a break before I punch my LCD.
I'm trying to setup my USB Flash Drive so that I can put the GParted Live stuff on it, however I can't seem to format my USB drive through linux properly, it's absolutely stupid. I tried fdisk, but I have no idea how to use this stupid thing. I looked online but I didn't see any detailed steps on what to do.
I need to setup my usb drive to use vfat, whatever that is, because that's what these instructions say to do for GParted Live.
Can anyone help me before I rip my hair out? Thanks.
Offline
Your shouldn't have to do anything in fdisk, and most USB sticks come formatted at fat these days....
Having said that, we don't know what you've done to your stick now
Do you know what block device your USB stick is on? (eg, /dev/sda or /dev/sdb etc)
Can you post the output of
fdisk -l /dev/sdX
Where sdX is the block device for your stick.
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
Your shouldn't have to do anything in fdisk, and most USB sticks come formatted at fat these days....
Having said that, we don't know what you've done to your stick now
Do you know what block device your USB stick is on? (eg, /dev/sda or /dev/sdb etc)
Can you post the output of
fdisk -l /dev/sdX
Where sdX is the block device for your stick.
Thanks for responding. Fortunately I haven't broken my USB drive yet from throwing it against the wall
I'm pretty sure it is on /dev/sdb, however it took a lot of effort to figure this out. Isn't there some sort of list I can look at that shows a list of all devices mapped to /dev/XXXX? I was using dmesg to figure out the mapping, but it's basically guess work and trial/error. It would be nice to have something a lot more intuitive.
Here is the output you requested:
# fdisk -l /dev/sdb
Disk /dev/sdb: 1007 MB, 1007681536 bytes
31 heads, 62 sectors/track, 1024 cylinders
Units = cylinders of 1922 * 512 = 984064 bytes
Disk identifier: 0x8a98466c
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 1 0 0 Empty
Partition 1 has different physical/logical beginnings (non-Linux?):
phys=(0, 0, 0) logical=(0, 0, 1)
Partition 1 has different physical/logical endings:
phys=(0, 0, 0) logical=(1671506523, 3, 16)
Partition 1 does not end on cylinder boundary.
I've already played around with fdisk without knowing what the hell I was doing and probably screwed up my flash drive at this point. Hopefully the information above adequately expresses what shape it is in.
Last edited by void.pointer (2008-10-09 03:22:01)
Offline
Interesting result you've got there! /dev/sdb looks right since it's only 1007mb. Unless you have any 1gb hard drives in your computer?
Make sure your stick isn't mounted anywhere, then do this (assuming you don't care about whatever data is on the stick, if any):
fdisk /dev/sdb #open fdisk to edit the part table on the thumb drive
d # delete the existing partition
n # create a new partition
p # primary partition
1 # partition 1
<enter> # accept the default
<enter> # accept the default
t # change the partition type
b # type "W95 FAT32"
w # write the new partition table
mkfs -t vfat /dev/sdb1 # format the partition we created at vfat
Obviously don't type my comments (after the # symbol )
Make sure that when you run `fdisk -l /dev/sdb` after that that it looks similar to the following
Disk /dev/sdb: 1007 MB, 1007681536 bytes
31 heads, 62 sectors/track, 1024 cylinders
Units = cylinders of 1922 * 512 = 984064 bytes
Disk identifier: 0x8a98466c
Device Boot Start End Blocks Id System
/dev/sda1 1 24321 195358401 b W95 FAT32
Last edited by fukawi2 (2008-10-09 03:57:20)
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
Interesting result you've got there! /dev/sdb looks right since it's only 1007mb. Unless you have any 1gb hard drives in your computer?
Make sure your stick isn't mounted anywhere, then do this (assuming you don't care about whatever data is on the stick, if any):
fdisk /dev/sdb #open fdisk to edit the part table on the thumb drive d # delete the existing partition n # create a new partition p # primary partition 1 # partition 1 <enter> # accept the default <enter> # accept the default t # change the partition type b # type "W95 FAT32" w # write the new partition table mkfs -t vfat /dev/sdb1 # format the partition we created at vfat
Obviously don't type my comments (after the # symbol )
Make sure that when you run `fdisk -l /dev/sdb` after that that it looks similar to the following
Disk /dev/sdb: 1007 MB, 1007681536 bytes 31 heads, 62 sectors/track, 1024 cylinders Units = cylinders of 1922 * 512 = 984064 bytes Disk identifier: 0x8a98466c Device Boot Start End Blocks Id System /dev/sda1 1 24321 195358401 b W95 FAT32
Awesome! You rock! This worked perfectly and smoothly!
I have two more questions for the future, though:
1) When I insert USB devices in the future, is there an easy way to find out what they're mapped to?
2) Why did you use /dev/sdb1 instead of /dev/sdb in the call to mkfs -t?
Thanks so much!
Offline
Okay so I can't mount it still for some reason...
# fdisk -l /dev/sdb
Disk /dev/sdb: 1007 MB, 1007681536 bytes
31 heads, 62 sectors/track, 1024 cylinders
Units = cylinders of 1922 * 512 = 984064 bytes
Disk identifier: 0x8a98466c
Device Boot Start End Blocks Id System
/dev/sdb1 1 1024 984033 b W95 FAT32
# mount -t vfat /dev/sdb /mnt/flash
mount: wrong fs type, bad option, bad superblock on /dev/sdb,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
I get this message in errors.log:
Oct 9 08:41:52 server FAT: bogus number of reserved sectors
Last edited by void.pointer (2008-10-09 13:43:43)
Offline
This should do it:
mount /dev/sdb1 /mnt/flash
You need to include the partition number (1) as well. See answer 2 below
To answer your other questions:
1) The easiest way (IMHO) to find the device path is to either:
a) Insert the stick, then look at the last few lines of `dmesg`. Assuming you only plug in one device at a time, it will be in the last few lines.
b) Insert, then run `fdisk -l` and look for a device with a matching size (ie, 1007mb as per above)
2) /dev/sdb is the device. /dev/sdb1 is the partition within the device. Think of it like sdb is your filing cabinet, and sdb1 is the drawer in your filing cabinet. The kernel needs to know which drawer (1) as well as which filing cabinet (sdb) you want to mount, even when there's only one
Last edited by fukawi2 (2008-10-09 21:46:43)
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
This should do it:
mount /dev/sdb1 /mnt/flash
You need to include the partition number (1) as well. See answer 2 below
To answer your other questions:
1) The easiest way (IMHO) to find the device path is to either:
a) Insert the stick, then look at the last few lines of `dmesg`. Assuming you only plug in one device at a time, it will be in the last few lines.
b) Insert, then run `fdisk -l` and look for a device with a matching size (ie, 1007mb as per above)2) /dev/sdb is the device. /dev/sdb1 is the partition within the device. Think of it like sdb is your filing cabinet, and sdb1 is the drawer in your filing cabinet. The kernel needs to know which drawer (1) as well as which filing cabinet (sdb) you want to mount, even when there's only one
You're awesome. You should write a book! Thanks so much!
Offline
Another question.
Suppose I wanted to reinstall Archlinux so I could setup LVM. Is there an automated backup process for Archlinux? I'm thinking of something that finds and backs up all config files (Mostly everything in /etc, for example), and allows easy application of backups after a fresh install.
I'm a bit concerned about backing up archlinux, since there's countless things I need to worry about saving. I'm really afraid I'll end up forgetting about something. How do Archlinux users typically perform backups before a reinstall or other major change?
::EDIT::
So I was in the process of trying to boot from my flash drive, but even though in my BIOS I have set my USB drive to boot before my HDD, it still boots directly into GRUB/Archlinux. How can I setup my USB drive to be bootable? I copied the contents of gparted live ZIP to the flash drive, I guess that wasn't enough? I tried to use fdisk to make the drive bootable, but that didn't work either I guess.
Last edited by void.pointer (2008-10-12 02:44:18)
Offline
Another question.
Suppose I wanted to reinstall Archlinux so I could setup LVM. Is there an automated backup process for Archlinux? I'm thinking of something that finds and backs up all config files (Mostly everything in /etc, for example), and allows easy application of backups after a fresh install.
I'm a bit concerned about backing up archlinux, since there's countless things I need to worry about saving. I'm really afraid I'll end up forgetting about something. How do Archlinux users typically perform backups before a reinstall or other major change?
::EDIT::
So I was in the process of trying to boot from my flash drive, but even though in my BIOS I have set my USB drive to boot before my HDD, it still boots directly into GRUB/Archlinux. How can I setup my USB drive to be bootable? I copied the contents of gparted live ZIP to the flash drive, I guess that wasn't enough? I tried to use fdisk to make the drive bootable, but that didn't work either I guess.
Still looking for help on this! Sorry to rush!
Offline
Suppose I wanted to reinstall Archlinux so I could setup LVM. Is there an automated backup process for Archlinux? I'm thinking of something that finds and backs up all config files (Mostly everything in /etc, for example), and allows easy application of backups after a fresh install.
I'm a bit concerned about backing up archlinux, since there's countless things I need to worry about saving. I'm really afraid I'll end up forgetting about something. How do Archlinux users typically perform backups before a reinstall or other major change?
Not really. The following 3 steps should cover you:
1) Backup your /etc directory. All your system config is live here.
2) Backup your /home directory. All your data and personal config is live here.
3) Save a list of your installed packages using `pacman -Qe > ~/packages.list`
You can use the file from step 3 to reinstall all the same applications again after you reinstall:
http://bbs.archlinux.org/viewtopic.php? … 35#p422635
I copied the contents of gparted live ZIP to the flash drive, I guess that wasn't enough? I tried to use fdisk to make the drive bootable, but that didn't work either I guess.
Nope, it's not that easy
I've had a go at trying to figure it out before too without success, sorry.
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
void.pointer wrote:Suppose I wanted to reinstall Archlinux so I could setup LVM. Is there an automated backup process for Archlinux? I'm thinking of something that finds and backs up all config files (Mostly everything in /etc, for example), and allows easy application of backups after a fresh install.
I'm a bit concerned about backing up archlinux, since there's countless things I need to worry about saving. I'm really afraid I'll end up forgetting about something. How do Archlinux users typically perform backups before a reinstall or other major change?
Not really. The following 3 steps should cover you:
1) Backup your /etc directory. All your system config is live here.
2) Backup your /home directory. All your data and personal config is live here.
3) Save a list of your installed packages using `pacman -Qe > ~/packages.list`You can use the file from step 3 to reinstall all the same applications again after you reinstall:
http://bbs.archlinux.org/viewtopic.php? … 35#p422635void.pointer wrote:I copied the contents of gparted live ZIP to the flash drive, I guess that wasn't enough? I tried to use fdisk to make the drive bootable, but that didn't work either I guess.
Nope, it's not that easy
I've had a go at trying to figure it out before too without success, sorry.
At this point I'm going to just install LVM, since I can resize my partitions through SSH with it I hope.
The LVM article on the Archlinux wiki wasn't really helpful to me, is there a more dummified tutorial out there? I know I need to backup everything you told me to, and then prepare an Archlinux install CD. However, I'm not sure what needs to be done before installing archlinux in regards to setting up LVM.
Thanks, you've been very helpful!
Offline