升级后,为什么使用的磁盘空间比 apt-get 估计的多得多?

升级后,为什么使用的磁盘空间比 apt-get 估计的多得多?

我使用 apt-get 升级一个软件包,它显示:

  sam@sam:~/code/ros/pcl$ sudo apt-get upgrade ros-electric-perception-pcl
  Reading package lists... Done
  Building dependency tree       
  Reading state information... Done
  The following packages have been kept back:
    assimp-dev firefox firefox-globalmenu flashplugin-installer icedtea-netx icedtea-plugin icedtea6-plugin
    libeigen3-dev libopencv2.3 libopencv2.3-bin libopencv2.3-dev libpcl-all linux-generic linux-headers-generic
    linux-image-generic nautilus-dropbox openrave0.6-dp-base openrave0.6-dp-plugin-bulletrave
    openrave0.6-dp-plugin-dualmanipulation openrave0.6-dp-plugin-grasper openrave0.6-dp-plugin-ikfastsolvers
    openrave0.6-dp-plugin-oderave openrave0.6-dp-plugin-qtcoinrave openrave0.6-dp-plugin-textserver
    openrave0.6-dp-plugins-base openrave0.6-dp-python ros-electric-arbotix ros-electric-arm-navigation
    ros-electric-arm-navigation-experimental ros-electric-asctec-drivers ros-electric-assimp
    ros-electric-audio-common ros-electric-bond-core ros-electric-bosch-3rdparty ros-electric-bosch-common
    ros-electric-bosch-drivers ros-electric-bosch-image-proc ros-electric-bosch-manipulation-utils
    ros-electric-brown-drivers ros-electric-brown-perception ros-electric-brown-remotelab ros-electric-bullet
    ros-electric-camera-drivers ros-electric-camera-pose ros-electric-camera-umd ros-electric-care-o-bot
    ros-electric-care-o-bot-desktop ros-electric-care-o-bot-robot ros-electric-cart-pushing
    ros-electric-clearpath-common ros-electric-clearpath-husky ros-electric-clearpath-husky-robot
    ros-electric-clearpath-kinect ros-electric-clearpath-kingfisher ros-electric-clearpath-kingfisher-robot
    ros-electric-clearpath-turtlebot ros-electric-client-rosjava-jni ros-electric-cob-command-tools
    ros-electric-cob-common ros-electric-cob-driver ros-electric-cob-environment-perception
    ros-electric-cob-environments ros-electric-cob-extern ros-electric-cob-simulation ros-electric-common
    ros-electric-common-msgs ros-electric-common-rosdeps ros-electric-common-tutorials ros-electric-continuous-ops
    ros-electric-control ros-electric-cram-pl ros-electric-csiro-asl-utils ros-electric-desktop
    ros-electric-desktop-full ros-electric-diagnostics ros-electric-diagnostics-monitors ros-electric-documentation
    ros-electric-driver-common ros-electric-dynamixel-motor ros-electric-ecl-core ros-electric-ecl-lite
    ros-electric-ecl-manipulation ros-electric-ecl-navigation ros-electric-ecl-tools ros-electric-eigen
    ros-electric-erratic-robot ros-electric-ethzasl-aseba ros-electric-executive-smach
    ros-electric-executive-smach-visualization ros-electric-exploration ros-electric-filters
    ros-electric-flirtlib-features ros-electric-freiburg-tools ros-electric-geometry
    ros-electric-geometry-experimental ros-electric-geometry-tutorials ros-electric-geometry-visualization
    ros-electric-gps-umd ros-electric-humanoid-walk ros-electric-ias-common ros-electric-image-common
    ros-electric-image-pipeline ros-electric-image-transport-plugins ros-electric-imu-drivers ros-electric-industrial
    ros-electric-joystick-drivers ros-electric-joystick-drivers-tutorials ros-electric-knowrob
    ros-electric-laser-drivers ros-electric-laser-pipeline ros-electric-linux-networking ros-electric-map-manager-app
    ros-electric-map-store ros-electric-mav-tools ros-electric-mobile ros-electric-motion-analysis-mocap
    ros-electric-move-arm ros-electric-multimaster ros-electric-multimaster-experimental ros-electric-navigation
    ros-electric-netft ros-electric-nodelet-core ros-electric-nxt ros-electric-nxt-apps ros-electric-nxt-robots
    ros-electric-nxtall ros-electric-object-manipulation ros-electric-object-recognition
    ros-electric-occupancy-grid-utils ros-electric-octomap-mapping ros-electric-openni-kinect
    ros-electric-orocos-kinematics-dynamics ros-electric-orocos-toolchain ros-electric-p2os ros-electric-perception
    ros-electric-perception-pcl ros-electric-perception-pcl-addons ros-electric-physics-ode ros-electric-pluginlib
    ros-electric-point-cloud-perception ros-electric-pr2 ros-electric-pr2-applications ros-electric-pr2-apps
    ros-electric-pr2-arm-navigation ros-electric-pr2-arm-navigation-tests ros-electric-pr2-base
    ros-electric-pr2-calibration ros-electric-pr2-common ros-electric-pr2-common-actions ros-electric-pr2-controllers
    ros-electric-pr2-desktop ros-electric-pr2-dremel ros-electric-pr2-ethercat-drivers ros-electric-pr2-exploration
    ros-electric-pr2-gui ros-electric-pr2-kinematics ros-electric-pr2-make-a-map-app
    ros-electric-pr2-mannequin-mode-app ros-electric-pr2-map-navigation-app ros-electric-pr2-mechanism
    ros-electric-pr2-navigation ros-electric-pr2-navigation-apps ros-electric-pr2-object-manipulation
    ros-electric-pr2-pan-tilt ros-electric-pr2-plugs ros-electric-pr2-power-drivers ros-electric-pr2-props-app
    ros-electric-pr2-props-stack ros-electric-pr2-ps3-joystick-app ros-electric-pr2-robot ros-electric-pr2-self-test
    ros-electric-pr2-simulator ros-electric-pr2-tabletop-manipulation-apps ros-electric-pr2-teleop-app
    ros-electric-pr2-tuck-arms-app ros-electric-qt-ros ros-electric-remote-lab ros-electric-riq-hand
    ros-electric-robot ros-electric-robot-calibration ros-electric-robot-model ros-electric-robot-model-tutorials
    ros-electric-robot-model-visualization ros-electric-ros ros-electric-ros-applications ros-electric-ros-base
    ros-electric-ros-comm ros-electric-ros-full ros-electric-ros-realtime ros-electric-ros-release
    ros-electric-ros-tutorials ros-electric-rosh-desktop-plugins ros-electric-rosh-robot-plugins ros-electric-roshpit
    ros-electric-roslisp-common ros-electric-roslisp-support ros-electric-rosorg ros-electric-rosserial
    ros-electric-rtt-common-msgs ros-electric-rtt-geometry ros-electric-rtt-ros-comm ros-electric-rtt-ros-integration
    ros-electric-rx ros-electric-scan-tools ros-electric-schunk-modular-robotics ros-electric-shadow-robot
    ros-electric-shared-autonomy ros-electric-simple-arms ros-electric-simple-object-capture
    ros-electric-simulator-gazebo ros-electric-simulator-stage ros-electric-simulators ros-electric-slam-gmapping
    ros-electric-slam-karto ros-electric-sound-drivers ros-electric-sql-database ros-electric-stage
    ros-electric-tabletop-object-perception ros-electric-turtlebot ros-electric-turtlebot-apps
    ros-electric-turtlebot-arm ros-electric-turtlebot-desktop ros-electric-turtlebot-robot
    ros-electric-turtlebot-simulator ros-electric-turtlebot-simulator-desktop ros-electric-turtlebot-viz
    ros-electric-velodyne ros-electric-vision-opencv ros-electric-vision-visp ros-electric-visualization
    ros-electric-visualization-common ros-electric-visualization-experimental ros-electric-visualization-tutorials
    ros-electric-viz ros-electric-warehousewg ros-electric-web-interface ros-electric-wg-common ros-electric-wg-pr2
    ros-electric-wg-pr2-apps ros-electric-wifi-drivers ros-electric-worldmodel ros-electric-xacro
  The following packages will be upgraded:
    app-install-data-partner apparmor apparmor-utils apport apport-gtk apt apt-transport-https apt-utils aptdaemon
    aptdaemon-data bind9-host bluez bluez-alsa bluez-cups bluez-gstreamer ca-certificates-java cvs dnsutils dpkg
    dpkg-dev ffmpeg firefox-gnome-support firefox-locale-en firefox-locale-zh-hant gdm-guest-session
    gir1.2-dbusmenu-glib-0.4 gnome-keyring gnome-power-manager gnome-user-guide grub-gfxpayload-lists
    gsettings-desktop-schemas gummi gvfs gvfs-backends gvfs-fuse icedtea-6-jre-cacao icedtea-6-jre-jamvm imagemagick
    initscripts insserv isc-dhcp-client isc-dhcp-common kdebase-runtime kdebase-runtime-data krb5-multidev
    language-pack-en language-pack-en-base language-pack-gnome-en language-pack-gnome-en-base libapparmor-perl
    libapparmor1 libavcodec-dev libavcodec52 libavdevice52 libavfilter1 libavformat-dev libavformat52 libavutil-dev
    libavutil50 libbind9-60 libbluetooth-dev libbluetooth3 libdbusmenu-glib3 libdbusmenu-gtk3 libdns69 libdpkg-perl
    libdvdread4 libexif-dev libexif12 libfreetype6 libfreetype6-dev libgcr0 libgksu2-0 libgl1-mesa-dev
    libgl1-mesa-dri libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev libgnutls26 libgp11-0 libgssapi-krb5-2 libgssrpc4
    libgvfscommon0 libgweather-common libgweather1 libimobiledevice2 libisc62 libisccc60 libisccfg62 libk5crypto3
    libkadm5clnt-mit7 libkadm5srv-mit7 libkdb5-4 libkrb5-3 libkrb5-dev libkrb5support0 liblwres60 libmagickcore3
    libmagickcore3-extra libmagickwand3 libmono-accessibility1.0-cil libmono-accessibility2.0-cil
    libmono-bytefx0.7.6.1-cil libmono-bytefx0.7.6.2-cil libmono-c5-1.1-cil libmono-cairo1.0-cil libmono-cairo2.0-cil
    libmono-cecil-private-cil libmono-cil-dev libmono-corlib1.0-cil libmono-corlib2.0-cil libmono-cscompmgd7.0-cil
    libmono-cscompmgd8.0-cil libmono-data-tds1.0-cil libmono-data-tds2.0-cil libmono-data1.0-cil libmono-data2.0-cil
    libmono-db2-1.0-cil libmono-debugger-soft0.0-cil libmono-dev libmono-getoptions1.0-cil libmono-getoptions2.0-cil
    libmono-i18n-west1.0-cil libmono-i18n-west2.0-cil libmono-i18n1.0-cil libmono-i18n2.0-cil libmono-ldap1.0-cil
    libmono-ldap2.0-cil libmono-management2.0-cil libmono-messaging-rabbitmq2.0-cil libmono-messaging2.0-cil
    libmono-microsoft-build2.0-cil libmono-microsoft7.0-cil libmono-microsoft8.0-cil libmono-npgsql1.0-cil
    libmono-npgsql2.0-cil libmono-oracle1.0-cil libmono-oracle2.0-cil libmono-peapi1.0-cil libmono-peapi2.0-cil
    libmono-posix1.0-cil libmono-posix2.0-cil libmono-rabbitmq2.0-cil libmono-relaxng1.0-cil libmono-relaxng2.0-cil
    libmono-security1.0-cil libmono-security2.0-cil libmono-sharpzip0.6-cil libmono-sharpzip0.84-cil
    libmono-sharpzip2.6-cil libmono-sharpzip2.84-cil libmono-simd2.0-cil libmono-sqlite1.0-cil libmono-sqlite2.0-cil
    libmono-system-data-linq2.0-cil libmono-system-data1.0-cil libmono-system-data2.0-cil libmono-system-ldap1.0-cil
    libmono-system-ldap2.0-cil libmono-system-messaging1.0-cil libmono-system-messaging2.0-cil
    libmono-system-runtime1.0-cil libmono-system-runtime2.0-cil libmono-system-web-mvc1.0-cil
    libmono-system-web-mvc2.0-cil libmono-system-web1.0-cil libmono-system-web2.0-cil libmono-system1.0-cil
    libmono-system2.0-cil libmono-tasklets2.0-cil libmono-wcf3.0-cil libmono-webbrowser0.5-cil
    libmono-windowsbase3.0-cil libmono-winforms1.0-cil libmono-winforms2.0-cil libmono0 libmono1.0-cil libmono2.0-cil
    libmysqlclient-dev libmysqlclient16 libnm-glib-vpn1 libnm-glib2 libnm-util1 libpam-gnome-keyring libpng12-0
    libpng12-dev libpostproc51 libpq-dev libpq5 libpurple-bin libpurple0 libqt4-core libqt4-dbus libqt4-declarative
    libqt4-designer libqt4-dev libqt4-help libqt4-network libqt4-opengl libqt4-opengl-dev libqt4-qt3support
    libqt4-script libqt4-scripttools libqt4-sql libqt4-sql-mysql libqt4-sql-sqlite libqt4-svg libqt4-test libqt4-xml
    libqt4-xmlpatterns libqtcore4 libqtgui4 libraptor1 libreoffice-base-core libreoffice-calc libreoffice-common
    libreoffice-core libreoffice-draw libreoffice-emailmerge libreoffice-gnome libreoffice-gtk libreoffice-help-en-gb
    libreoffice-help-en-us libreoffice-help-zh-tw libreoffice-impress libreoffice-l10n-common libreoffice-l10n-en-gb
    libreoffice-l10n-en-za libreoffice-l10n-zh-tw libreoffice-math libreoffice-style-human libreoffice-writer
    libruby1.8 libservlet2.5-java libsmbclient libsnmp-base libsnmp15 libssl-dev libssl0.9.8 libswscale-dev
    libswscale0 libsyncdaemon-1.0-1 libtasn1-3 libtiff4 libtiff4-dev libtiffxx0c2 libwbclient0 libwxbase2.8-0
    libwxbase2.8-dev libwxgtk2.8-0 libwxgtk2.8-dev libxml2 libxml2-dev libxml2-utils light-themes linux-firmware
    linux-headers-2.6.38-13 linux-headers-2.6.38-13-generic linux-image-2.6.38-13-generic linux-libc-dev
    mesa-common-dev mobile-broadband-provider-info mono-2.0-devel mono-2.0-gac mono-csharp-shell mono-devel mono-gac
    mono-gmcs mono-runtime monodoc-base monodoc-manual multiarch-support mysql-common network-manager
    network-manager-gnome nvidia-common nvidia-current openjdk-6-jdk openjdk-6-jre openjdk-6-jre-headless
    openjdk-6-jre-lib openni-dev openrave openrave-minimal openrave-python-minimal openrave0.6-dp openrave0.6-dp-data
    openrave0.6-dp-dev openrave0.6-dp-ikfast openrave0.6-dp-matlab openrave0.6-dp-octave
    openrave0.6-dp-plugin-logging openrave0.6-dp-plugins-all openssl plasma-scriptengine-declarative
    plasma-scriptengine-javascript ps-engine python-apport python-aptdaemon python-aptdaemon-gtk
    python-aptdaemon.gtk3widgets python-aptdaemon.gtkwidgets python-crypto python-httplib2 python-launchpadlib
    python-libxml2 python-pam python-papyon python-problem-report python-tz python-ubuntuone-client
    python-ubuntuone-storageprotocol python-uno python-wxgtk2.8 python-wxversion qt4-designer qt4-dev-tools qt4-doc
    qt4-qmake ruby1.8 ruby1.8-dev samba-common samba-common-bin smbclient software-center sudo sysv-rc sysvinit-utils
    tomboy ttf-opensymbol tzdata tzdata-java ubuntu-sso-client ubuntuone-client ubuntuone-client-gnome udisks unity
    unity-common uno-libs3 update-manager update-manager-core ure whois wx2.8-headers xserver-xorg-video-intel
    xul-ext-ubufox
  346 upgraded, 0 newly installed, 0 to remove and 242 not upgraded.
  Need to get 514 MB of archives.
  After this operation, 15.8 MB of additional disk space will be used.
  Do you want to continue [Y/n]?                                                                  

由于它说“此操作后,将使用 15.8 MB 的额外磁盘空间。”,所以我在升级前尝试 df:

  sam@sam:~/code/ros/pcl$ df -m
  Filesystem           1M-blocks      Used Available Use% Mounted on
  /dev/sda6                46934     22391     22160  51% /
  none                      1973         1      1973   1% /dev
  none                      1981        15      1967   1% /dev/shm
  none                      1981         1      1981   1% /var/run
  none                      1981         0      1981   0% /var/lock
  /dev/sdb1               469453     79594    366013  18% /media/Externel_500G
  sam@sam:~/code/ros/pcl$      

升级后:

  sam@sam:~/code/ros/pcl$ df -m
  Filesystem           1M-blocks      Used Available Use% Mounted on
  /dev/sda6                46934     23114     21437  52% /
  none                      1973         1      1973   1% /dev
  none                      1981        15      1967   1% /dev/shm
  none                      1981         1      1981   1% /var/run
  none                      1981         0      1981   0% /var/lock
  /dev/sdb1               469453     79594    366013  18% /media/Externel_500G
  sam@sam:~/code/ros/pcl$       

数字 21437-22160 大约是 700MB,但是 apt-get 说它需要 15.8 MB。

如何修复?

或者是否可以清除它下载的所有档案?这样可以节省磁盘空间吗?

谢谢〜


我关注了@izx 的回答。

现在我运行:

  sam@sam:~/code/ros/pcl$ sudo apt-get clean
  [sudo] password for sam: 
  sam@sam:~/code/ros/pcl$ df -m
  檔案系統           1M-區段      已用     可用 已用% 掛載點
  /dev/sda6                46934     22558     21993  51% /
  none                      1973         1      1973   1% /dev
  none                      1981        15      1967   1% /dev/shm
  none                      1981         1      1981   1% /var/run
  none                      1981         0      1981   0% /var/lock
  /dev/sdb1               469453     79594    366013  18% /media/Externel_500G
  sam@sam:~/code/ros/pcl$                         

现在又回到了22G左右。

磁盘空间:

  22.16G - 22G - 15.8MB =
  0.16G - 15.8MB =
  160MB - 15.8MB =
  144.2MB

丢失的144.2MB去哪了?

谢谢〜

答案1

笔记: apt-get upgrade 不能可用于升级单个软件包 - 用于apt-get install此目的。如您的输出所示,您升级了系统上未被阻止的大多数软件包。

  • 其中大部分来自apt-get缓存的 .deb 文件 —— 至少 514MB!
    • 您只需运行 即可恢复空间sudo apt-get clean
  • apt-get由于文件系统的工作方式,估计值通常偏低;可占用的最小逻辑磁盘空间量是“块”,对于 ext4 通常为 4 kB。
    • 所以你应该舍入向上每个新安装/升级的文件所占用的实际空间,精确到 4 kB。
    • 如果安装的软件包中有很多小于 4k 的小文件,那么实际使用的磁盘空间将高于估计值。
  • 最后,您的升级还安装了新的内核映像和内核头文件;安全原因,apt-get将要永远不要删除旧的内核映像/标题。。这可能占用了~100MB 的空间。
    • 您可以在成功重启后手动删除旧内核:使用dpkg --list | grep linux-找出要删除的确切软件包名称,或者使用 Synaptic。

相关内容